summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-03-01 18:53:00 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-03-01 18:53:00 +0000
commitd1d9256f90a7de9c05d0ecbb7056f1745d11241f (patch)
treef062d676188bf0b5e2561017e0425dbd77dea7f4
parent636b6973a6918b01c5a21ff397479ab9ecea2306 (diff)
parent9396a3bdcaea77fc7e633b79fad487f76954e90d (diff)
downloadjdk8-d1d9256f90a7de9c05d0ecbb7056f1745d11241f.tar.gz
Add JDK build 1.8.0_152-android-4343112-1 to staging
am: 9396a3bdca Change-Id: I8d5f86ea803a4f0324fc9c997812b068e2f3bc74
-rw-r--r--staging/darwin-x86/ASSEMBLY_EXCEPTION27
-rw-r--r--staging/darwin-x86/LICENSE347
-rw-r--r--staging/darwin-x86/MODULE_LICENSE_GPL0
-rw-r--r--staging/darwin-x86/THIRD_PARTY_README3574
-rwxr-xr-xstaging/darwin-x86/bin/appletviewerbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/extcheckbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/idljbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jarbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jarsignerbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/javabin0 -> 73880 bytes
-rwxr-xr-xstaging/darwin-x86/bin/javacbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/javadocbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/javahbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/javapbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jcmdbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jconsolebin0 -> 74024 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jdbbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jdepsbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jhatbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jinfobin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jjsbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jmapbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jpsbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jrunscriptbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jsadebugdbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jstackbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jstatbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/jstatdbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/keytoolbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/native2asciibin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/orbdbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/pack200bin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/policytoolbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/rmicbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/rmidbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/rmiregistrybin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/schemagenbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/serialverbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/servertoolbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/tnameservbin0 -> 74024 bytes
-rwxr-xr-xstaging/darwin-x86/bin/unpack200bin0 -> 120544 bytes
-rwxr-xr-xstaging/darwin-x86/bin/wsgenbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/bin/wsimportbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/bin/xjcbin0 -> 74008 bytes
-rw-r--r--staging/darwin-x86/include/classfile_constants.h560
-rw-r--r--staging/darwin-x86/include/darwin/jawt_md.h77
-rw-r--r--staging/darwin-x86/include/darwin/jni_md.h42
-rw-r--r--staging/darwin-x86/include/jawt.h299
-rw-r--r--staging/darwin-x86/include/jdwpTransport.h259
-rw-r--r--staging/darwin-x86/include/jni.h1960
-rw-r--r--staging/darwin-x86/include/jvmti.h2534
-rw-r--r--staging/darwin-x86/include/jvmticmlr.h115
-rw-r--r--staging/darwin-x86/jre/ASSEMBLY_EXCEPTION27
-rw-r--r--staging/darwin-x86/jre/LICENSE347
-rw-r--r--staging/darwin-x86/jre/THIRD_PARTY_README3574
-rwxr-xr-xstaging/darwin-x86/jre/bin/javabin0 -> 73880 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/jjsbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/keytoolbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/orbdbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/pack200bin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/policytoolbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/rmidbin0 -> 74008 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/rmiregistrybin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/servertoolbin0 -> 74016 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/tnameservbin0 -> 74024 bytes
-rwxr-xr-xstaging/darwin-x86/jre/bin/unpack200bin0 -> 120544 bytes
-rw-r--r--staging/darwin-x86/jre/lib/calendars.properties60
-rw-r--r--staging/darwin-x86/jre/lib/charsets.jarbin0 -> 3135397 bytes
-rw-r--r--staging/darwin-x86/jre/lib/classlist2208
-rw-r--r--staging/darwin-x86/jre/lib/cmm/CIEXYZ.pfbin0 -> 784 bytes
-rw-r--r--staging/darwin-x86/jre/lib/cmm/GRAY.pfbin0 -> 556 bytes
-rw-r--r--staging/darwin-x86/jre/lib/cmm/LINEAR_RGB.pfbin0 -> 488 bytes
-rw-r--r--staging/darwin-x86/jre/lib/cmm/PYCC.pfbin0 -> 234080 bytes
-rw-r--r--staging/darwin-x86/jre/lib/cmm/sRGB.pfbin0 -> 6876 bytes
-rw-r--r--staging/darwin-x86/jre/lib/content-types.properties280
-rw-r--r--staging/darwin-x86/jre/lib/currency.databin0 -> 4134 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/cldrdata.jarbin0 -> 3861234 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/dnsns.jarbin0 -> 8293 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/jaccess.jarbin0 -> 44523 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/localedata.jarbin0 -> 1179108 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/meta-index28
-rw-r--r--staging/darwin-x86/jre/lib/ext/nashorn.jarbin0 -> 2033212 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/sunec.jarbin0 -> 38269 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/sunjce_provider.jarbin0 -> 261563 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/sunpkcs11.jarbin0 -> 239026 bytes
-rw-r--r--staging/darwin-x86/jre/lib/ext/zipfs.jarbin0 -> 68943 bytes
-rw-r--r--staging/darwin-x86/jre/lib/flavormap.properties85
-rw-r--r--staging/darwin-x86/jre/lib/fontconfig.bfcbin0 -> 3058 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fontconfig.properties.src262
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSans-Bold.ttfbin0 -> 194488 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSans.ttfbin0 -> 190776 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSansMono.ttfbin0 -> 119380 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSansMonoDotted.ttfbin0 -> 117696 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSansMonoSlashed.ttfbin0 -> 117744 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSerif-Bold.ttfbin0 -> 185228 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttfbin0 -> 190304 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSerif-Italic.ttfbin0 -> 177560 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/DroidSerif-Regular.ttfbin0 -> 172916 bytes
-rw-r--r--staging/darwin-x86/jre/lib/fonts/LICENSE.txt13
-rw-r--r--staging/darwin-x86/jre/lib/fonts/font.conf22
-rw-r--r--staging/darwin-x86/jre/lib/fonts/fonts.dir170
-rw-r--r--staging/darwin-x86/jre/lib/hijrah-config-umalqura.properties369
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/cursors.properties40
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/invalid32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gifbin0 -> 158 bytes
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gifbin0 -> 162 bytes
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gifbin0 -> 141 bytes
-rw-r--r--staging/darwin-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/darwin-x86/jre/lib/jce.jarbin0 -> 96118 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/jli/libjli.dylibbin0 -> 73232 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/jspawnhelperbin0 -> 16528 bytes
-rw-r--r--staging/darwin-x86/jre/lib/jsse.jarbin0 -> 649039 bytes
-rw-r--r--staging/darwin-x86/jre/lib/jvm.cfg34
-rw-r--r--staging/darwin-x86/jre/lib/jvm.hprof.txt86
-rwxr-xr-xstaging/darwin-x86/jre/lib/libAppleScriptEngine.dylibbin0 -> 56904 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libattach.dylibbin0 -> 12092 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libawt.dylibbin0 -> 628948 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libawt_lwawt.dylibbin0 -> 978200 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libdt_socket.dylibbin0 -> 25624 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libfontmanager.dylibbin0 -> 1320704 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libfreetype.dylib.6bin0 -> 1027308 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libhprof.dylibbin0 -> 212920 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libinstrument.dylibbin0 -> 122568 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libj2gss.dylibbin0 -> 50240 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libj2pcsc.dylibbin0 -> 18116 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libj2pkcs11.dylibbin0 -> 89212 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjaas_unix.dylibbin0 -> 9292 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjava.dylibbin0 -> 280028 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjava_crw_demo.dylibbin0 -> 36424 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjawt.dylibbin0 -> 8948 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjdwp.dylibbin0 -> 303896 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjpeg.dylibbin0 -> 195112 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjsdt.dylibbin0 -> 14676 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjsig.dylibbin0 -> 15696 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libjsound.dylibbin0 -> 93656 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/liblcms.dylibbin0 -> 426392 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libmanagement.dylibbin0 -> 53168 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libmlib_image.dylibbin0 -> 806236 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libnet.dylibbin0 -> 115740 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libnio.dylibbin0 -> 86028 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libnpt.dylibbin0 -> 15764 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libosx.dylibbin0 -> 67336 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libosxapp.dylibbin0 -> 147304 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libosxkrb5.dylibbin0 -> 16436 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libosxui.dylibbin0 -> 50056 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libsaproc.dylibbin0 -> 67772 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libsplashscreen.dylibbin0 -> 417044 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libsunec.dylibbin0 -> 192592 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libunpack.dylibbin0 -> 116652 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libverify.dylibbin0 -> 45344 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/libzip.dylibbin0 -> 44648 bytes
-rw-r--r--staging/darwin-x86/jre/lib/logging.properties59
-rw-r--r--staging/darwin-x86/jre/lib/management-agent.jarbin0 -> 386 bytes
-rw-r--r--staging/darwin-x86/jre/lib/management/jmxremote.access79
-rw-r--r--staging/darwin-x86/jre/lib/management/jmxremote.password.template64
-rw-r--r--staging/darwin-x86/jre/lib/management/management.properties331
-rw-r--r--staging/darwin-x86/jre/lib/management/snmp.acl.template110
-rw-r--r--staging/darwin-x86/jre/lib/meta-index90
-rw-r--r--staging/darwin-x86/jre/lib/net.properties101
-rw-r--r--staging/darwin-x86/jre/lib/psfont.properties.ja119
-rw-r--r--staging/darwin-x86/jre/lib/psfontj2d.properties323
-rw-r--r--staging/darwin-x86/jre/lib/resources.jarbin0 -> 3502029 bytes
-rw-r--r--staging/darwin-x86/jre/lib/rt.jarbin0 -> 65770592 bytes
-rw-r--r--staging/darwin-x86/jre/lib/security/blacklisted.certs20
-rw-r--r--staging/darwin-x86/jre/lib/security/cacertsbin0 -> 112860 bytes
-rw-r--r--staging/darwin-x86/jre/lib/security/java.policy49
-rw-r--r--staging/darwin-x86/jre/lib/security/java.security912
-rw-r--r--staging/darwin-x86/jre/lib/security/policy/limited/US_export_policy.jarbin0 -> 627 bytes
-rw-r--r--staging/darwin-x86/jre/lib/security/policy/limited/local_policy.jarbin0 -> 1047 bytes
-rw-r--r--staging/darwin-x86/jre/lib/security/policy/unlimited/US_export_policy.jarbin0 -> 627 bytes
-rw-r--r--staging/darwin-x86/jre/lib/security/policy/unlimited/local_policy.jarbin0 -> 645 bytes
-rw-r--r--staging/darwin-x86/jre/lib/server/Xusage.txt24
-rwxr-xr-xstaging/darwin-x86/jre/lib/server/libjsig.dylibbin0 -> 15696 bytes
-rwxr-xr-xstaging/darwin-x86/jre/lib/server/libjvm.dylibbin0 -> 14968400 bytes
-rw-r--r--staging/darwin-x86/jre/lib/sound.properties39
-rw-r--r--staging/darwin-x86/jre/lib/tzdb.datbin0 -> 105476 bytes
-rw-r--r--staging/darwin-x86/lib/ct.symbin0 -> 17433655 bytes
-rw-r--r--staging/darwin-x86/lib/dt.jarbin0 -> 163088 bytes
-rw-r--r--staging/darwin-x86/lib/ir.idl778
-rw-r--r--staging/darwin-x86/lib/jconsole.jarbin0 -> 407742 bytes
-rw-r--r--staging/darwin-x86/lib/orb.idl47
-rw-r--r--staging/darwin-x86/lib/sa-jdi.jarbin0 -> 2285954 bytes
-rw-r--r--staging/darwin-x86/lib/tools.jarbin0 -> 18307636 bytes
-rw-r--r--staging/darwin-x86/release5
-rw-r--r--staging/darwin-x86/sample/README6
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java66
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml57
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java49
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java145
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java81
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java51
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java83
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java75
-rw-r--r--staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java71
-rw-r--r--staging/darwin-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java59
-rw-r--r--staging/darwin-x86/sample/annotations/Validator/src/SupplierValidator.java66
-rw-r--r--staging/darwin-x86/sample/annotations/Validator/src/Validate.java74
-rw-r--r--staging/darwin-x86/sample/annotations/Validator/src/Validator.java99
-rw-r--r--staging/darwin-x86/sample/annotations/index.html67
-rw-r--r--staging/darwin-x86/sample/dtrace/README.txt43
-rw-r--r--staging/darwin-x86/sample/dtrace/helpers/dtrace_helper.d87
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/README.txt87
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/class_loading_stat.d157
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/gc_time_stat.d203
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/hotspot_calls_tree.d117
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/method_compile_stat.d274
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat.d210
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat_filter.d204
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/method_invocation_tree.d142
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/monitors.d152
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot/object_allocation_stat.d162
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection.d136
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection_slow.d178
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot_jni/README.txt64
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_stat.d81
-rw-r--r--staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_tree.d91
-rw-r--r--staging/darwin-x86/sample/forkjoin/mergesort/MergeDemo.java296
-rw-r--r--staging/darwin-x86/sample/forkjoin/mergesort/MergeSort.java137
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/build.properties58
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/build.xml175
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpgbin0 -> 33121 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpgbin0 -> 30188 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpgbin0 -> 28942 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpgbin0 -> 30815 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpgbin0 -> 27845 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpgbin0 -> 74983 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpgbin0 -> 88344 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpgbin0 -> 70422 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/index.html2217
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/keystorebin0 -> 1364 bytes
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/logging.properties17
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/manifest.mf3
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml46
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml98
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml87
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/project.xml210
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java591
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java165
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java534
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java257
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java222
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java203
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java440
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java351
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java1160
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java317
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java392
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java323
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java178
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java205
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java304
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java393
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html69
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html45
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/access.properties51
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/management.properties273
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/password.properties55
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml53
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java313
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java325
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java365
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java114
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java118
-rw-r--r--staging/darwin-x86/sample/jmx/jmx-scandir/truststorebin0 -> 661 bytes
-rw-r--r--staging/darwin-x86/sample/lambda/BulkDataOperations/index.html49
-rw-r--r--staging/darwin-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java368
-rw-r--r--staging/darwin-x86/sample/lambda/BulkDataOperations/src/Grep.java185
-rw-r--r--staging/darwin-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java113
-rw-r--r--staging/darwin-x86/sample/lambda/BulkDataOperations/src/WC.java217
-rw-r--r--staging/darwin-x86/sample/lambda/DefaultMethods/ArrayIterator.java118
-rw-r--r--staging/darwin-x86/sample/lambda/DefaultMethods/DiamondInheritance.java145
-rw-r--r--staging/darwin-x86/sample/lambda/DefaultMethods/Inheritance.java142
-rw-r--r--staging/darwin-x86/sample/lambda/DefaultMethods/MixIn.java114
-rw-r--r--staging/darwin-x86/sample/lambda/DefaultMethods/Reflection.java136
-rw-r--r--staging/darwin-x86/sample/lambda/DefaultMethods/SimplestUsage.java91
-rw-r--r--staging/darwin-x86/sample/nbproject/project.xml50
-rw-r--r--staging/darwin-x86/sample/nio/chatserver/ChatServer.java188
-rw-r--r--staging/darwin-x86/sample/nio/chatserver/Client.java213
-rw-r--r--staging/darwin-x86/sample/nio/chatserver/ClientReader.java89
-rw-r--r--staging/darwin-x86/sample/nio/chatserver/DataReader.java47
-rw-r--r--staging/darwin-x86/sample/nio/chatserver/MessageReader.java86
-rw-r--r--staging/darwin-x86/sample/nio/chatserver/NameReader.java120
-rw-r--r--staging/darwin-x86/sample/nio/chatserver/README.txt62
-rw-r--r--staging/darwin-x86/sample/nio/file/AclEdit.java305
-rw-r--r--staging/darwin-x86/sample/nio/file/Chmod.java349
-rw-r--r--staging/darwin-x86/sample/nio/file/Copy.java213
-rw-r--r--staging/darwin-x86/sample/nio/file/DiskUsage.java81
-rw-r--r--staging/darwin-x86/sample/nio/file/FileType.java63
-rw-r--r--staging/darwin-x86/sample/nio/file/WatchDir.java185
-rw-r--r--staging/darwin-x86/sample/nio/file/Xdd.java121
-rw-r--r--staging/darwin-x86/sample/nio/multicast/MulticastAddress.java136
-rw-r--r--staging/darwin-x86/sample/nio/multicast/Reader.java151
-rw-r--r--staging/darwin-x86/sample/nio/multicast/Sender.java80
-rw-r--r--staging/darwin-x86/sample/nio/server/AcceptHandler.java85
-rw-r--r--staging/darwin-x86/sample/nio/server/Acceptor.java86
-rw-r--r--staging/darwin-x86/sample/nio/server/B1.java71
-rw-r--r--staging/darwin-x86/sample/nio/server/BN.java73
-rw-r--r--staging/darwin-x86/sample/nio/server/BP.java78
-rw-r--r--staging/darwin-x86/sample/nio/server/ChannelIO.java189
-rw-r--r--staging/darwin-x86/sample/nio/server/ChannelIOSecure.java650
-rw-r--r--staging/darwin-x86/sample/nio/server/Content.java56
-rw-r--r--staging/darwin-x86/sample/nio/server/Dispatcher.java57
-rw-r--r--staging/darwin-x86/sample/nio/server/Dispatcher1.java87
-rw-r--r--staging/darwin-x86/sample/nio/server/DispatcherN.java93
-rw-r--r--staging/darwin-x86/sample/nio/server/FileContent.java118
-rw-r--r--staging/darwin-x86/sample/nio/server/Handler.java54
-rw-r--r--staging/darwin-x86/sample/nio/server/MalformedRequestException.java58
-rw-r--r--staging/darwin-x86/sample/nio/server/N1.java64
-rw-r--r--staging/darwin-x86/sample/nio/server/N2.java60
-rw-r--r--staging/darwin-x86/sample/nio/server/README.txt279
-rw-r--r--staging/darwin-x86/sample/nio/server/Reply.java139
-rw-r--r--staging/darwin-x86/sample/nio/server/Request.java162
-rw-r--r--staging/darwin-x86/sample/nio/server/RequestHandler.java198
-rw-r--r--staging/darwin-x86/sample/nio/server/RequestServicer.java157
-rw-r--r--staging/darwin-x86/sample/nio/server/Sendable.java61
-rw-r--r--staging/darwin-x86/sample/nio/server/Server.java180
-rw-r--r--staging/darwin-x86/sample/nio/server/StringContent.java107
-rw-r--r--staging/darwin-x86/sample/nio/server/URLDumper.java80
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/README.txt122
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/build.properties22
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/build.xml98
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/nbproject/file-targets.xml46
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/nbproject/jdk.xml98
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml81
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/nbproject/project.xml173
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf2
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java82
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/resources/Main.js49
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/resources/conc.js329
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/resources/gui.js292
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/resources/mm.js339
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/resources/scriptpad.js662
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/README.txt52
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/browse.js70
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/insertfile.js68
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/linewrap.js51
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/mail.js68
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js73
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.bat35
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.js54
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.sh32
-rw-r--r--staging/darwin-x86/sample/scripting/scriptpad/src/scripts/textcolor.js51
-rw-r--r--staging/darwin-x86/sample/try-with-resources/index.html36
-rw-r--r--staging/darwin-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java137
-rw-r--r--staging/darwin-x86/sample/try-with-resources/src/Unzip.java83
-rw-r--r--staging/darwin-x86/sample/try-with-resources/src/ZipCat.java83
-rw-r--r--staging/darwin-x86/src.zipbin0 -> 23480661 bytes
-rw-r--r--staging/linux-x86/ASSEMBLY_EXCEPTION27
-rw-r--r--staging/linux-x86/LICENSE347
-rw-r--r--staging/linux-x86/MODULE_LICENSE_GPL0
-rw-r--r--staging/linux-x86/THIRD_PARTY_README3574
-rwxr-xr-xstaging/linux-x86/bin/appletviewerbin0 -> 8124 bytes
-rwxr-xr-xstaging/linux-x86/bin/extcheckbin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/idljbin0 -> 8020 bytes
-rwxr-xr-xstaging/linux-x86/bin/jarbin0 -> 7972 bytes
-rwxr-xr-xstaging/linux-x86/bin/jarsignerbin0 -> 8012 bytes
-rwxr-xr-xstaging/linux-x86/bin/javabin0 -> 7781 bytes
-rwxr-xr-xstaging/linux-x86/bin/java-rmi.cgi74
-rwxr-xr-xstaging/linux-x86/bin/javacbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/bin/javadocbin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/javahbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/bin/javapbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/bin/jcmdbin0 -> 7972 bytes
-rwxr-xr-xstaging/linux-x86/bin/jconsolebin0 -> 8068 bytes
-rwxr-xr-xstaging/linux-x86/bin/jdbbin0 -> 8036 bytes
-rwxr-xr-xstaging/linux-x86/bin/jdepsbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/bin/jhatbin0 -> 7972 bytes
-rwxr-xr-xstaging/linux-x86/bin/jinfobin0 -> 8148 bytes
-rwxr-xr-xstaging/linux-x86/bin/jjsbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/bin/jmapbin0 -> 8148 bytes
-rwxr-xr-xstaging/linux-x86/bin/jpsbin0 -> 7972 bytes
-rwxr-xr-xstaging/linux-x86/bin/jrunscriptbin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/jsadebugdbin0 -> 8044 bytes
-rwxr-xr-xstaging/linux-x86/bin/jstackbin0 -> 8188 bytes
-rwxr-xr-xstaging/linux-x86/bin/jstatbin0 -> 7972 bytes
-rwxr-xr-xstaging/linux-x86/bin/jstatdbin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/keytoolbin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/native2asciibin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/orbdbin0 -> 8220 bytes
-rwxr-xr-xstaging/linux-x86/bin/pack200bin0 -> 8012 bytes
-rwxr-xr-xstaging/linux-x86/bin/policytoolbin0 -> 8156 bytes
-rwxr-xr-xstaging/linux-x86/bin/rmicbin0 -> 7972 bytes
-rwxr-xr-xstaging/linux-x86/bin/rmidbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/bin/rmiregistrybin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/schemagenbin0 -> 8012 bytes
-rwxr-xr-xstaging/linux-x86/bin/serialverbin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/bin/servertoolbin0 -> 8012 bytes
-rwxr-xr-xstaging/linux-x86/bin/tnameservbin0 -> 8260 bytes
-rwxr-xr-xstaging/linux-x86/bin/unpack200bin0 -> 183759 bytes
-rwxr-xr-xstaging/linux-x86/bin/wsgenbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/bin/wsimportbin0 -> 8012 bytes
-rwxr-xr-xstaging/linux-x86/bin/xjcbin0 -> 8004 bytes
-rw-r--r--staging/linux-x86/include/classfile_constants.h560
-rw-r--r--staging/linux-x86/include/jawt.h299
-rw-r--r--staging/linux-x86/include/jdwpTransport.h259
-rw-r--r--staging/linux-x86/include/jni.h1960
-rw-r--r--staging/linux-x86/include/jvmti.h2534
-rw-r--r--staging/linux-x86/include/jvmticmlr.h115
-rw-r--r--staging/linux-x86/include/linux/jawt_md.h61
-rw-r--r--staging/linux-x86/include/linux/jni_md.h51
-rw-r--r--staging/linux-x86/jre/ASSEMBLY_EXCEPTION27
-rw-r--r--staging/linux-x86/jre/LICENSE347
-rw-r--r--staging/linux-x86/jre/THIRD_PARTY_README3574
-rwxr-xr-xstaging/linux-x86/jre/bin/javabin0 -> 7781 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/jjsbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/keytoolbin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/orbdbin0 -> 8220 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/pack200bin0 -> 8012 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/policytoolbin0 -> 8156 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/rmidbin0 -> 7988 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/rmiregistrybin0 -> 7996 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/servertoolbin0 -> 8012 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/tnameservbin0 -> 8260 bytes
-rwxr-xr-xstaging/linux-x86/jre/bin/unpack200bin0 -> 183759 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/jli/libjli.sobin0 -> 109071 bytes
-rw-r--r--staging/linux-x86/jre/lib/amd64/jvm.cfg35
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libattach.sobin0 -> 15979 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libawt.sobin0 -> 792498 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libawt_headless.sobin0 -> 38388 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libawt_xawt.sobin0 -> 467210 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libdt_socket.sobin0 -> 23384 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libfontmanager.sobin0 -> 1075350 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libhprof.sobin0 -> 187725 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libinstrument.sobin0 -> 52734 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libj2gss.sobin0 -> 51470 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libj2pcsc.sobin0 -> 16427 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libj2pkcs11.sobin0 -> 82694 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjaas_unix.sobin0 -> 8293 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjava.sobin0 -> 229041 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjava_crw_demo.sobin0 -> 26195 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjawt.sobin0 -> 7370 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjdwp.sobin0 -> 298834 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjpeg.sobin0 -> 238537 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjsdt.sobin0 -> 12394 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjsig.sobin0 -> 11124 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjsound.sobin0 -> 7605 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libjsoundalsa.sobin0 -> 80406 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/liblcms.sobin0 -> 465507 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libmanagement.sobin0 -> 47575 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libmlib_image.sobin0 -> 893229 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libnet.sobin0 -> 122597 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libnio.sobin0 -> 93595 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libnpt.sobin0 -> 14740 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libsaproc.sobin0 -> 57302 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libsctp.sobin0 -> 29331 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libsplashscreen.sobin0 -> 456265 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libsunec.sobin0 -> 260700 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libunpack.sobin0 -> 174932 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libverify.sobin0 -> 66864 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/libzip.sobin0 -> 123624 bytes
-rw-r--r--staging/linux-x86/jre/lib/amd64/server/Xusage.txt24
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/server/libjsig.so0
-rwxr-xr-xstaging/linux-x86/jre/lib/amd64/server/libjvm.sobin0 -> 16374643 bytes
-rw-r--r--staging/linux-x86/jre/lib/calendars.properties60
-rw-r--r--staging/linux-x86/jre/lib/charsets.jarbin0 -> 3135397 bytes
-rw-r--r--staging/linux-x86/jre/lib/classlist2559
-rw-r--r--staging/linux-x86/jre/lib/cmm/CIEXYZ.pfbin0 -> 784 bytes
-rw-r--r--staging/linux-x86/jre/lib/cmm/GRAY.pfbin0 -> 556 bytes
-rw-r--r--staging/linux-x86/jre/lib/cmm/LINEAR_RGB.pfbin0 -> 488 bytes
-rw-r--r--staging/linux-x86/jre/lib/cmm/PYCC.pfbin0 -> 234080 bytes
-rw-r--r--staging/linux-x86/jre/lib/cmm/sRGB.pfbin0 -> 6876 bytes
-rw-r--r--staging/linux-x86/jre/lib/content-types.properties280
-rw-r--r--staging/linux-x86/jre/lib/currency.databin0 -> 4134 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/cldrdata.jarbin0 -> 3861234 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/dnsns.jarbin0 -> 8293 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/jaccess.jarbin0 -> 44523 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/localedata.jarbin0 -> 1179108 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/meta-index28
-rw-r--r--staging/linux-x86/jre/lib/ext/nashorn.jarbin0 -> 2033212 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/sunec.jarbin0 -> 38269 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/sunjce_provider.jarbin0 -> 261563 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/sunpkcs11.jarbin0 -> 239026 bytes
-rw-r--r--staging/linux-x86/jre/lib/ext/zipfs.jarbin0 -> 68943 bytes
-rw-r--r--staging/linux-x86/jre/lib/flavormap.properties78
-rw-r--r--staging/linux-x86/jre/lib/fontconfig.bfcbin0 -> 1630 bytes
-rw-r--r--staging/linux-x86/jre/lib/fontconfig.properties.src42
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSans-Bold.ttfbin0 -> 194488 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSans.ttfbin0 -> 190776 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSansMono.ttfbin0 -> 119380 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSansMonoDotted.ttfbin0 -> 117696 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSansMonoSlashed.ttfbin0 -> 117744 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSerif-Bold.ttfbin0 -> 185228 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttfbin0 -> 190304 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSerif-Italic.ttfbin0 -> 177560 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/DroidSerif-Regular.ttfbin0 -> 172916 bytes
-rw-r--r--staging/linux-x86/jre/lib/fonts/LICENSE.txt13
-rw-r--r--staging/linux-x86/jre/lib/fonts/font.conf22
-rw-r--r--staging/linux-x86/jre/lib/fonts/fonts.dir170
-rw-r--r--staging/linux-x86/jre/lib/hijrah-config-umalqura.properties369
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/cursors.properties40
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/invalid32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gifbin0 -> 158 bytes
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gifbin0 -> 162 bytes
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gifbin0 -> 141 bytes
-rw-r--r--staging/linux-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gifbin0 -> 153 bytes
-rw-r--r--staging/linux-x86/jre/lib/jce.jarbin0 -> 96118 bytes
-rwxr-xr-xstaging/linux-x86/jre/lib/jexecbin0 -> 18942 bytes
-rw-r--r--staging/linux-x86/jre/lib/jsse.jarbin0 -> 649039 bytes
-rw-r--r--staging/linux-x86/jre/lib/jvm.hprof.txt86
-rw-r--r--staging/linux-x86/jre/lib/logging.properties59
-rw-r--r--staging/linux-x86/jre/lib/management-agent.jarbin0 -> 386 bytes
-rw-r--r--staging/linux-x86/jre/lib/management/jmxremote.access79
-rw-r--r--staging/linux-x86/jre/lib/management/jmxremote.password.template64
-rw-r--r--staging/linux-x86/jre/lib/management/management.properties331
-rw-r--r--staging/linux-x86/jre/lib/management/snmp.acl.template110
-rw-r--r--staging/linux-x86/jre/lib/meta-index85
-rw-r--r--staging/linux-x86/jre/lib/net.properties101
-rw-r--r--staging/linux-x86/jre/lib/psfont.properties.ja119
-rw-r--r--staging/linux-x86/jre/lib/psfontj2d.properties323
-rw-r--r--staging/linux-x86/jre/lib/resources.jarbin0 -> 3502147 bytes
-rw-r--r--staging/linux-x86/jre/lib/rt.jarbin0 -> 65159225 bytes
-rw-r--r--staging/linux-x86/jre/lib/security/blacklisted.certs20
-rw-r--r--staging/linux-x86/jre/lib/security/cacertsbin0 -> 112860 bytes
-rw-r--r--staging/linux-x86/jre/lib/security/java.policy49
-rw-r--r--staging/linux-x86/jre/lib/security/java.security910
-rw-r--r--staging/linux-x86/jre/lib/security/policy/limited/US_export_policy.jarbin0 -> 627 bytes
-rw-r--r--staging/linux-x86/jre/lib/security/policy/limited/local_policy.jarbin0 -> 1047 bytes
-rw-r--r--staging/linux-x86/jre/lib/security/policy/unlimited/US_export_policy.jarbin0 -> 627 bytes
-rw-r--r--staging/linux-x86/jre/lib/security/policy/unlimited/local_policy.jarbin0 -> 645 bytes
-rw-r--r--staging/linux-x86/jre/lib/sound.properties39
-rw-r--r--staging/linux-x86/jre/lib/tzdb.datbin0 -> 105476 bytes
-rwxr-xr-xstaging/linux-x86/lib/amd64/jli/libjli.sobin0 -> 389973 bytes
-rwxr-xr-xstaging/linux-x86/lib/amd64/libjawt.sobin0 -> 27852 bytes
-rw-r--r--staging/linux-x86/lib/ct.symbin0 -> 17808691 bytes
-rw-r--r--staging/linux-x86/lib/dt.jarbin0 -> 163088 bytes
-rw-r--r--staging/linux-x86/lib/ir.idl778
-rw-r--r--staging/linux-x86/lib/jconsole.jarbin0 -> 407742 bytes
-rwxr-xr-xstaging/linux-x86/lib/jexecbin0 -> 18942 bytes
-rw-r--r--staging/linux-x86/lib/orb.idl47
-rw-r--r--staging/linux-x86/lib/sa-jdi.jarbin0 -> 2285954 bytes
-rw-r--r--staging/linux-x86/lib/tools.jarbin0 -> 18308217 bytes
-rw-r--r--staging/linux-x86/release5
-rw-r--r--staging/linux-x86/sample/README6
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java66
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml57
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java49
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java145
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java81
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java51
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java83
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java75
-rw-r--r--staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java71
-rw-r--r--staging/linux-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java59
-rw-r--r--staging/linux-x86/sample/annotations/Validator/src/SupplierValidator.java66
-rw-r--r--staging/linux-x86/sample/annotations/Validator/src/Validate.java74
-rw-r--r--staging/linux-x86/sample/annotations/Validator/src/Validator.java99
-rw-r--r--staging/linux-x86/sample/annotations/index.html67
-rw-r--r--staging/linux-x86/sample/forkjoin/mergesort/MergeDemo.java296
-rw-r--r--staging/linux-x86/sample/forkjoin/mergesort/MergeSort.java137
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/build.properties58
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/build.xml175
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpgbin0 -> 33121 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpgbin0 -> 30188 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpgbin0 -> 28942 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpgbin0 -> 30815 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpgbin0 -> 27845 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpgbin0 -> 74983 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpgbin0 -> 88344 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpgbin0 -> 70422 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/index.html2217
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/keystorebin0 -> 1364 bytes
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/logging.properties17
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/manifest.mf3
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml46
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml98
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml87
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/nbproject/project.xml210
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java591
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java165
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java534
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java257
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java222
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java203
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java440
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java351
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java1160
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java317
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java392
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java323
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java178
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java205
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java304
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java393
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html69
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html45
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/etc/access.properties51
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/etc/management.properties273
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/etc/password.properties55
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml53
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java313
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java325
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java365
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java114
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java118
-rw-r--r--staging/linux-x86/sample/jmx/jmx-scandir/truststorebin0 -> 661 bytes
-rw-r--r--staging/linux-x86/sample/lambda/BulkDataOperations/index.html49
-rw-r--r--staging/linux-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java368
-rw-r--r--staging/linux-x86/sample/lambda/BulkDataOperations/src/Grep.java185
-rw-r--r--staging/linux-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java113
-rw-r--r--staging/linux-x86/sample/lambda/BulkDataOperations/src/WC.java217
-rw-r--r--staging/linux-x86/sample/lambda/DefaultMethods/ArrayIterator.java118
-rw-r--r--staging/linux-x86/sample/lambda/DefaultMethods/DiamondInheritance.java145
-rw-r--r--staging/linux-x86/sample/lambda/DefaultMethods/Inheritance.java142
-rw-r--r--staging/linux-x86/sample/lambda/DefaultMethods/MixIn.java114
-rw-r--r--staging/linux-x86/sample/lambda/DefaultMethods/Reflection.java136
-rw-r--r--staging/linux-x86/sample/lambda/DefaultMethods/SimplestUsage.java91
-rw-r--r--staging/linux-x86/sample/nbproject/project.xml50
-rw-r--r--staging/linux-x86/sample/nio/chatserver/ChatServer.java188
-rw-r--r--staging/linux-x86/sample/nio/chatserver/Client.java213
-rw-r--r--staging/linux-x86/sample/nio/chatserver/ClientReader.java89
-rw-r--r--staging/linux-x86/sample/nio/chatserver/DataReader.java47
-rw-r--r--staging/linux-x86/sample/nio/chatserver/MessageReader.java86
-rw-r--r--staging/linux-x86/sample/nio/chatserver/NameReader.java120
-rw-r--r--staging/linux-x86/sample/nio/chatserver/README.txt62
-rw-r--r--staging/linux-x86/sample/nio/file/AclEdit.java305
-rw-r--r--staging/linux-x86/sample/nio/file/Chmod.java349
-rw-r--r--staging/linux-x86/sample/nio/file/Copy.java213
-rw-r--r--staging/linux-x86/sample/nio/file/DiskUsage.java81
-rw-r--r--staging/linux-x86/sample/nio/file/FileType.java63
-rw-r--r--staging/linux-x86/sample/nio/file/WatchDir.java185
-rw-r--r--staging/linux-x86/sample/nio/file/Xdd.java121
-rw-r--r--staging/linux-x86/sample/nio/multicast/MulticastAddress.java136
-rw-r--r--staging/linux-x86/sample/nio/multicast/Reader.java151
-rw-r--r--staging/linux-x86/sample/nio/multicast/Sender.java80
-rw-r--r--staging/linux-x86/sample/nio/server/AcceptHandler.java85
-rw-r--r--staging/linux-x86/sample/nio/server/Acceptor.java86
-rw-r--r--staging/linux-x86/sample/nio/server/B1.java71
-rw-r--r--staging/linux-x86/sample/nio/server/BN.java73
-rw-r--r--staging/linux-x86/sample/nio/server/BP.java78
-rw-r--r--staging/linux-x86/sample/nio/server/ChannelIO.java189
-rw-r--r--staging/linux-x86/sample/nio/server/ChannelIOSecure.java650
-rw-r--r--staging/linux-x86/sample/nio/server/Content.java56
-rw-r--r--staging/linux-x86/sample/nio/server/Dispatcher.java57
-rw-r--r--staging/linux-x86/sample/nio/server/Dispatcher1.java87
-rw-r--r--staging/linux-x86/sample/nio/server/DispatcherN.java93
-rw-r--r--staging/linux-x86/sample/nio/server/FileContent.java118
-rw-r--r--staging/linux-x86/sample/nio/server/Handler.java54
-rw-r--r--staging/linux-x86/sample/nio/server/MalformedRequestException.java58
-rw-r--r--staging/linux-x86/sample/nio/server/N1.java64
-rw-r--r--staging/linux-x86/sample/nio/server/N2.java60
-rw-r--r--staging/linux-x86/sample/nio/server/README.txt279
-rw-r--r--staging/linux-x86/sample/nio/server/Reply.java139
-rw-r--r--staging/linux-x86/sample/nio/server/Request.java162
-rw-r--r--staging/linux-x86/sample/nio/server/RequestHandler.java198
-rw-r--r--staging/linux-x86/sample/nio/server/RequestServicer.java157
-rw-r--r--staging/linux-x86/sample/nio/server/Sendable.java61
-rw-r--r--staging/linux-x86/sample/nio/server/Server.java180
-rw-r--r--staging/linux-x86/sample/nio/server/StringContent.java107
-rw-r--r--staging/linux-x86/sample/nio/server/URLDumper.java80
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/README.txt122
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/build.properties22
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/build.xml98
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/nbproject/file-targets.xml46
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/nbproject/jdk.xml98
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml81
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/nbproject/project.xml173
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf2
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java82
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/resources/Main.js49
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/resources/conc.js329
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/resources/gui.js292
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/resources/mm.js339
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/resources/scriptpad.js662
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/README.txt52
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/browse.js70
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/insertfile.js68
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/linewrap.js51
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/mail.js68
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js73
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.bat35
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.js54
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.sh32
-rw-r--r--staging/linux-x86/sample/scripting/scriptpad/src/scripts/textcolor.js51
-rw-r--r--staging/linux-x86/sample/try-with-resources/index.html36
-rw-r--r--staging/linux-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java137
-rw-r--r--staging/linux-x86/sample/try-with-resources/src/Unzip.java83
-rw-r--r--staging/linux-x86/sample/try-with-resources/src/ZipCat.java83
-rw-r--r--staging/linux-x86/src.zipbin0 -> 23480661 bytes
-rw-r--r--staging/manifest.xml30
683 files changed, 89613 insertions, 0 deletions
diff --git a/staging/darwin-x86/ASSEMBLY_EXCEPTION b/staging/darwin-x86/ASSEMBLY_EXCEPTION
new file mode 100644
index 0000000..065b8d9
--- /dev/null
+++ b/staging/darwin-x86/ASSEMBLY_EXCEPTION
@@ -0,0 +1,27 @@
+
+OPENJDK ASSEMBLY EXCEPTION
+
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+only ("GPL2"), with the following clarification and special exception.
+
+ Linking this OpenJDK Code statically or dynamically with other code
+ is making a combined work based on this library. Thus, the terms
+ and conditions of GPL2 cover the whole combination.
+
+ As a special exception, Oracle gives you permission to link this
+ OpenJDK Code with certain code licensed by Oracle as indicated at
+ http://openjdk.java.net/legal/exception-modules-2007-05-08.html
+ ("Designated Exception Modules") to produce an executable,
+ regardless of the license terms of the Designated Exception Modules,
+ and to copy and distribute the resulting executable under GPL2,
+ provided that the Designated Exception Modules continue to be
+ governed by the licenses under which they were offered by Oracle.
+
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception). If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
diff --git a/staging/darwin-x86/LICENSE b/staging/darwin-x86/LICENSE
new file mode 100644
index 0000000..8b400c7
--- /dev/null
+++ b/staging/darwin-x86/LICENSE
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have. You must
+make sure that they, too, receive or can get the source code. And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+ a) You must cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in whole or
+ in part contains or is derived from the Program or any part thereof, to be
+ licensed as a whole at no charge to all third parties under the terms of
+ this License.
+
+ c) If the modified program normally reads commands interactively when run,
+ you must cause it, when started running for such interactive use in the
+ most ordinary way, to print or display an announcement including an
+ appropriate copyright notice and a notice that there is no warranty (or
+ else, saying that you provide a warranty) and that users may redistribute
+ the program under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the Program is
+ not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable source
+ code, which must be distributed under the terms of Sections 1 and 2 above
+ on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three years, to
+ give any third party, for a charge no more than your cost of physically
+ performing source distribution, a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed only
+ for noncommercial distribution and only if you received the program in
+ object code or executable form with such an offer, in accord with
+ Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not
+accept this License. Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein. You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+ One line to give the program's name and a brief idea of what it does.
+
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program 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 for
+ more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+ with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
+ software, and you are welcome to redistribute it under certain conditions;
+ type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary. Here
+is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ 'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ signature of Ty Coon, 1 April 1989
+
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+ Linking this library statically or dynamically with other modules is making
+ a combined work based on this library. Thus, the terms and conditions of
+ the GNU General Public License cover the whole combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent modules,
+ and to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent module,
+ the terms and conditions of the license of that module. An independent
+ module is a module which is not derived from or based on this library. If
+ you modify this library, you may extend this exception to your version of
+ the library, but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version.
diff --git a/staging/darwin-x86/MODULE_LICENSE_GPL b/staging/darwin-x86/MODULE_LICENSE_GPL
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/staging/darwin-x86/MODULE_LICENSE_GPL
diff --git a/staging/darwin-x86/THIRD_PARTY_README b/staging/darwin-x86/THIRD_PARTY_README
new file mode 100644
index 0000000..2b20da2
--- /dev/null
+++ b/staging/darwin-x86/THIRD_PARTY_README
@@ -0,0 +1,3574 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to ASM Bytecode Manipulation
+Framework v5.0.3, which may be included with JRE 8, and JDK 8, and
+OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2011 France Télécom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+3. 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.
+
+THIS 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.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to BSDiff v4.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 2003-2005 Colin Percival
+All rights reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted providing that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CodeViewer 1.0, which may be
+included with JDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1999 by CoolServlets.com.
+
+Any errors or suggested improvements to this class can be reported as
+instructed on CoolServlets.com. We hope you enjoy this program... your
+comments will encourage further development! This software is distributed
+under the terms of the BSD License. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+Neither name of CoolServlets.com nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY COOLSERVLETS.COM 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 AUTHOR 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."
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Cryptix AES 3.2.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Cryptix General License
+
+Copyright (c) 1995-2005 The Cryptix Foundation Limited.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ 1. Redistributions of source code must retain the copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED 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 CRYPTIX FOUNDATION LIMITED 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CUP Parser Generator for
+Java 0.10k, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both the
+copyright notice and this permission notice and warranty disclaimer appear in
+supporting documentation, and that the names of the authors or their
+employers not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+The authors and their employers disclaim all warranties with regard to
+this software, including all implied warranties of merchantability and fitness.
+In no event shall the authors or their employers be liable for any special,
+indirect or consequential damages or any damages whatsoever resulting from
+loss of use, data or profits, whether in an action of contract, negligence or
+other tortious action, arising out of or in connection with the use or
+performance of this software.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Document Object Model (DOM) Level 2
+& 3, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+W3C SOFTWARE NOTICE AND LICENSE
+
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee)
+agree that you have read, understood, and will comply with the following terms
+and conditions.
+
+Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without fee
+or royalty is hereby granted, provided that you include the following on ALL
+copies of the software and documentation or portions thereof, including
+modifications:
+
+ 1.The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+
+ 2.Any pre-existing intellectual property disclaimers, notices, or terms and
+ conditions. If none exist, the W3C Software Short Notice should be included
+ (hypertext is preferred, text is permitted) within the body of any
+ redistributed or derivative code.
+
+ 3.Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
+THIRD PARTY PATENTS,COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION. The name and trademarks of copyright holders may NOT be used
+in advertising or publicity pertaining to the software without specific,
+written prior permission. Title to copyright in this software and any
+associated documentation will at all times remain with copyright holders.
+
+____________________________________
+
+This formulation of W3C's notice and license became active on December 31
+2002. This version removes the copyright ownership notice such that this
+license can be used with materials other than those owned by the W3C, reflects
+that ERCIM is now a host of the W3C, includes references to this specific
+dated version of the license, and removes the ambiguous grant of "use".
+Otherwise, this version is the same as the previous version and is written so
+as to preserve the Free Software Foundation's assessment of GPL compatibility
+and OSI's certification under the Open Source Definition. Please see our
+Copyright FAQ for common questions about using materials from our site,
+including specific terms and conditions for packages like libwww, Amaya, and
+Jigsaw. Other questions about this notice can be directed to
+site-policy@w3.org.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Dynalink v0.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2009-2013, Attila Szegedi
+
+All rights reserved.Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following conditions are
+met:* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer. * 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. * Neither the name of Attila
+Szegedi nor the names of its contributors may be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+THIS 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 HOLDER 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 THEPOSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Elliptic Curve Cryptography, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+You are receiving a copy of the Elliptic Curve Cryptography library in source
+form with the JDK 8 and OpenJDK 8 source distributions, and as object code in
+the JRE 8 & JDK 8 runtimes.
+
+In the case of the JRE 8 & JDK 8 runtimes, the terms of the Oracle license do
+NOT apply to the Elliptic Curve Cryptography library; it is licensed under the
+following license, separately from Oracle's JDK & JRE. If you do not wish to
+install the Elliptic Curve Cryptography library, you may delete the library
+named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows
+systems) from the JRE bin directory reserved for native libraries.
+
+
+--- begin of LICENSE ---
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ECMAScript Language
+Specification ECMA-262 Edition 5.1 which may be included with
+JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright notice
+Copyright © 2011 Ecma International
+Ecma International
+Rue du Rhone 114
+CH-1204 Geneva
+Tel: +41 22 849 6000
+Fax: +41 22 849 6001
+Web: http://www.ecma-international.org
+
+This document and possible translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it or assist
+in its implementation may be prepared, copied, published, and distributed, in
+whole or in part, without restriction of any kind, provided that the above
+copyright notice and this section are included on all such copies and derivative
+works. However, this document itself may not be modified in any way, including
+by removing the copyright notice or references to Ecma International, except as
+needed for the purpose of developing any document or deliverable produced by
+Ecma International (in which case the rules applied to copyrights must be
+followed) or as required to translate it into languages other than English. The
+limited permissions granted above are perpetual and will not be revoked by Ecma
+International or its successors or assigns. This document and the information
+contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL
+DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
+WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP
+RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE." Software License
+
+All Software contained in this document ("Software)" is protected by copyright
+and is being made available under the "BSD License", included below. This
+Software may be subject to third party rights (rights from parties other than
+Ecma International), including patent rights, and no licenses under such third
+party rights are granted under this license even if the third party concerned is
+a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS
+AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR
+INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO
+IMPLEMENT ECMA INTERNATIONAL STANDARDS*. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. 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.
+
+3. Neither the name of the authors nor Ecma International may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "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 ECMA INTERNATIONAL 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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Dynalink library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Copyright (c) 2009-2013, Attila Szegedi
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* 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.
+* Neither the name of the copyright holder nor the names of
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS 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 COPYRIGHT HOLDER
+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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Joni library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to FontConfig 2.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 source distributions on
+Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright © 2001,2003 Keith Packard
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and that
+the name of Keith Packard not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior permission.
+Keith Packard makes no representations about the suitability of this software
+for any purpose. It is provided "as is" without express or implied warranty.
+
+KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL KEITH
+PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IAIK PKCS#11 Wrapper,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+IAIK PKCS#11 Wrapper License
+
+Copyright (c) 2002 Graz University of Technology. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by IAIK of Graz University of
+ Technology."
+
+ Alternately, this acknowledgment may appear in the software itself, if and
+ wherever such third-party acknowledgments normally appear.
+
+4. The names "Graz University of Technology" and "IAIK of Graz University of
+ Technology" must not be used to endorse or promote products derived from this
+ software without prior written permission.
+
+5. Products derived from this software may not be called "IAIK PKCS Wrapper",
+ nor may "IAIK" appear in their name, without prior written permission of
+ Graz University of Technology.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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
+LICENSOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ICU4C 4.0.1 and ICU4J 4.4, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1995-2010 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+provided that the above copyright notice(s) and this permission notice appear
+in all copies of the Software and that both the above copyright notice(s) and
+this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+All trademarks and registered trademarks mentioned herein are the property of
+their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IJG JPEG 6b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Joni v1.1.9, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to JOpt-Simple v3.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2004-2009 Paul R. Holser, Jr.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality, which
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ (C) Copyright IBM Corp. 1999 All Rights Reserved.
+ Copyright 1997 The Open Group Research Institute. All rights reserved.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality from
+FundsXpress, INC., which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (C) 1998 by the FundsXpress, INC.
+
+ All rights reserved.
+
+ Export of this software from the United States of America may require
+ a specific license from the United States Government. It is the
+ responsibility of any person or organization contemplating export to
+ obtain such a license before exporting.
+
+ WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ distribute this software and its documentation for any purpose and
+ without fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation, and that
+ the name of FundsXpress. not be used in advertising or publicity pertaining
+ to distribution of the software without specific, written prior
+ permission. FundsXpress makes no representations about the suitability of
+ this software for any purpose. It is provided "as is" without express
+ or implied warranty.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kronos OpenGL headers, which may be
+included with JDK 8 and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2007 The Khronos Group Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and/or associated documentation files (the "Materials"), to
+ deal in the Materials without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Materials, and to permit persons to whom the Materials are
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Materials.
+
+ THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE
+ MATERIALS.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions Copyright Eastman Kodak Company 1992
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to libpng 1.6.16, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors
+
+ Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
+Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6
+with the following individuals added to the list of Contributing Authors
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Gilles Vollant
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-0.96,
+with the following individuals added to the list of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996, 1997 Andreas Dilger
+Distributed according to the same disclaimer and license as libpng-0.88,
+with the following individuals added to the list of Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+1. The origin of this source code must not be misrepresented.
+
+2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+
+A "png_get_copyright" function is available, for convenient use in "about"
+boxes and the like:
+
+ printf("%s",png_get_copyright(NULL));
+
+Also, the PNG logo (in PNG format, of course) is supplied in the
+files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
+certification mark of the Open Source Initiative.
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+December 22, 2014
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Little CMS 2.7, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Little CMS
+Copyright (c) 1998-2015 Marti Maria Saguer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Lucida is a registered trademark or trademark of Bigelow & Holmes in the
+U.S. and other countries.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mesa 3D Graphics Library v4.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Mesa 3-D graphics library
+ Version: 4.1
+
+ Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mozilla Network Security
+Services (NSS), which is supplied with the JDK test suite in the OpenJDK
+source code repository. It is licensed under Mozilla Public License (MPL),
+version 2.0.
+
+The NSS libraries are supplied in executable form, built from unmodified
+NSS source code labeled with the "NSS_3_16_RTM" HG tag.
+
+The NSS source code is available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/src
+
+The NSS libraries are available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/lib
+
+--- begin of LICENSE ---
+
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1999-2004 David Corcoran <corcoran@linuxnet.com>
+Copyright (c) 1999-2004 Ludovic Rousseau <ludovic.rousseau (at) free.fr>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. 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.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by:
+ David Corcoran <corcoran@linuxnet.com>
+ http://www.linuxnet.com (MUSCLE)
+4. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+Changes to this license can be made only by the copyright author with
+explicit written consent.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PorterStemmer v4, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+See: http://tartarus.org/~martin/PorterStemmer
+
+The software is completely free for any purpose, unless notes at the head of
+the program text indicates otherwise (which is rare). In any case, the notes
+about licensing are never more restrictive than the BSD License.
+
+In every case where the software is not written by me (Martin Porter), this
+licensing arrangement has been endorsed by the contributor, and it is
+therefore unnecessary to ask the contributor again to confirm it.
+
+I have not asked any contributors (or their employers, if they have them) for
+proofs that they have the right to distribute their software in this way.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Relax NG Object/Parser v.20050510,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) Kohsuke Kawaguchi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions: The above copyright
+notice and this permission notice shall be included in all copies or
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to RelaxNGCC v1.12, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2003 Daisuke Okajima and Kohsuke Kawaguchi.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by Daisuke Okajima
+ and Kohsuke Kawaguchi (http://relaxngcc.sf.net/)."
+
+Alternately, this acknowledgment may appear in the software itself, if and
+wherever such third-party acknowledgments normally appear.
+
+4. The names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission. For
+ written permission, please contact the copyright holders.
+
+5. Products derived from this software may not be called "RELAXNGCC", nor may
+ "RELAXNGCC" appear in their name, without prior written permission of the
+ copyright holders.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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 APACHE
+SOFTWARE FOUNDATION OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SAX 2.0.1, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ SAX is free!
+
+ In fact, it's not possible to own a license to SAX, since it's been placed in
+ the public domain.
+
+ No Warranty
+
+ Because SAX is released to the public domain, there is no warranty for the
+ design or for the software implementation, to the extent permitted by
+ applicable law. Except when otherwise stated in writing the copyright holders
+ and/or other parties provide SAX "as is" without warranty of any kind, either
+ expressed or implied, including, but not limited to, the implied warranties
+ of merchantability and fitness for a particular purpose. The entire risk as
+ to the quality and performance of SAX is with you. Should SAX prove
+ defective, you assume the cost of all necessary servicing, repair or
+ correction.
+
+ In no event unless required by applicable law or agreed to in writing will
+ any copyright holder, or any other party who may modify and/or redistribute
+ SAX, be liable to you for damages, including any general, special, incidental
+ or consequential damages arising out of the use or inability to use SAX
+ (including but not limited to loss of data or data being rendered inaccurate
+ or losses sustained by you or third parties or a failure of the SAX to
+ operate with any other programs), even if such holder or other party has been
+ advised of the possibility of such damages.
+
+ Copyright Disclaimers
+
+ This page includes statements to that effect by David Megginson, who would
+ have been able to claim copyright for the original work. SAX 1.0
+
+ Version 1.0 of the Simple API for XML (SAX), created collectively by the
+ membership of the XML-DEV mailing list, is hereby released into the public
+ domain.
+
+ No one owns SAX: you may use it freely in both commercial and non-commercial
+ applications, bundle it with your software distribution, include it on a
+ CD-ROM, list the source code in a book, mirror the documentation at your own
+ web site, or use it in any other way you see fit.
+
+ David Megginson, sax@megginson.com
+ 1998-05-11
+
+ SAX 2.0
+
+ I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and
+ release all of the SAX 2.0 source code, compiled code, and documentation
+ contained in this distribution into the Public Domain. SAX comes with NO
+ WARRANTY or guarantee of fitness for any purpose.
+
+ David Megginson, david@megginson.com
+ 2000-05-05
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SoftFloat version 2b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux/ARM.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+SoftFloat was written by me, John R. Hauser. This work was made possible in
+part by the International Computer Science Institute, located at Suite 600,
+1947 Center Street, Berkeley, California 94704. Funding was partially
+provided by the National Science Foundation under grant MIP-9311980. The
+original version of this code was written as part of a project to build
+a fixed-point vector processor in collaboration with the University of
+California at Berkeley, overseen by Profs. Nelson Morgan and John Wawrzynek.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL
+LOSSES, COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO
+FURTHERMORE EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER
+SCIENCE INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES,
+COSTS, OR OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE
+SOFTWARE.
+
+Derivative works are acceptable, even for commercial purposes, provided
+that the minimal documentation requirements stated in the source code are
+satisfied.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Sparkle 1.5,
+which may be included with JRE 8 on Mac OS X.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2012 Sparkle.org and Andy Matuschak
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions licensed from Taligent, Inc.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Thai Dictionary, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (C) 1982 The Royal Institute, Thai Royal Government.
+
+Copyright (C) 1998 National Electronics and Computer Technology Center,
+National Science and Technology Development Agency,
+Ministry of Science Technology and Environment,
+Thai Royal Government.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Unicode 6.2.0 & CLDR 21.0.1
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Unicode Terms of Use
+
+For the general privacy policy governing access to this site, see the Unicode
+Privacy Policy. For trademark usage, see the Unicode® Consortium Name and
+Trademark Usage Policy.
+
+A. Unicode Copyright.
+ 1. Copyright © 1991-2013 Unicode, Inc. All rights reserved.
+
+ 2. Certain documents and files on this website contain a legend indicating
+ that "Modification is permitted." Any person is hereby authorized,
+ without fee, to modify such documents and files to create derivative
+ works conforming to the Unicode® Standard, subject to Terms and
+ Conditions herein.
+
+ 3. Any person is hereby authorized, without fee, to view, use, reproduce,
+ and distribute all documents and files solely for informational
+ purposes in the creation of products supporting the Unicode Standard,
+ subject to the Terms and Conditions herein.
+
+ 4. Further specifications of rights and restrictions pertaining to the use
+ of the particular set of data files known as the "Unicode Character
+ Database" can be found in Exhibit 1.
+
+ 5. Each version of the Unicode Standard has further specifications of
+ rights and restrictions of use. For the book editions (Unicode 5.0 and
+ earlier), these are found on the back of the title page. The online
+ code charts carry specific restrictions. All other files, including
+ online documentation of the core specification for Unicode 6.0 and
+ later, are covered under these general Terms of Use.
+
+ 6. No license is granted to "mirror" the Unicode website where a fee is
+ charged for access to the "mirror" site.
+
+ 7. Modification is not permitted with respect to this document. All copies
+ of this document must be verbatim.
+
+B. Restricted Rights Legend. Any technical data or software which is licensed
+ to the United States of America, its agencies and/or instrumentalities
+ under this Agreement is commercial technical data or commercial computer
+ software developed exclusively at private expense as defined in FAR 2.101,
+ or DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
+ duplication, or disclosure by the Government is subject to restrictions as
+ set forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov
+ 1995) and this Agreement. For Software, in accordance with FAR 12-212 or
+ DFARS 227-7202, as applicable, use, duplication or disclosure by the
+ Government is subject to the restrictions set forth in this Agreement.
+
+C. Warranties and Disclaimers.
+ 1. This publication and/or website may include technical or typographical
+ errors or other inaccuracies . Changes are periodically added to the
+ information herein; these changes will be incorporated in new editions
+ of the publication and/or website. Unicode may make improvements and/or
+ changes in the product(s) and/or program(s) described in this
+ publication and/or website at any time.
+
+ 2. If this file has been purchased on magnetic or optical media from
+ Unicode, Inc. the sole and exclusive remedy for any claim will be
+ exchange of the defective media within ninety (90) days of original
+ purchase.
+
+ 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR SOFTWARE IS
+ PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, IMPLIED,
+ OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+ UNICODE AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR
+ OMISSIONS IN THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH
+ ARE REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE.
+
+D. Waiver of Damages. In no event shall Unicode or its licensors be liable for
+ any special, incidental, indirect or consequential damages of any kind, or
+ any damages whatsoever, whether or not Unicode was advised of the
+ possibility of the damage, including, without limitation, those resulting
+ from the following: loss of use, data or profits, in connection with the
+ use, modification or distribution of this information or its derivatives.
+
+E.Trademarks & Logos.
+ 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode,
+ Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of
+ Unicode, Inc. Use of the information and materials found on this
+ website indicates your acknowledgement of Unicode, Inc.’s exclusive
+ worldwide rights in the Unicode Word Mark, the Unicode Logo, and the
+ Unicode trade names.
+
+ 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark
+ Policy”) are incorporated herein by reference and you agree to abide by
+ the provisions of the Trademark Policy, which may be changed from time
+ to time in the sole discretion of Unicode, Inc.
+
+ 3. All third party trademarks referenced herein are the property of their
+ respective owners.
+
+Miscellaneous.
+ 1. Jurisdiction and Venue. This server is operated from a location in the
+ State of California, United States of America. Unicode makes no
+ representation that the materials are appropriate for use in other
+ locations. If you access this server from other locations, you are
+ responsible for compliance with local laws. This Agreement, all use of
+ this site and any claims and damages resulting from use of this site are
+ governed solely by the laws of the State of California without regard to
+ any principles which would apply the laws of a different jurisdiction.
+ The user agrees that any disputes regarding this site shall be resolved
+ solely in the courts located in Santa Clara County, California. The user
+ agrees said courts have personal jurisdiction and agree to waive any
+ right to transfer the dispute to any other forum.
+
+ 2. Modification by Unicode. Unicode shall have the right to modify this
+ Agreement at any time by posting it to this site. The user may not
+ assign any part of this Agreement without Unicode’s prior written
+ consent.
+
+ 3. Taxes. The user agrees to pay any taxes arising from access to this
+ website or use of the information herein, except for those based on
+ Unicode’s net income.
+
+ 4. Severability. If any provision of this Agreement is declared invalid or
+ unenforceable, the remaining provisions of this Agreement shall remain
+ in effect.
+
+ 5. Entire Agreement. This Agreement constitutes the entire agreement
+ between the parties.
+
+EXHIBIT 1
+UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+Unicode Data Files include all data files under the directories
+http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+http://www.unicode.org/cldr/data/. Unicode Data Files do not include PDF
+online code charts under the directory http://www.unicode.org/Public/.
+Software includes any source code published in the Unicode Standard or under
+the directories http://www.unicode.org/Public/,
+http://www.unicode.org/reports/, and http://www.unicode.org/cldr/data/.
+
+NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING,
+INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA
+FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO
+BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT
+AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR
+SOFTWARE.
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright © 1991-2012 Unicode, Inc. All rights reserved. Distributed under the
+Terms of Use in http://www.unicode.org/copyright.html.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the Unicode data files and any associated documentation (the "Data Files")
+or Unicode software and any associated documentation (the "Software") to deal
+in the Data Files or Software without restriction, including without
+limitation the rights to use, copy, modify, merge, publish, distribute, and/or
+sell copies of the Data Files or Software, and to permit persons to whom the
+Data Files or Software are furnished to do so, provided that (a) the above
+copyright notice(s) and this permission notice appear with all copies of the
+Data Files or Software, (b) both the above copyright notice(s) and this
+permission notice appear in associated documentation, and (c) there is clear
+notice in each modified Data File or in the Software as well as in the
+documentation associated with the Data File(s) or Software that the data or
+software has been modified.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
+DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in these Data Files or Software without prior written authorization of the
+copyright holder.
+
+Unicode and the Unicode logo are trademarks of Unicode, Inc. in the United
+States and other countries. All third party trademarks referenced herein are
+the property of their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to UPX v3.01, which may be included
+with JRE 8 on Windows.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+
+ ooooo ooo ooooooooo. ooooooo ooooo
+ `888' `8' `888 `Y88. `8888 d8'
+ 888 8 888 .d88' Y888..8P
+ 888 8 888ooo88P' `8888'
+ 888 8 888 .8PY888.
+ `88. .8' 888 d8' `888b
+ `YbodP' o888o o888o o88888o
+
+
+ The Ultimate Packer for eXecutables
+ Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
+ http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
+ http://www.nexus.hu/upx
+ http://upx.tsx.org
+
+
+PLEASE CAREFULLY READ THIS LICENSE AGREEMENT, ESPECIALLY IF YOU PLAN
+TO MODIFY THE UPX SOURCE CODE OR USE A MODIFIED UPX VERSION.
+
+
+ABSTRACT
+========
+
+ UPX and UCL are copyrighted software distributed under the terms
+ of the GNU General Public License (hereinafter the "GPL").
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ As a special exception we grant the free usage of UPX for all
+ executables, including commercial programs.
+ See below for details and restrictions.
+
+
+COPYRIGHT
+=========
+
+ UPX and UCL are copyrighted software. All rights remain with the authors.
+
+ UPX is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+ UPX is Copyright (C) 1996-2000 Laszlo Molnar
+
+ UCL is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+
+
+GNU GENERAL PUBLIC LICENSE
+==========================
+
+ UPX and the UCL library are free software; you can redistribute them
+ and/or modify them under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ UPX and UCL are distributed in the hope that they 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+
+
+SPECIAL EXCEPTION FOR COMPRESSED EXECUTABLES
+============================================
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ Hereby Markus F.X.J. Oberhumer and Laszlo Molnar grant you special
+ permission to freely use and distribute all UPX compressed programs
+ (including commercial ones), subject to the following restrictions:
+
+ 1. You must compress your program with a completely unmodified UPX
+ version; either with our precompiled version, or (at your option)
+ with a self compiled version of the unmodified UPX sources as
+ distributed by us.
+ 2. This also implies that the UPX stub must be completely unmodfied, i.e.
+ the stub imbedded in your compressed program must be byte-identical
+ to the stub that is produced by the official unmodified UPX version.
+ 3. The decompressor and any other code from the stub must exclusively get
+ used by the unmodified UPX stub for decompressing your program at
+ program startup. No portion of the stub may get read, copied,
+ called or otherwise get used or accessed by your program.
+
+
+ANNOTATIONS
+===========
+
+ - You can use a modified UPX version or modified UPX stub only for
+ programs that are compatible with the GNU General Public License.
+
+ - We grant you special permission to freely use and distribute all UPX
+ compressed programs. But any modification of the UPX stub (such as,
+ but not limited to, removing our copyright string or making your
+ program non-decompressible) will immediately revoke your right to
+ use and distribute a UPX compressed program.
+
+ - UPX is not a software protection tool; by requiring that you use
+ the unmodified UPX version for your proprietary programs we
+ make sure that any user can decompress your program. This protects
+ both you and your users as nobody can hide malicious code -
+ any program that cannot be decompressed is highly suspicious
+ by definition.
+
+ - You can integrate all or part of UPX and UCL into projects that
+ are compatible with the GNU GPL, but obviously you cannot grant
+ any special exceptions beyond the GPL for our code in your project.
+
+ - We want to actively support manufacturers of virus scanners and
+ similar security software. Please contact us if you would like to
+ incorporate parts of UPX or UCL into such a product.
+
+
+
+Markus F.X.J. Oberhumer Laszlo Molnar
+markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
+
+Linz, Austria, 25 Feb 2000
+
+Additional License(s)
+
+The UPX license file is at http://upx.sourceforge.net/upx-license.html.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Xfree86-VidMode Extension 1.0,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Version 1.1 of XFree86 ProjectLicence.
+
+Copyright (C) 1994-2004 The XFree86 Project, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicence, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so,subject to the following conditions:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice,this list of conditions, and the following disclaimer.
+
+ 2. 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, and in the same place
+ and form as other copyright, license and disclaimer information.
+
+ 3. The end-user documentation included with the redistribution, if any,must
+ include the following acknowledgment: "This product includes
+ software developed by The XFree86 Project, Inc (http://www.xfree86.org/) and
+ its contributors", in the same place and form as other third-party
+ acknowledgments. Alternately, this acknowledgment may appear in the software
+ itself, in the same form and location as other such third-party
+ acknowledgments.
+
+ 4. Except as contained in this notice, the name of The XFree86 Project,Inc
+ shall not be used in advertising or otherwise to promote the sale, use
+ or other dealings in this Software without prior written authorization from
+ The XFree86 Project, Inc.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 XFREE86 PROJECT, INC OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to X Window System 6.8.2, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+ Licenses
+The X.Org Foundation March 2004
+
+1. Introduction
+
+The X.org Foundation X Window System distribution is a compilation of code and
+documentation from many sources. This document is intended primarily as a
+guide to the licenses used in the distribution: you must check each file
+and/or package for precise redistribution terms. None-the-less, this summary
+may be useful to many users. No software incorporating the XFree86 1.1 license
+has been incorporated.
+
+This document is based on the compilation from XFree86.
+
+2. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following
+copyright/license:
+
+Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the XFree86 Project.
+
+3. Other Licenses
+
+Portions of code are covered by the following licenses/copyrights. See
+individual files for the copyright dates.
+
+3.1. X/MIT Copyrights
+
+3.1.1. X Consortium
+
+Copyright (C) <date> X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
+3.1.2. The Open Group
+
+Copyright <date> The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation.
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from The Open Group. 3.2.
+Berkeley-based copyrights:
+
+o
+3.2.1. General
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.2. UCB/LBL
+
+Copyright (c) 1993 The Regents of the University of California. All rights
+reserved.
+
+This software was developed by the Computer Systems Engineering group at
+Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
+Berkeley.
+
+All advertising materials mentioning features or use of this software must
+display the following acknowledgement: This product includes software
+developed by the University of California, Lawrence Berkeley Laboratory.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the University of California, Berkeley and its contributors.
+
+ 4. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. 3.2.3. The
+NetBSD Foundation, Inc.
+
+Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation by Ben
+Collver <collver1@attbi.com>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the NetBSD Foundation, Inc. and its contributors.
+
+ 4. Neither the name of The NetBSD Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. 3.2.4. Theodore
+Ts'o.
+
+Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights
+reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ and the entire permission notice in its entirety, including the disclaimer
+ of warranties.
+
+ 2. 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.
+
+ 3. he name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR 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 NOT ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.2.5. Theo de Raadt and Damien Miller
+
+Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c)
+2001-2002 Damien Miller. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.6. Todd C. Miller
+
+Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 3.2.7. Thomas
+Winischhofer
+
+Copyright (C) 2001-2004 Thomas Winischhofer
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED 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 AUTHOR 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. 3.3. NVIDIA Corp
+
+Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+NOTICE TO USER: The source code is copyrighted under U.S. and international
+laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as design
+patents pending on the design and interface of the NV chips. Users and
+possessors of this source code are hereby granted a nonexclusive, royalty-free
+copyright and design patent license to use this code in individual and
+commercial software.
+
+Any use of this source code must include, in the user documentation and
+internal comments to the code, notices to the end user as follows:
+
+Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. and
+foreign countries.
+
+NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
+WARRANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
+FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. 3.4. GLX Public
+License
+
+GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
+
+Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
+grants permission to Recipient (defined below), under Recipient's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below), and to permit persons to whom the Subject Software is
+furnished in accordance with this License to do the same, subject to all of
+the following terms and conditions, which Recipient accepts by engaging in any
+such use, copying, modifying, merging, publishing, distributing, sublicensing
+or selling:
+
+1. Definitions.
+
+ (a) "Original Software" means source code of computer software code which
+ is described in Exhibit A as Original Software.
+
+ (b) "Modifications" means any addition to or deletion from the substance
+ or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of files, a
+ Modification means (i) any addition to or deletion from the contents of a
+ file containing Original Software or previous Modifications and (ii) any
+ new file that contains any part of the Original Code or previous
+ Modifications.
+
+ (c) "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ (d) "Recipient" means an individual or a legal entity exercising rights
+ under, and complying with all of the terms of, this License. For legal
+ entities, "Recipient" includes any entity which controls, is controlled
+ by, or is under common control with Recipient. For purposes of this
+ definition, "control" of an entity means (a) the power, direct or
+ indirect, to direct or manage such entity, or (b) ownership of fifty
+ percent (50%) or more of the outstanding shares or beneficial ownership of
+ such entity.
+
+2. Redistribution of Source Code Subject to These Terms. Redistributions of
+Subject Software in source code form must retain the notice set forth in
+Exhibit A, below, in every file. A copy of this License must be included in
+any documentation for such Subject Software where the recipients' rights
+relating to Subject Software are described. Recipient may distribute the
+source code version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the source code version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+3. Redistribution in Executable Form. The notice set forth in Exhibit A must
+be conspicuously included in any notice in an executable version of Subject
+Software, related documentation or collateral in which Recipient describes the
+user's rights relating to the Subject Software. Recipient may distribute the
+executable version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the executable version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+4. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software which is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+5. No Trademark Rights. This License does not grant any rights to use any
+trade name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from
+the Subject Software without prior written permission of SGI.
+
+6. No Other Rights. This License does not grant any rights with respect to the
+OpenGL API or to any software or hardware implementation thereof or to any
+other software whatsoever, nor shall any other rights or licenses not
+expressly granted hereunder arise by implication, estoppel or otherwise with
+respect to the Subject Software. Title to and ownership of the Original
+Software at all times remains with SGI. All rights in the Original Software
+not expressly granted under this License are reserved.
+
+7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+8. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Exhibit A notice required under Sections 2 and 3,
+above, and in the text of any related documentation, license agreement or
+collateral in which Recipient describes end user's rights relating to the
+Subject Software. If Recipient obtains such knowledge after it makes Subject
+Software available to any other person or entity, Recipient shall take other
+steps (such as notifying appropriate mailing lists or newsgroups) reasonably
+calculated to inform those who received the Subject Software that new
+knowledge has been obtained.
+
+9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
+THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
+TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
+THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
+
+11. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. from
+and against any loss, liability, damages, costs or expenses (including the
+payment of reasonable attorneys fees) arising out of Recipient's use,
+modification, reproduction and distribution of the Subject Software or out of
+any representation or warranty made by Recipient.
+
+12. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+13. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed so as to achieve as nearly as
+possible the same economic effect as the original provision and the remainder
+of this License will remain in effect. This License shall be governed by and
+construed in accordance with the laws of the United States and the State of
+California as applied to agreements entered into and to be performed entirely
+within California between California residents. Any litigation relating to
+this License shall be subject to the exclusive jurisdiction of the Federal
+Courts of the Northern District of California (or, absent subject matter
+jurisdiction in such courts, the courts of the State of California), with
+venue lying exclusively in Santa Clara County, California, with the losing
+party responsible for costs, including without limitation, court costs and
+reasonable attorneys fees and expenses. The application of the United Nations
+Convention on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of a contract
+shall be construed against the drafter shall not apply to this License.
+
+Exhibit A
+
+The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and 13
+of the GLX Public License Version 1.0 (the "License"). You may not use this
+file except in compliance with those sections of the License. You may obtain a
+copy of the License at Silicon Graphics, Inc., attn: Legal Services, 2011 N.
+Shoreline Blvd., Mountain View, CA 94043 or at
+http://www.sgi.com/software/opensource/glx/license.html.
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software is GLX version 1.2 source code, released February, 1999.
+The developer of the Original Software is Silicon Graphics, Inc. Those
+portions of the Subject Software created by Silicon Graphics, Inc. are
+Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. 3.5. CID
+Font Code Public License
+
+CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
+
+Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
+hereby grants permission to Recipient (defined below), under SGI's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below) in both source code and executable form, and to permit persons
+to whom the Subject Software is furnished in accordance with this License to
+do the same, subject to all of the following terms and conditions, which
+Recipient accepts by engaging in any such use, copying, modifying, merging,
+publication, distributing, sublicensing or selling:
+
+1. Definitions.
+
+ a. "Original Software" means source code of computer software code that is
+ described in Exhibit A as Original Software.
+
+ b. "Modifications" means any addition to or deletion from the substance or
+ structure of either the Original Software or any previous Modifications.
+ When Subject Software is released as a series of files, a Modification
+ means (i) any addition to or deletion from the contents of a file
+ containing Original Software or previous Modifications and (ii) any new
+ file that contains any part of the Original Code or previous
+ Modifications.
+
+ c. "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ d. "Recipient" means an individual or a legal entity exercising rights
+ under the terms of this License. For legal entities, "Recipient" includes
+ any entity that controls, is controlled by, or is under common control
+ with Recipient. For purposes of this definition, "control" of an entity
+ means (i) the power, direct or indirect, to direct or manage such entity,
+ or (ii) ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+ e. "Required Notice" means the notice set forth in Exhibit A to this
+ License.
+
+ f. "Accompanying Technology" means any software or other technology that
+ is not a Modification and that is distributed or made publicly available
+ by Recipient with the Subject Software. Separate software files that do
+ not contain any Original Software or any previous Modification shall not
+ be deemed a Modification, even if such software files are aggregated as
+ part of a product, or in any medium of storage, with any file that does
+ contain Original Software or any previous Modification.
+
+2. License Terms. All distribution of the Subject Software must be made
+subject to the terms of this License. A copy of this License and the Required
+Notice must be included in any documentation for Subject Software where
+Recipient's rights relating to Subject Software and/or any Accompanying
+Technology are described. Distributions of Subject Software in source code
+form must also include the Required Notice in every file distributed. In
+addition, a ReadMe file entitled "Important Legal Notice" must be distributed
+with each distribution of one or more files that incorporate Subject Software.
+That file must be included with distributions made in both source code and
+executable form. A copy of the License and the Required Notice must be
+included in that file. Recipient may distribute Accompanying Technology under
+a license of Recipient's choice, which may contain terms different from this
+License, provided that (i) Recipient is in compliance with the terms of this
+License, (ii) such other license terms do not modify or supersede the terms of
+this License as applicable to the Subject Software, (iii) Recipient hereby
+indemnifies SGI for any liability incurred by SGI as a result of the
+distribution of Accompanying Technology or the use of other license terms.
+
+3. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software that is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+4. Trademark Rights. This License does not grant any rights to use any trade
+name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from or
+incorporating any Subject Software without prior written permission of SGI.
+
+5. No Other Rights. No rights or licenses not expressly granted hereunder
+shall arise by implication, estoppel or otherwise. Title to and ownership of
+the Original Software at all times remains with SGI. All rights in the
+Original Software not expressly granted under this License are reserved.
+
+6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity, or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+7. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Required Notice, and in the text of any related
+documentation, license agreement or collateral in which Recipient describes
+end user's rights relating to the Subject Software. If Recipient obtains such
+knowledge after it makes Subject Software available to any other person or
+entity, Recipient shall take other steps (such as notifying appropriate
+mailing lists or newsgroups) reasonably calculated to provide such knowledge
+to those who received the Subject Software.
+
+8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
+LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
+
+10. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold SGI and its successors and assigns
+harmless from and against any loss, liability, damages, costs or expenses
+(including the payment of reasonable attorneys fees) arising out of
+(Recipient's use, modification, reproduction and distribution of the Subject
+Software or out of any representation or warranty made by Recipient.
+
+11. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+12. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable by any judicial or administrative authority having proper
+jurisdiction with respect thereto, such provision shall be reformed so as to
+achieve as nearly as possible the same economic effect as the original
+provision and the remainder of this License will remain in effect. This
+License shall be governed by and construed in accordance with the laws of the
+United States and the State of California as applied to agreements entered
+into and to be performed entirely within California between California
+residents. Any litigation relating to this License shall be subject to the
+exclusive jurisdiction of the Federal Courts of the Northern District of
+California (or, absent subject matter jurisdiction in such courts, the courts
+of the State of California), with venue lying exclusively in Santa Clara
+County, California, with the losing party responsible for costs, including
+without limitation, court costs and reasonable attorneys fees and expenses.
+The application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or regulation that
+provides that the language of a contract shall be construed against the
+drafter shall not apply to this License.
+
+Exhibit A
+
+Copyright (c) 1994-1999 Silicon Graphics, Inc.
+
+The contents of this file are subject to the CID Font Code Public License
+Version 1.0 (the "License"). You may not use this file except in compliance
+with the License. You may obtain a copy of the License at Silicon Graphics,
+Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+or at http://www.sgi.com/software/opensource/cid/license.html
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
+NON-INFRINGEMENT. See the License for the specific language governing rights
+and limitations under the License.
+
+The Original Software (as defined in the License) is CID font code that was
+developed by Silicon Graphics, Inc. Those portions of the Subject Software (as
+defined in the License) that were created by Silicon Graphics, Inc. are
+Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
+
+[NOTE: When using this text in connection with Subject Software delivered
+solely in object code form, Recipient may replace the words "this file" with
+"this software" in both the first and second sentences.] 3.6. Bitstream Vera
+Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as long as
+"Bitstream" or "Vera" are not in the names), and full redistribution (so long
+as they are not *sold* by themselves). They can be be bundled, redistributed
+and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a
+trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit persons to
+whom the Font Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular the
+designs of glyphs or characters in the Fonts may be modified and additional
+glyphs or characters may be added to the Fonts, only if the fonts are renamed
+to names not containing either the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream Vera"
+names.
+
+The Font Software may be sold as part of a larger software package but no copy
+of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
+SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO
+USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome Foundation,
+and Bitstream Inc., shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Font Software without prior written
+authorization from the Gnome Foundation or Bitstream Inc., respectively. For
+further information, contact: fonts at gnome dot org. 3.7. Bigelow & Holmes
+Inc and URW++ GmbH Luxi font license
+
+Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction
+code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a
+registered trademark of Bigelow & Holmes Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of these Fonts and associated documentation files (the "Font Software"), to
+deal in the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, sublicense, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software.
+
+The Font Software may not be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may not be modified nor may
+additional glyphs or characters be added to the Fonts. This License becomes
+null and void when the Fonts or Font Software have been modified.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++
+GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY
+GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
+SOFTWARE.
+
+Except as contained in this notice, the names of Bigelow & Holmes Inc. and
+URW++ GmbH. shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Font Software without prior written
+authorization from Bigelow & Holmes Inc. and URW++ GmbH.
+
+For further information, contact:
+
+info@urwpp.de or design@bigelowandholmes.com
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to zlib v1.2.8, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ version 1.2.8, April 28th, 2013
+
+ Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to the following which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+ Apache Commons Math 3.2
+ Apache Derby 10.11.1.2
+ Apache Jakarta BCEL 5.1
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XML Security for Java 1.5.4
+ Apache Xalan-Java 2.7.1
+ Apache Xerces Java 2.10.0
+ Apache XML Resolver 1.1
+ Dynalink 0.5
+
+
+--- begin of LICENSE ---
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
diff --git a/staging/darwin-x86/bin/appletviewer b/staging/darwin-x86/bin/appletviewer
new file mode 100755
index 0000000..6725f56
--- /dev/null
+++ b/staging/darwin-x86/bin/appletviewer
Binary files differ
diff --git a/staging/darwin-x86/bin/extcheck b/staging/darwin-x86/bin/extcheck
new file mode 100755
index 0000000..9d25496
--- /dev/null
+++ b/staging/darwin-x86/bin/extcheck
Binary files differ
diff --git a/staging/darwin-x86/bin/idlj b/staging/darwin-x86/bin/idlj
new file mode 100755
index 0000000..a7df061
--- /dev/null
+++ b/staging/darwin-x86/bin/idlj
Binary files differ
diff --git a/staging/darwin-x86/bin/jar b/staging/darwin-x86/bin/jar
new file mode 100755
index 0000000..20975c8
--- /dev/null
+++ b/staging/darwin-x86/bin/jar
Binary files differ
diff --git a/staging/darwin-x86/bin/jarsigner b/staging/darwin-x86/bin/jarsigner
new file mode 100755
index 0000000..fe42a7d
--- /dev/null
+++ b/staging/darwin-x86/bin/jarsigner
Binary files differ
diff --git a/staging/darwin-x86/bin/java b/staging/darwin-x86/bin/java
new file mode 100755
index 0000000..886384d
--- /dev/null
+++ b/staging/darwin-x86/bin/java
Binary files differ
diff --git a/staging/darwin-x86/bin/javac b/staging/darwin-x86/bin/javac
new file mode 100755
index 0000000..68fd891
--- /dev/null
+++ b/staging/darwin-x86/bin/javac
Binary files differ
diff --git a/staging/darwin-x86/bin/javadoc b/staging/darwin-x86/bin/javadoc
new file mode 100755
index 0000000..4250d2d
--- /dev/null
+++ b/staging/darwin-x86/bin/javadoc
Binary files differ
diff --git a/staging/darwin-x86/bin/javah b/staging/darwin-x86/bin/javah
new file mode 100755
index 0000000..ad8bf02
--- /dev/null
+++ b/staging/darwin-x86/bin/javah
Binary files differ
diff --git a/staging/darwin-x86/bin/javap b/staging/darwin-x86/bin/javap
new file mode 100755
index 0000000..e734adc
--- /dev/null
+++ b/staging/darwin-x86/bin/javap
Binary files differ
diff --git a/staging/darwin-x86/bin/jcmd b/staging/darwin-x86/bin/jcmd
new file mode 100755
index 0000000..2df1ed2
--- /dev/null
+++ b/staging/darwin-x86/bin/jcmd
Binary files differ
diff --git a/staging/darwin-x86/bin/jconsole b/staging/darwin-x86/bin/jconsole
new file mode 100755
index 0000000..c52b4f4
--- /dev/null
+++ b/staging/darwin-x86/bin/jconsole
Binary files differ
diff --git a/staging/darwin-x86/bin/jdb b/staging/darwin-x86/bin/jdb
new file mode 100755
index 0000000..10aac4e
--- /dev/null
+++ b/staging/darwin-x86/bin/jdb
Binary files differ
diff --git a/staging/darwin-x86/bin/jdeps b/staging/darwin-x86/bin/jdeps
new file mode 100755
index 0000000..27b85d5
--- /dev/null
+++ b/staging/darwin-x86/bin/jdeps
Binary files differ
diff --git a/staging/darwin-x86/bin/jhat b/staging/darwin-x86/bin/jhat
new file mode 100755
index 0000000..77f97ed
--- /dev/null
+++ b/staging/darwin-x86/bin/jhat
Binary files differ
diff --git a/staging/darwin-x86/bin/jinfo b/staging/darwin-x86/bin/jinfo
new file mode 100755
index 0000000..edb7e55
--- /dev/null
+++ b/staging/darwin-x86/bin/jinfo
Binary files differ
diff --git a/staging/darwin-x86/bin/jjs b/staging/darwin-x86/bin/jjs
new file mode 100755
index 0000000..2fe6f47
--- /dev/null
+++ b/staging/darwin-x86/bin/jjs
Binary files differ
diff --git a/staging/darwin-x86/bin/jmap b/staging/darwin-x86/bin/jmap
new file mode 100755
index 0000000..8511322
--- /dev/null
+++ b/staging/darwin-x86/bin/jmap
Binary files differ
diff --git a/staging/darwin-x86/bin/jps b/staging/darwin-x86/bin/jps
new file mode 100755
index 0000000..c2f4670
--- /dev/null
+++ b/staging/darwin-x86/bin/jps
Binary files differ
diff --git a/staging/darwin-x86/bin/jrunscript b/staging/darwin-x86/bin/jrunscript
new file mode 100755
index 0000000..b6e7d97
--- /dev/null
+++ b/staging/darwin-x86/bin/jrunscript
Binary files differ
diff --git a/staging/darwin-x86/bin/jsadebugd b/staging/darwin-x86/bin/jsadebugd
new file mode 100755
index 0000000..a205ebe
--- /dev/null
+++ b/staging/darwin-x86/bin/jsadebugd
Binary files differ
diff --git a/staging/darwin-x86/bin/jstack b/staging/darwin-x86/bin/jstack
new file mode 100755
index 0000000..c7b9cad
--- /dev/null
+++ b/staging/darwin-x86/bin/jstack
Binary files differ
diff --git a/staging/darwin-x86/bin/jstat b/staging/darwin-x86/bin/jstat
new file mode 100755
index 0000000..9bda6dc
--- /dev/null
+++ b/staging/darwin-x86/bin/jstat
Binary files differ
diff --git a/staging/darwin-x86/bin/jstatd b/staging/darwin-x86/bin/jstatd
new file mode 100755
index 0000000..7fe1738
--- /dev/null
+++ b/staging/darwin-x86/bin/jstatd
Binary files differ
diff --git a/staging/darwin-x86/bin/keytool b/staging/darwin-x86/bin/keytool
new file mode 100755
index 0000000..f33144f
--- /dev/null
+++ b/staging/darwin-x86/bin/keytool
Binary files differ
diff --git a/staging/darwin-x86/bin/native2ascii b/staging/darwin-x86/bin/native2ascii
new file mode 100755
index 0000000..40a8c9d
--- /dev/null
+++ b/staging/darwin-x86/bin/native2ascii
Binary files differ
diff --git a/staging/darwin-x86/bin/orbd b/staging/darwin-x86/bin/orbd
new file mode 100755
index 0000000..f00cef6
--- /dev/null
+++ b/staging/darwin-x86/bin/orbd
Binary files differ
diff --git a/staging/darwin-x86/bin/pack200 b/staging/darwin-x86/bin/pack200
new file mode 100755
index 0000000..726cca5
--- /dev/null
+++ b/staging/darwin-x86/bin/pack200
Binary files differ
diff --git a/staging/darwin-x86/bin/policytool b/staging/darwin-x86/bin/policytool
new file mode 100755
index 0000000..7f23ef1
--- /dev/null
+++ b/staging/darwin-x86/bin/policytool
Binary files differ
diff --git a/staging/darwin-x86/bin/rmic b/staging/darwin-x86/bin/rmic
new file mode 100755
index 0000000..6af4cf0
--- /dev/null
+++ b/staging/darwin-x86/bin/rmic
Binary files differ
diff --git a/staging/darwin-x86/bin/rmid b/staging/darwin-x86/bin/rmid
new file mode 100755
index 0000000..b572dd0
--- /dev/null
+++ b/staging/darwin-x86/bin/rmid
Binary files differ
diff --git a/staging/darwin-x86/bin/rmiregistry b/staging/darwin-x86/bin/rmiregistry
new file mode 100755
index 0000000..78ebf2c
--- /dev/null
+++ b/staging/darwin-x86/bin/rmiregistry
Binary files differ
diff --git a/staging/darwin-x86/bin/schemagen b/staging/darwin-x86/bin/schemagen
new file mode 100755
index 0000000..2057dcd
--- /dev/null
+++ b/staging/darwin-x86/bin/schemagen
Binary files differ
diff --git a/staging/darwin-x86/bin/serialver b/staging/darwin-x86/bin/serialver
new file mode 100755
index 0000000..f0f2b05
--- /dev/null
+++ b/staging/darwin-x86/bin/serialver
Binary files differ
diff --git a/staging/darwin-x86/bin/servertool b/staging/darwin-x86/bin/servertool
new file mode 100755
index 0000000..d273d86
--- /dev/null
+++ b/staging/darwin-x86/bin/servertool
Binary files differ
diff --git a/staging/darwin-x86/bin/tnameserv b/staging/darwin-x86/bin/tnameserv
new file mode 100755
index 0000000..e516c42
--- /dev/null
+++ b/staging/darwin-x86/bin/tnameserv
Binary files differ
diff --git a/staging/darwin-x86/bin/unpack200 b/staging/darwin-x86/bin/unpack200
new file mode 100755
index 0000000..e72457c
--- /dev/null
+++ b/staging/darwin-x86/bin/unpack200
Binary files differ
diff --git a/staging/darwin-x86/bin/wsgen b/staging/darwin-x86/bin/wsgen
new file mode 100755
index 0000000..7bf7c12
--- /dev/null
+++ b/staging/darwin-x86/bin/wsgen
Binary files differ
diff --git a/staging/darwin-x86/bin/wsimport b/staging/darwin-x86/bin/wsimport
new file mode 100755
index 0000000..5c07119
--- /dev/null
+++ b/staging/darwin-x86/bin/wsimport
Binary files differ
diff --git a/staging/darwin-x86/bin/xjc b/staging/darwin-x86/bin/xjc
new file mode 100755
index 0000000..ca92a4c
--- /dev/null
+++ b/staging/darwin-x86/bin/xjc
Binary files differ
diff --git a/staging/darwin-x86/include/classfile_constants.h b/staging/darwin-x86/include/classfile_constants.h
new file mode 100644
index 0000000..1fa6e3c
--- /dev/null
+++ b/staging/darwin-x86/include/classfile_constants.h
@@ -0,0 +1,560 @@
+/*
+ * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef CLASSFILE_CONSTANTS_H
+#define CLASSFILE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Classfile version number for this information */
+#define JVM_CLASSFILE_MAJOR_VERSION 52
+#define JVM_CLASSFILE_MINOR_VERSION 0
+
+/* Flags */
+
+enum {
+ JVM_ACC_PUBLIC = 0x0001,
+ JVM_ACC_PRIVATE = 0x0002,
+ JVM_ACC_PROTECTED = 0x0004,
+ JVM_ACC_STATIC = 0x0008,
+ JVM_ACC_FINAL = 0x0010,
+ JVM_ACC_SYNCHRONIZED = 0x0020,
+ JVM_ACC_SUPER = 0x0020,
+ JVM_ACC_VOLATILE = 0x0040,
+ JVM_ACC_BRIDGE = 0x0040,
+ JVM_ACC_TRANSIENT = 0x0080,
+ JVM_ACC_VARARGS = 0x0080,
+ JVM_ACC_NATIVE = 0x0100,
+ JVM_ACC_INTERFACE = 0x0200,
+ JVM_ACC_ABSTRACT = 0x0400,
+ JVM_ACC_STRICT = 0x0800,
+ JVM_ACC_SYNTHETIC = 0x1000,
+ JVM_ACC_ANNOTATION = 0x2000,
+ JVM_ACC_ENUM = 0x4000
+};
+
+/* Used in newarray instruction. */
+
+enum {
+ JVM_T_BOOLEAN = 4,
+ JVM_T_CHAR = 5,
+ JVM_T_FLOAT = 6,
+ JVM_T_DOUBLE = 7,
+ JVM_T_BYTE = 8,
+ JVM_T_SHORT = 9,
+ JVM_T_INT = 10,
+ JVM_T_LONG = 11
+};
+
+/* Constant Pool Entries */
+
+enum {
+ JVM_CONSTANT_Utf8 = 1,
+ JVM_CONSTANT_Unicode = 2, /* unused */
+ JVM_CONSTANT_Integer = 3,
+ JVM_CONSTANT_Float = 4,
+ JVM_CONSTANT_Long = 5,
+ JVM_CONSTANT_Double = 6,
+ JVM_CONSTANT_Class = 7,
+ JVM_CONSTANT_String = 8,
+ JVM_CONSTANT_Fieldref = 9,
+ JVM_CONSTANT_Methodref = 10,
+ JVM_CONSTANT_InterfaceMethodref = 11,
+ JVM_CONSTANT_NameAndType = 12,
+ JVM_CONSTANT_MethodHandle = 15, // JSR 292
+ JVM_CONSTANT_MethodType = 16, // JSR 292
+ JVM_CONSTANT_InvokeDynamic = 18
+};
+
+/* JVM_CONSTANT_MethodHandle subtypes */
+enum {
+ JVM_REF_getField = 1,
+ JVM_REF_getStatic = 2,
+ JVM_REF_putField = 3,
+ JVM_REF_putStatic = 4,
+ JVM_REF_invokeVirtual = 5,
+ JVM_REF_invokeStatic = 6,
+ JVM_REF_invokeSpecial = 7,
+ JVM_REF_newInvokeSpecial = 8,
+ JVM_REF_invokeInterface = 9
+};
+
+/* StackMapTable type item numbers */
+
+enum {
+ JVM_ITEM_Top = 0,
+ JVM_ITEM_Integer = 1,
+ JVM_ITEM_Float = 2,
+ JVM_ITEM_Double = 3,
+ JVM_ITEM_Long = 4,
+ JVM_ITEM_Null = 5,
+ JVM_ITEM_UninitializedThis = 6,
+ JVM_ITEM_Object = 7,
+ JVM_ITEM_Uninitialized = 8
+};
+
+/* Type signatures */
+
+enum {
+ JVM_SIGNATURE_ARRAY = '[',
+ JVM_SIGNATURE_BYTE = 'B',
+ JVM_SIGNATURE_CHAR = 'C',
+ JVM_SIGNATURE_CLASS = 'L',
+ JVM_SIGNATURE_ENDCLASS = ';',
+ JVM_SIGNATURE_ENUM = 'E',
+ JVM_SIGNATURE_FLOAT = 'F',
+ JVM_SIGNATURE_DOUBLE = 'D',
+ JVM_SIGNATURE_FUNC = '(',
+ JVM_SIGNATURE_ENDFUNC = ')',
+ JVM_SIGNATURE_INT = 'I',
+ JVM_SIGNATURE_LONG = 'J',
+ JVM_SIGNATURE_SHORT = 'S',
+ JVM_SIGNATURE_VOID = 'V',
+ JVM_SIGNATURE_BOOLEAN = 'Z'
+};
+
+/* Opcodes */
+
+enum {
+ JVM_OPC_nop = 0,
+ JVM_OPC_aconst_null = 1,
+ JVM_OPC_iconst_m1 = 2,
+ JVM_OPC_iconst_0 = 3,
+ JVM_OPC_iconst_1 = 4,
+ JVM_OPC_iconst_2 = 5,
+ JVM_OPC_iconst_3 = 6,
+ JVM_OPC_iconst_4 = 7,
+ JVM_OPC_iconst_5 = 8,
+ JVM_OPC_lconst_0 = 9,
+ JVM_OPC_lconst_1 = 10,
+ JVM_OPC_fconst_0 = 11,
+ JVM_OPC_fconst_1 = 12,
+ JVM_OPC_fconst_2 = 13,
+ JVM_OPC_dconst_0 = 14,
+ JVM_OPC_dconst_1 = 15,
+ JVM_OPC_bipush = 16,
+ JVM_OPC_sipush = 17,
+ JVM_OPC_ldc = 18,
+ JVM_OPC_ldc_w = 19,
+ JVM_OPC_ldc2_w = 20,
+ JVM_OPC_iload = 21,
+ JVM_OPC_lload = 22,
+ JVM_OPC_fload = 23,
+ JVM_OPC_dload = 24,
+ JVM_OPC_aload = 25,
+ JVM_OPC_iload_0 = 26,
+ JVM_OPC_iload_1 = 27,
+ JVM_OPC_iload_2 = 28,
+ JVM_OPC_iload_3 = 29,
+ JVM_OPC_lload_0 = 30,
+ JVM_OPC_lload_1 = 31,
+ JVM_OPC_lload_2 = 32,
+ JVM_OPC_lload_3 = 33,
+ JVM_OPC_fload_0 = 34,
+ JVM_OPC_fload_1 = 35,
+ JVM_OPC_fload_2 = 36,
+ JVM_OPC_fload_3 = 37,
+ JVM_OPC_dload_0 = 38,
+ JVM_OPC_dload_1 = 39,
+ JVM_OPC_dload_2 = 40,
+ JVM_OPC_dload_3 = 41,
+ JVM_OPC_aload_0 = 42,
+ JVM_OPC_aload_1 = 43,
+ JVM_OPC_aload_2 = 44,
+ JVM_OPC_aload_3 = 45,
+ JVM_OPC_iaload = 46,
+ JVM_OPC_laload = 47,
+ JVM_OPC_faload = 48,
+ JVM_OPC_daload = 49,
+ JVM_OPC_aaload = 50,
+ JVM_OPC_baload = 51,
+ JVM_OPC_caload = 52,
+ JVM_OPC_saload = 53,
+ JVM_OPC_istore = 54,
+ JVM_OPC_lstore = 55,
+ JVM_OPC_fstore = 56,
+ JVM_OPC_dstore = 57,
+ JVM_OPC_astore = 58,
+ JVM_OPC_istore_0 = 59,
+ JVM_OPC_istore_1 = 60,
+ JVM_OPC_istore_2 = 61,
+ JVM_OPC_istore_3 = 62,
+ JVM_OPC_lstore_0 = 63,
+ JVM_OPC_lstore_1 = 64,
+ JVM_OPC_lstore_2 = 65,
+ JVM_OPC_lstore_3 = 66,
+ JVM_OPC_fstore_0 = 67,
+ JVM_OPC_fstore_1 = 68,
+ JVM_OPC_fstore_2 = 69,
+ JVM_OPC_fstore_3 = 70,
+ JVM_OPC_dstore_0 = 71,
+ JVM_OPC_dstore_1 = 72,
+ JVM_OPC_dstore_2 = 73,
+ JVM_OPC_dstore_3 = 74,
+ JVM_OPC_astore_0 = 75,
+ JVM_OPC_astore_1 = 76,
+ JVM_OPC_astore_2 = 77,
+ JVM_OPC_astore_3 = 78,
+ JVM_OPC_iastore = 79,
+ JVM_OPC_lastore = 80,
+ JVM_OPC_fastore = 81,
+ JVM_OPC_dastore = 82,
+ JVM_OPC_aastore = 83,
+ JVM_OPC_bastore = 84,
+ JVM_OPC_castore = 85,
+ JVM_OPC_sastore = 86,
+ JVM_OPC_pop = 87,
+ JVM_OPC_pop2 = 88,
+ JVM_OPC_dup = 89,
+ JVM_OPC_dup_x1 = 90,
+ JVM_OPC_dup_x2 = 91,
+ JVM_OPC_dup2 = 92,
+ JVM_OPC_dup2_x1 = 93,
+ JVM_OPC_dup2_x2 = 94,
+ JVM_OPC_swap = 95,
+ JVM_OPC_iadd = 96,
+ JVM_OPC_ladd = 97,
+ JVM_OPC_fadd = 98,
+ JVM_OPC_dadd = 99,
+ JVM_OPC_isub = 100,
+ JVM_OPC_lsub = 101,
+ JVM_OPC_fsub = 102,
+ JVM_OPC_dsub = 103,
+ JVM_OPC_imul = 104,
+ JVM_OPC_lmul = 105,
+ JVM_OPC_fmul = 106,
+ JVM_OPC_dmul = 107,
+ JVM_OPC_idiv = 108,
+ JVM_OPC_ldiv = 109,
+ JVM_OPC_fdiv = 110,
+ JVM_OPC_ddiv = 111,
+ JVM_OPC_irem = 112,
+ JVM_OPC_lrem = 113,
+ JVM_OPC_frem = 114,
+ JVM_OPC_drem = 115,
+ JVM_OPC_ineg = 116,
+ JVM_OPC_lneg = 117,
+ JVM_OPC_fneg = 118,
+ JVM_OPC_dneg = 119,
+ JVM_OPC_ishl = 120,
+ JVM_OPC_lshl = 121,
+ JVM_OPC_ishr = 122,
+ JVM_OPC_lshr = 123,
+ JVM_OPC_iushr = 124,
+ JVM_OPC_lushr = 125,
+ JVM_OPC_iand = 126,
+ JVM_OPC_land = 127,
+ JVM_OPC_ior = 128,
+ JVM_OPC_lor = 129,
+ JVM_OPC_ixor = 130,
+ JVM_OPC_lxor = 131,
+ JVM_OPC_iinc = 132,
+ JVM_OPC_i2l = 133,
+ JVM_OPC_i2f = 134,
+ JVM_OPC_i2d = 135,
+ JVM_OPC_l2i = 136,
+ JVM_OPC_l2f = 137,
+ JVM_OPC_l2d = 138,
+ JVM_OPC_f2i = 139,
+ JVM_OPC_f2l = 140,
+ JVM_OPC_f2d = 141,
+ JVM_OPC_d2i = 142,
+ JVM_OPC_d2l = 143,
+ JVM_OPC_d2f = 144,
+ JVM_OPC_i2b = 145,
+ JVM_OPC_i2c = 146,
+ JVM_OPC_i2s = 147,
+ JVM_OPC_lcmp = 148,
+ JVM_OPC_fcmpl = 149,
+ JVM_OPC_fcmpg = 150,
+ JVM_OPC_dcmpl = 151,
+ JVM_OPC_dcmpg = 152,
+ JVM_OPC_ifeq = 153,
+ JVM_OPC_ifne = 154,
+ JVM_OPC_iflt = 155,
+ JVM_OPC_ifge = 156,
+ JVM_OPC_ifgt = 157,
+ JVM_OPC_ifle = 158,
+ JVM_OPC_if_icmpeq = 159,
+ JVM_OPC_if_icmpne = 160,
+ JVM_OPC_if_icmplt = 161,
+ JVM_OPC_if_icmpge = 162,
+ JVM_OPC_if_icmpgt = 163,
+ JVM_OPC_if_icmple = 164,
+ JVM_OPC_if_acmpeq = 165,
+ JVM_OPC_if_acmpne = 166,
+ JVM_OPC_goto = 167,
+ JVM_OPC_jsr = 168,
+ JVM_OPC_ret = 169,
+ JVM_OPC_tableswitch = 170,
+ JVM_OPC_lookupswitch = 171,
+ JVM_OPC_ireturn = 172,
+ JVM_OPC_lreturn = 173,
+ JVM_OPC_freturn = 174,
+ JVM_OPC_dreturn = 175,
+ JVM_OPC_areturn = 176,
+ JVM_OPC_return = 177,
+ JVM_OPC_getstatic = 178,
+ JVM_OPC_putstatic = 179,
+ JVM_OPC_getfield = 180,
+ JVM_OPC_putfield = 181,
+ JVM_OPC_invokevirtual = 182,
+ JVM_OPC_invokespecial = 183,
+ JVM_OPC_invokestatic = 184,
+ JVM_OPC_invokeinterface = 185,
+ JVM_OPC_invokedynamic = 186,
+ JVM_OPC_new = 187,
+ JVM_OPC_newarray = 188,
+ JVM_OPC_anewarray = 189,
+ JVM_OPC_arraylength = 190,
+ JVM_OPC_athrow = 191,
+ JVM_OPC_checkcast = 192,
+ JVM_OPC_instanceof = 193,
+ JVM_OPC_monitorenter = 194,
+ JVM_OPC_monitorexit = 195,
+ JVM_OPC_wide = 196,
+ JVM_OPC_multianewarray = 197,
+ JVM_OPC_ifnull = 198,
+ JVM_OPC_ifnonnull = 199,
+ JVM_OPC_goto_w = 200,
+ JVM_OPC_jsr_w = 201,
+ JVM_OPC_MAX = 201
+};
+
+/* Opcode length initializer, use with something like:
+ * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
+ */
+#define JVM_OPCODE_LENGTH_INITIALIZER { \
+ 1, /* nop */ \
+ 1, /* aconst_null */ \
+ 1, /* iconst_m1 */ \
+ 1, /* iconst_0 */ \
+ 1, /* iconst_1 */ \
+ 1, /* iconst_2 */ \
+ 1, /* iconst_3 */ \
+ 1, /* iconst_4 */ \
+ 1, /* iconst_5 */ \
+ 1, /* lconst_0 */ \
+ 1, /* lconst_1 */ \
+ 1, /* fconst_0 */ \
+ 1, /* fconst_1 */ \
+ 1, /* fconst_2 */ \
+ 1, /* dconst_0 */ \
+ 1, /* dconst_1 */ \
+ 2, /* bipush */ \
+ 3, /* sipush */ \
+ 2, /* ldc */ \
+ 3, /* ldc_w */ \
+ 3, /* ldc2_w */ \
+ 2, /* iload */ \
+ 2, /* lload */ \
+ 2, /* fload */ \
+ 2, /* dload */ \
+ 2, /* aload */ \
+ 1, /* iload_0 */ \
+ 1, /* iload_1 */ \
+ 1, /* iload_2 */ \
+ 1, /* iload_3 */ \
+ 1, /* lload_0 */ \
+ 1, /* lload_1 */ \
+ 1, /* lload_2 */ \
+ 1, /* lload_3 */ \
+ 1, /* fload_0 */ \
+ 1, /* fload_1 */ \
+ 1, /* fload_2 */ \
+ 1, /* fload_3 */ \
+ 1, /* dload_0 */ \
+ 1, /* dload_1 */ \
+ 1, /* dload_2 */ \
+ 1, /* dload_3 */ \
+ 1, /* aload_0 */ \
+ 1, /* aload_1 */ \
+ 1, /* aload_2 */ \
+ 1, /* aload_3 */ \
+ 1, /* iaload */ \
+ 1, /* laload */ \
+ 1, /* faload */ \
+ 1, /* daload */ \
+ 1, /* aaload */ \
+ 1, /* baload */ \
+ 1, /* caload */ \
+ 1, /* saload */ \
+ 2, /* istore */ \
+ 2, /* lstore */ \
+ 2, /* fstore */ \
+ 2, /* dstore */ \
+ 2, /* astore */ \
+ 1, /* istore_0 */ \
+ 1, /* istore_1 */ \
+ 1, /* istore_2 */ \
+ 1, /* istore_3 */ \
+ 1, /* lstore_0 */ \
+ 1, /* lstore_1 */ \
+ 1, /* lstore_2 */ \
+ 1, /* lstore_3 */ \
+ 1, /* fstore_0 */ \
+ 1, /* fstore_1 */ \
+ 1, /* fstore_2 */ \
+ 1, /* fstore_3 */ \
+ 1, /* dstore_0 */ \
+ 1, /* dstore_1 */ \
+ 1, /* dstore_2 */ \
+ 1, /* dstore_3 */ \
+ 1, /* astore_0 */ \
+ 1, /* astore_1 */ \
+ 1, /* astore_2 */ \
+ 1, /* astore_3 */ \
+ 1, /* iastore */ \
+ 1, /* lastore */ \
+ 1, /* fastore */ \
+ 1, /* dastore */ \
+ 1, /* aastore */ \
+ 1, /* bastore */ \
+ 1, /* castore */ \
+ 1, /* sastore */ \
+ 1, /* pop */ \
+ 1, /* pop2 */ \
+ 1, /* dup */ \
+ 1, /* dup_x1 */ \
+ 1, /* dup_x2 */ \
+ 1, /* dup2 */ \
+ 1, /* dup2_x1 */ \
+ 1, /* dup2_x2 */ \
+ 1, /* swap */ \
+ 1, /* iadd */ \
+ 1, /* ladd */ \
+ 1, /* fadd */ \
+ 1, /* dadd */ \
+ 1, /* isub */ \
+ 1, /* lsub */ \
+ 1, /* fsub */ \
+ 1, /* dsub */ \
+ 1, /* imul */ \
+ 1, /* lmul */ \
+ 1, /* fmul */ \
+ 1, /* dmul */ \
+ 1, /* idiv */ \
+ 1, /* ldiv */ \
+ 1, /* fdiv */ \
+ 1, /* ddiv */ \
+ 1, /* irem */ \
+ 1, /* lrem */ \
+ 1, /* frem */ \
+ 1, /* drem */ \
+ 1, /* ineg */ \
+ 1, /* lneg */ \
+ 1, /* fneg */ \
+ 1, /* dneg */ \
+ 1, /* ishl */ \
+ 1, /* lshl */ \
+ 1, /* ishr */ \
+ 1, /* lshr */ \
+ 1, /* iushr */ \
+ 1, /* lushr */ \
+ 1, /* iand */ \
+ 1, /* land */ \
+ 1, /* ior */ \
+ 1, /* lor */ \
+ 1, /* ixor */ \
+ 1, /* lxor */ \
+ 3, /* iinc */ \
+ 1, /* i2l */ \
+ 1, /* i2f */ \
+ 1, /* i2d */ \
+ 1, /* l2i */ \
+ 1, /* l2f */ \
+ 1, /* l2d */ \
+ 1, /* f2i */ \
+ 1, /* f2l */ \
+ 1, /* f2d */ \
+ 1, /* d2i */ \
+ 1, /* d2l */ \
+ 1, /* d2f */ \
+ 1, /* i2b */ \
+ 1, /* i2c */ \
+ 1, /* i2s */ \
+ 1, /* lcmp */ \
+ 1, /* fcmpl */ \
+ 1, /* fcmpg */ \
+ 1, /* dcmpl */ \
+ 1, /* dcmpg */ \
+ 3, /* ifeq */ \
+ 3, /* ifne */ \
+ 3, /* iflt */ \
+ 3, /* ifge */ \
+ 3, /* ifgt */ \
+ 3, /* ifle */ \
+ 3, /* if_icmpeq */ \
+ 3, /* if_icmpne */ \
+ 3, /* if_icmplt */ \
+ 3, /* if_icmpge */ \
+ 3, /* if_icmpgt */ \
+ 3, /* if_icmple */ \
+ 3, /* if_acmpeq */ \
+ 3, /* if_acmpne */ \
+ 3, /* goto */ \
+ 3, /* jsr */ \
+ 2, /* ret */ \
+ 99, /* tableswitch */ \
+ 99, /* lookupswitch */ \
+ 1, /* ireturn */ \
+ 1, /* lreturn */ \
+ 1, /* freturn */ \
+ 1, /* dreturn */ \
+ 1, /* areturn */ \
+ 1, /* return */ \
+ 3, /* getstatic */ \
+ 3, /* putstatic */ \
+ 3, /* getfield */ \
+ 3, /* putfield */ \
+ 3, /* invokevirtual */ \
+ 3, /* invokespecial */ \
+ 3, /* invokestatic */ \
+ 5, /* invokeinterface */ \
+ 5, /* invokedynamic */ \
+ 3, /* new */ \
+ 2, /* newarray */ \
+ 3, /* anewarray */ \
+ 1, /* arraylength */ \
+ 1, /* athrow */ \
+ 3, /* checkcast */ \
+ 3, /* instanceof */ \
+ 1, /* monitorenter */ \
+ 1, /* monitorexit */ \
+ 0, /* wide */ \
+ 4, /* multianewarray */ \
+ 3, /* ifnull */ \
+ 3, /* ifnonnull */ \
+ 5, /* goto_w */ \
+ 5 /* jsr_w */ \
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLASSFILE_CONSTANTS */
diff --git a/staging/darwin-x86/include/darwin/jawt_md.h b/staging/darwin-x86/include/darwin/jawt_md.h
new file mode 100644
index 0000000..c6859fd
--- /dev/null
+++ b/staging/darwin-x86/include/darwin/jawt_md.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include "jawt.h"
+
+#ifdef __OBJC__
+#import <QuartzCore/CALayer.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Mac OS X specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+
+/*
+ * When calling JAWT_GetAWT with a JAWT version less than 1.7, you must pass this
+ * flag or you will not be able to get a valid drawing surface and JAWT_GetAWT will
+ * return false. This is to maintain compatibility with applications that used the
+ * interface with Java 6 which had multiple rendering models. This flag is not necessary
+ * when JAWT version 1.7 or greater is used as this is the only supported rendering mode.
+ *
+ * Example:
+ * JAWT awt;
+ * awt.version = JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER;
+ * jboolean success = JAWT_GetAWT(env, &awt);
+ */
+#define JAWT_MACOSX_USE_CALAYER 0x80000000
+
+/*
+ * When the native Cocoa toolkit is in use, the pointer stored in
+ * JAWT_DrawingSurfaceInfo->platformInfo points to a NSObject that conforms to the
+ * JAWT_SurfaceLayers protocol. Setting the layer property of this object will cause the
+ * specified layer to be overlaid on the Components rectangle. If the window the
+ * Component belongs to has a CALayer attached to it, this layer will be accessible via
+ * the windowLayer property.
+ */
+#ifdef __OBJC__
+@protocol JAWT_SurfaceLayers
+@property (readwrite, retain) CALayer *layer;
+@property (readonly) CALayer *windowLayer;
+@end
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
diff --git a/staging/darwin-x86/include/darwin/jni_md.h b/staging/darwin-x86/include/darwin/jni_md.h
new file mode 100644
index 0000000..9e47bed
--- /dev/null
+++ b/staging/darwin-x86/include/darwin/jni_md.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _JAVASOFT_JNI_MD_H_
+#define _JAVASOFT_JNI_MD_H_
+
+#define JNIEXPORT __attribute__((visibility("default")))
+#define JNIIMPORT __attribute__((visibility("default")))
+#define JNICALL
+
+typedef int jint;
+#ifdef _LP64 /* 64-bit */
+typedef long jlong;
+#else
+typedef long long jlong;
+#endif
+
+typedef signed char jbyte;
+
+#endif /* !_JAVASOFT_JNI_MD_H_ */
diff --git a/staging/darwin-x86/include/jawt.h b/staging/darwin-x86/include/jawt.h
new file mode 100644
index 0000000..e0f682f
--- /dev/null
+++ b/staging/darwin-x86/include/jawt.h
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _JAVASOFT_JAWT_H_
+#define _JAVASOFT_JAWT_H_
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * AWT native interface (new in JDK 1.3)
+ *
+ * The AWT native interface allows a native C or C++ application a means
+ * by which to access native structures in AWT. This is to facilitate moving
+ * legacy C and C++ applications to Java and to target the needs of the
+ * community who, at present, wish to do their own native rendering to canvases
+ * for performance reasons. Standard extensions such as Java3D also require a
+ * means to access the underlying native data structures of AWT.
+ *
+ * There may be future extensions to this API depending on demand.
+ *
+ * A VM does not have to implement this API in order to pass the JCK.
+ * It is recommended, however, that this API is implemented on VMs that support
+ * standard extensions, such as Java3D.
+ *
+ * Since this is a native API, any program which uses it cannot be considered
+ * 100% pure java.
+ */
+
+/*
+ * AWT Native Drawing Surface (JAWT_DrawingSurface).
+ *
+ * For each platform, there is a native drawing surface structure. This
+ * platform-specific structure can be found in jawt_md.h. It is recommended
+ * that additional platforms follow the same model. It is also recommended
+ * that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
+ *
+ *******************
+ * EXAMPLE OF USAGE:
+ *******************
+ *
+ * In Win32, a programmer wishes to access the HWND of a canvas to perform
+ * native rendering into it. The programmer has declared the paint() method
+ * for their canvas subclass to be native:
+ *
+ *
+ * MyCanvas.java:
+ *
+ * import java.awt.*;
+ *
+ * public class MyCanvas extends Canvas {
+ *
+ * static {
+ * System.loadLibrary("mylib");
+ * }
+ *
+ * public native void paint(Graphics g);
+ * }
+ *
+ *
+ * myfile.c:
+ *
+ * #include "jawt_md.h"
+ * #include <assert.h>
+ *
+ * JNIEXPORT void JNICALL
+ * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
+ * {
+ * JAWT awt;
+ * JAWT_DrawingSurface* ds;
+ * JAWT_DrawingSurfaceInfo* dsi;
+ * JAWT_Win32DrawingSurfaceInfo* dsi_win;
+ * jboolean result;
+ * jint lock;
+ *
+ * // Get the AWT
+ * awt.version = JAWT_VERSION_1_3;
+ * result = JAWT_GetAWT(env, &awt);
+ * assert(result != JNI_FALSE);
+ *
+ * // Get the drawing surface
+ * ds = awt.GetDrawingSurface(env, canvas);
+ * assert(ds != NULL);
+ *
+ * // Lock the drawing surface
+ * lock = ds->Lock(ds);
+ * assert((lock & JAWT_LOCK_ERROR) == 0);
+ *
+ * // Get the drawing surface info
+ * dsi = ds->GetDrawingSurfaceInfo(ds);
+ *
+ * // Get the platform-specific drawing info
+ * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
+ *
+ * //////////////////////////////
+ * // !!! DO PAINTING HERE !!! //
+ * //////////////////////////////
+ *
+ * // Free the drawing surface info
+ * ds->FreeDrawingSurfaceInfo(dsi);
+ *
+ * // Unlock the drawing surface
+ * ds->Unlock(ds);
+ *
+ * // Free the drawing surface
+ * awt.FreeDrawingSurface(ds);
+ * }
+ *
+ */
+
+/*
+ * JAWT_Rectangle
+ * Structure for a native rectangle.
+ */
+typedef struct jawt_Rectangle {
+ jint x;
+ jint y;
+ jint width;
+ jint height;
+} JAWT_Rectangle;
+
+struct jawt_DrawingSurface;
+
+/*
+ * JAWT_DrawingSurfaceInfo
+ * Structure for containing the underlying drawing information of a component.
+ */
+typedef struct jawt_DrawingSurfaceInfo {
+ /*
+ * Pointer to the platform-specific information. This can be safely
+ * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
+ * JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a
+ * pointer to a NSObject that conforms to the JAWT_SurfaceLayers
+ * protocol. See jawt_md.h for details.
+ */
+ void* platformInfo;
+ /* Cached pointer to the underlying drawing surface */
+ struct jawt_DrawingSurface* ds;
+ /* Bounding rectangle of the drawing surface */
+ JAWT_Rectangle bounds;
+ /* Number of rectangles in the clip */
+ jint clipSize;
+ /* Clip rectangle array */
+ JAWT_Rectangle* clip;
+} JAWT_DrawingSurfaceInfo;
+
+#define JAWT_LOCK_ERROR 0x00000001
+#define JAWT_LOCK_CLIP_CHANGED 0x00000002
+#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
+#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
+
+/*
+ * JAWT_DrawingSurface
+ * Structure for containing the underlying drawing information of a component.
+ * All operations on a JAWT_DrawingSurface MUST be performed from the same
+ * thread as the call to GetDrawingSurface.
+ */
+typedef struct jawt_DrawingSurface {
+ /*
+ * Cached reference to the Java environment of the calling thread.
+ * If Lock(), Unlock(), GetDrawingSurfaceInfo() or
+ * FreeDrawingSurfaceInfo() are called from a different thread,
+ * this data member should be set before calling those functions.
+ */
+ JNIEnv* env;
+ /* Cached reference to the target object */
+ jobject target;
+ /*
+ * Lock the surface of the target component for native rendering.
+ * When finished drawing, the surface must be unlocked with
+ * Unlock(). This function returns a bitmask with one or more of the
+ * following values:
+ *
+ * JAWT_LOCK_ERROR - When an error has occurred and the surface could not
+ * be locked.
+ *
+ * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
+ *
+ * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
+ *
+ * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
+ */
+ jint (JNICALL *Lock)
+ (struct jawt_DrawingSurface* ds);
+ /*
+ * Get the drawing surface info.
+ * The value returned may be cached, but the values may change if
+ * additional calls to Lock() or Unlock() are made.
+ * Lock() must be called before this can return a valid value.
+ * Returns NULL if an error has occurred.
+ * When finished with the returned value, FreeDrawingSurfaceInfo must be
+ * called.
+ */
+ JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
+ (struct jawt_DrawingSurface* ds);
+ /*
+ * Free the drawing surface info.
+ */
+ void (JNICALL *FreeDrawingSurfaceInfo)
+ (JAWT_DrawingSurfaceInfo* dsi);
+ /*
+ * Unlock the drawing surface of the target component for native rendering.
+ */
+ void (JNICALL *Unlock)
+ (struct jawt_DrawingSurface* ds);
+} JAWT_DrawingSurface;
+
+/*
+ * JAWT
+ * Structure for containing native AWT functions.
+ */
+typedef struct jawt {
+ /*
+ * Version of this structure. This must always be set before
+ * calling JAWT_GetAWT()
+ */
+ jint version;
+ /*
+ * Return a drawing surface from a target jobject. This value
+ * may be cached.
+ * Returns NULL if an error has occurred.
+ * Target must be a java.awt.Component (should be a Canvas
+ * or Window for native rendering).
+ * FreeDrawingSurface() must be called when finished with the
+ * returned JAWT_DrawingSurface.
+ */
+ JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
+ (JNIEnv* env, jobject target);
+ /*
+ * Free the drawing surface allocated in GetDrawingSurface.
+ */
+ void (JNICALL *FreeDrawingSurface)
+ (JAWT_DrawingSurface* ds);
+ /*
+ * Since 1.4
+ * Locks the entire AWT for synchronization purposes
+ */
+ void (JNICALL *Lock)(JNIEnv* env);
+ /*
+ * Since 1.4
+ * Unlocks the entire AWT for synchronization purposes
+ */
+ void (JNICALL *Unlock)(JNIEnv* env);
+ /*
+ * Since 1.4
+ * Returns a reference to a java.awt.Component from a native
+ * platform handle. On Windows, this corresponds to an HWND;
+ * on Solaris and Linux, this is a Drawable. For other platforms,
+ * see the appropriate machine-dependent header file for a description.
+ * The reference returned by this function is a local
+ * reference that is only valid in this environment.
+ * This function returns a NULL reference if no component could be
+ * found with matching platform information.
+ */
+ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
+
+} JAWT;
+
+/*
+ * Get the AWT native structure. This function returns JNI_FALSE if
+ * an error occurs.
+ */
+_JNI_IMPORT_OR_EXPORT_
+jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
+
+#define JAWT_VERSION_1_3 0x00010003
+#define JAWT_VERSION_1_4 0x00010004
+#define JAWT_VERSION_1_7 0x00010007
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !_JAVASOFT_JAWT_H_ */
diff --git a/staging/darwin-x86/include/jdwpTransport.h b/staging/darwin-x86/include/jdwpTransport.h
new file mode 100644
index 0000000..32ccdea
--- /dev/null
+++ b/staging/darwin-x86/include/jdwpTransport.h
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Java Debug Wire Protocol Transport Service Provider Interface.
+ */
+
+#ifndef JDWPTRANSPORT_H
+#define JDWPTRANSPORT_H
+
+#include "jni.h"
+
+enum {
+ JDWPTRANSPORT_VERSION_1_0 = 0x00010000
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct jdwpTransportNativeInterface_;
+
+struct _jdwpTransportEnv;
+
+#ifdef __cplusplus
+typedef _jdwpTransportEnv jdwpTransportEnv;
+#else
+typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
+#endif /* __cplusplus */
+
+/*
+ * Errors. Universal errors with JVMTI/JVMDI equivalents keep the
+ * values the same.
+ */
+typedef enum {
+ JDWPTRANSPORT_ERROR_NONE = 0,
+ JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
+ JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
+ JDWPTRANSPORT_ERROR_INTERNAL = 113,
+ JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
+ JDWPTRANSPORT_ERROR_IO_ERROR = 202,
+ JDWPTRANSPORT_ERROR_TIMEOUT = 203,
+ JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
+} jdwpTransportError;
+
+
+/*
+ * Structure to define capabilities
+ */
+typedef struct {
+ unsigned int can_timeout_attach :1;
+ unsigned int can_timeout_accept :1;
+ unsigned int can_timeout_handshake :1;
+ unsigned int reserved3 :1;
+ unsigned int reserved4 :1;
+ unsigned int reserved5 :1;
+ unsigned int reserved6 :1;
+ unsigned int reserved7 :1;
+ unsigned int reserved8 :1;
+ unsigned int reserved9 :1;
+ unsigned int reserved10 :1;
+ unsigned int reserved11 :1;
+ unsigned int reserved12 :1;
+ unsigned int reserved13 :1;
+ unsigned int reserved14 :1;
+ unsigned int reserved15 :1;
+} JDWPTransportCapabilities;
+
+
+/*
+ * Structures to define packet layout.
+ *
+ * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
+ */
+
+enum {
+ /*
+ * If additional flags are added that apply to jdwpCmdPacket,
+ * then debugLoop.c: reader() will need to be updated to
+ * accept more than JDWPTRANSPORT_FLAGS_NONE.
+ */
+ JDWPTRANSPORT_FLAGS_NONE = 0x0,
+ JDWPTRANSPORT_FLAGS_REPLY = 0x80
+};
+
+typedef struct {
+ jint len;
+ jint id;
+ jbyte flags;
+ jbyte cmdSet;
+ jbyte cmd;
+ jbyte *data;
+} jdwpCmdPacket;
+
+typedef struct {
+ jint len;
+ jint id;
+ jbyte flags;
+ jshort errorCode;
+ jbyte *data;
+} jdwpReplyPacket;
+
+typedef struct {
+ union {
+ jdwpCmdPacket cmd;
+ jdwpReplyPacket reply;
+ } type;
+} jdwpPacket;
+
+/*
+ * JDWP functions called by the transport.
+ */
+typedef struct jdwpTransportCallback {
+ void *(*alloc)(jint numBytes); /* Call this for all allocations */
+ void (*free)(void *buffer); /* Call this for all deallocations */
+} jdwpTransportCallback;
+
+typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
+ jdwpTransportCallback *callback,
+ jint version,
+ jdwpTransportEnv** env);
+
+
+
+/* Function Interface */
+
+struct jdwpTransportNativeInterface_ {
+ /* 1 : RESERVED */
+ void *reserved1;
+
+ /* 2 : Get Capabilities */
+ jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
+ JDWPTransportCapabilities *capabilities_ptr);
+
+ /* 3 : Attach */
+ jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
+ const char* address,
+ jlong attach_timeout,
+ jlong handshake_timeout);
+
+ /* 4: StartListening */
+ jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
+ const char* address,
+ char** actual_address);
+
+ /* 5: StopListening */
+ jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
+
+ /* 6: Accept */
+ jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
+ jlong accept_timeout,
+ jlong handshake_timeout);
+
+ /* 7: IsOpen */
+ jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
+
+ /* 8: Close */
+ jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
+
+ /* 9: ReadPacket */
+ jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
+ jdwpPacket *pkt);
+
+ /* 10: Write Packet */
+ jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
+ const jdwpPacket* pkt);
+
+ /* 11: GetLastError */
+ jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
+ char** error);
+
+};
+
+
+/*
+ * Use inlined functions so that C++ code can use syntax such as
+ * env->Attach("mymachine:5000", 10*1000, 0);
+ *
+ * rather than using C's :-
+ *
+ * (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
+ */
+struct _jdwpTransportEnv {
+ const struct jdwpTransportNativeInterface_ *functions;
+#ifdef __cplusplus
+
+ jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
+ return functions->GetCapabilities(this, capabilities_ptr);
+ }
+
+ jdwpTransportError Attach(const char* address, jlong attach_timeout,
+ jlong handshake_timeout) {
+ return functions->Attach(this, address, attach_timeout, handshake_timeout);
+ }
+
+ jdwpTransportError StartListening(const char* address,
+ char** actual_address) {
+ return functions->StartListening(this, address, actual_address);
+ }
+
+ jdwpTransportError StopListening(void) {
+ return functions->StopListening(this);
+ }
+
+ jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
+ return functions->Accept(this, accept_timeout, handshake_timeout);
+ }
+
+ jboolean IsOpen(void) {
+ return functions->IsOpen(this);
+ }
+
+ jdwpTransportError Close(void) {
+ return functions->Close(this);
+ }
+
+ jdwpTransportError ReadPacket(jdwpPacket *pkt) {
+ return functions->ReadPacket(this, pkt);
+ }
+
+ jdwpTransportError WritePacket(const jdwpPacket* pkt) {
+ return functions->WritePacket(this, pkt);
+ }
+
+ jdwpTransportError GetLastError(char** error) {
+ return functions->GetLastError(this, error);
+ }
+
+
+#endif /* __cplusplus */
+};
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* JDWPTRANSPORT_H */
diff --git a/staging/darwin-x86/include/jni.h b/staging/darwin-x86/include/jni.h
new file mode 100644
index 0000000..2e83cb7
--- /dev/null
+++ b/staging/darwin-x86/include/jni.h
@@ -0,0 +1,1960 @@
+/*
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * We used part of Netscape's Java Runtime Interface (JRI) as the starting
+ * point of our design and implementation.
+ */
+
+/******************************************************************************
+ * Java Runtime Interface
+ * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
+ *****************************************************************************/
+
+#ifndef _JAVASOFT_JNI_H_
+#define _JAVASOFT_JNI_H_
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/* jni_md.h contains the machine-dependent typedefs for jbyte, jint
+ and jlong */
+
+#include "jni_md.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * JNI Types
+ */
+
+#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H
+
+typedef unsigned char jboolean;
+typedef unsigned short jchar;
+typedef short jshort;
+typedef float jfloat;
+typedef double jdouble;
+
+typedef jint jsize;
+
+#ifdef __cplusplus
+
+class _jobject {};
+class _jclass : public _jobject {};
+class _jthrowable : public _jobject {};
+class _jstring : public _jobject {};
+class _jarray : public _jobject {};
+class _jbooleanArray : public _jarray {};
+class _jbyteArray : public _jarray {};
+class _jcharArray : public _jarray {};
+class _jshortArray : public _jarray {};
+class _jintArray : public _jarray {};
+class _jlongArray : public _jarray {};
+class _jfloatArray : public _jarray {};
+class _jdoubleArray : public _jarray {};
+class _jobjectArray : public _jarray {};
+
+typedef _jobject *jobject;
+typedef _jclass *jclass;
+typedef _jthrowable *jthrowable;
+typedef _jstring *jstring;
+typedef _jarray *jarray;
+typedef _jbooleanArray *jbooleanArray;
+typedef _jbyteArray *jbyteArray;
+typedef _jcharArray *jcharArray;
+typedef _jshortArray *jshortArray;
+typedef _jintArray *jintArray;
+typedef _jlongArray *jlongArray;
+typedef _jfloatArray *jfloatArray;
+typedef _jdoubleArray *jdoubleArray;
+typedef _jobjectArray *jobjectArray;
+
+#else
+
+struct _jobject;
+
+typedef struct _jobject *jobject;
+typedef jobject jclass;
+typedef jobject jthrowable;
+typedef jobject jstring;
+typedef jobject jarray;
+typedef jarray jbooleanArray;
+typedef jarray jbyteArray;
+typedef jarray jcharArray;
+typedef jarray jshortArray;
+typedef jarray jintArray;
+typedef jarray jlongArray;
+typedef jarray jfloatArray;
+typedef jarray jdoubleArray;
+typedef jarray jobjectArray;
+
+#endif
+
+typedef jobject jweak;
+
+typedef union jvalue {
+ jboolean z;
+ jbyte b;
+ jchar c;
+ jshort s;
+ jint i;
+ jlong j;
+ jfloat f;
+ jdouble d;
+ jobject l;
+} jvalue;
+
+struct _jfieldID;
+typedef struct _jfieldID *jfieldID;
+
+struct _jmethodID;
+typedef struct _jmethodID *jmethodID;
+
+/* Return values from jobjectRefType */
+typedef enum _jobjectType {
+ JNIInvalidRefType = 0,
+ JNILocalRefType = 1,
+ JNIGlobalRefType = 2,
+ JNIWeakGlobalRefType = 3
+} jobjectRefType;
+
+
+#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */
+
+/*
+ * jboolean constants
+ */
+
+#define JNI_FALSE 0
+#define JNI_TRUE 1
+
+/*
+ * possible return values for JNI functions.
+ */
+
+#define JNI_OK 0 /* success */
+#define JNI_ERR (-1) /* unknown error */
+#define JNI_EDETACHED (-2) /* thread detached from the VM */
+#define JNI_EVERSION (-3) /* JNI version error */
+#define JNI_ENOMEM (-4) /* not enough memory */
+#define JNI_EEXIST (-5) /* VM already created */
+#define JNI_EINVAL (-6) /* invalid arguments */
+
+/*
+ * used in ReleaseScalarArrayElements
+ */
+
+#define JNI_COMMIT 1
+#define JNI_ABORT 2
+
+/*
+ * used in RegisterNatives to describe native method name, signature,
+ * and function pointer.
+ */
+
+typedef struct {
+ char *name;
+ char *signature;
+ void *fnPtr;
+} JNINativeMethod;
+
+/*
+ * JNI Native Method Interface.
+ */
+
+struct JNINativeInterface_;
+
+struct JNIEnv_;
+
+#ifdef __cplusplus
+typedef JNIEnv_ JNIEnv;
+#else
+typedef const struct JNINativeInterface_ *JNIEnv;
+#endif
+
+/*
+ * JNI Invocation Interface.
+ */
+
+struct JNIInvokeInterface_;
+
+struct JavaVM_;
+
+#ifdef __cplusplus
+typedef JavaVM_ JavaVM;
+#else
+typedef const struct JNIInvokeInterface_ *JavaVM;
+#endif
+
+struct JNINativeInterface_ {
+ void *reserved0;
+ void *reserved1;
+ void *reserved2;
+
+ void *reserved3;
+ jint (JNICALL *GetVersion)(JNIEnv *env);
+
+ jclass (JNICALL *DefineClass)
+ (JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
+ jsize len);
+ jclass (JNICALL *FindClass)
+ (JNIEnv *env, const char *name);
+
+ jmethodID (JNICALL *FromReflectedMethod)
+ (JNIEnv *env, jobject method);
+ jfieldID (JNICALL *FromReflectedField)
+ (JNIEnv *env, jobject field);
+
+ jobject (JNICALL *ToReflectedMethod)
+ (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic);
+
+ jclass (JNICALL *GetSuperclass)
+ (JNIEnv *env, jclass sub);
+ jboolean (JNICALL *IsAssignableFrom)
+ (JNIEnv *env, jclass sub, jclass sup);
+
+ jobject (JNICALL *ToReflectedField)
+ (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic);
+
+ jint (JNICALL *Throw)
+ (JNIEnv *env, jthrowable obj);
+ jint (JNICALL *ThrowNew)
+ (JNIEnv *env, jclass clazz, const char *msg);
+ jthrowable (JNICALL *ExceptionOccurred)
+ (JNIEnv *env);
+ void (JNICALL *ExceptionDescribe)
+ (JNIEnv *env);
+ void (JNICALL *ExceptionClear)
+ (JNIEnv *env);
+ void (JNICALL *FatalError)
+ (JNIEnv *env, const char *msg);
+
+ jint (JNICALL *PushLocalFrame)
+ (JNIEnv *env, jint capacity);
+ jobject (JNICALL *PopLocalFrame)
+ (JNIEnv *env, jobject result);
+
+ jobject (JNICALL *NewGlobalRef)
+ (JNIEnv *env, jobject lobj);
+ void (JNICALL *DeleteGlobalRef)
+ (JNIEnv *env, jobject gref);
+ void (JNICALL *DeleteLocalRef)
+ (JNIEnv *env, jobject obj);
+ jboolean (JNICALL *IsSameObject)
+ (JNIEnv *env, jobject obj1, jobject obj2);
+ jobject (JNICALL *NewLocalRef)
+ (JNIEnv *env, jobject ref);
+ jint (JNICALL *EnsureLocalCapacity)
+ (JNIEnv *env, jint capacity);
+
+ jobject (JNICALL *AllocObject)
+ (JNIEnv *env, jclass clazz);
+ jobject (JNICALL *NewObject)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *NewObjectV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jobject (JNICALL *NewObjectA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jclass (JNICALL *GetObjectClass)
+ (JNIEnv *env, jobject obj);
+ jboolean (JNICALL *IsInstanceOf)
+ (JNIEnv *env, jobject obj, jclass clazz);
+
+ jmethodID (JNICALL *GetMethodID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *CallObjectMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jobject (JNICALL *CallObjectMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jobject (JNICALL *CallObjectMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jboolean (JNICALL *CallBooleanMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jboolean (JNICALL *CallBooleanMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jboolean (JNICALL *CallBooleanMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jbyte (JNICALL *CallByteMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jbyte (JNICALL *CallByteMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jbyte (JNICALL *CallByteMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jchar (JNICALL *CallCharMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jchar (JNICALL *CallCharMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jchar (JNICALL *CallCharMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jshort (JNICALL *CallShortMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jshort (JNICALL *CallShortMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jshort (JNICALL *CallShortMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jint (JNICALL *CallIntMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jint (JNICALL *CallIntMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jint (JNICALL *CallIntMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jlong (JNICALL *CallLongMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jlong (JNICALL *CallLongMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jlong (JNICALL *CallLongMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jfloat (JNICALL *CallFloatMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jfloat (JNICALL *CallFloatMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jfloat (JNICALL *CallFloatMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jdouble (JNICALL *CallDoubleMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jdouble (JNICALL *CallDoubleMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jdouble (JNICALL *CallDoubleMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ void (JNICALL *CallVoidMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ void (JNICALL *CallVoidMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ void (JNICALL *CallVoidMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jobject (JNICALL *CallNonvirtualObjectMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *CallNonvirtualObjectMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jobject (JNICALL *CallNonvirtualObjectMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jboolean (JNICALL *CallNonvirtualBooleanMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jbyte (JNICALL *CallNonvirtualByteMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jbyte (JNICALL *CallNonvirtualByteMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jbyte (JNICALL *CallNonvirtualByteMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jchar (JNICALL *CallNonvirtualCharMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jchar (JNICALL *CallNonvirtualCharMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jchar (JNICALL *CallNonvirtualCharMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jshort (JNICALL *CallNonvirtualShortMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jshort (JNICALL *CallNonvirtualShortMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jshort (JNICALL *CallNonvirtualShortMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jint (JNICALL *CallNonvirtualIntMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jint (JNICALL *CallNonvirtualIntMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jint (JNICALL *CallNonvirtualIntMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jlong (JNICALL *CallNonvirtualLongMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jlong (JNICALL *CallNonvirtualLongMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jlong (JNICALL *CallNonvirtualLongMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jfloat (JNICALL *CallNonvirtualFloatMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jfloat (JNICALL *CallNonvirtualFloatMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jfloat (JNICALL *CallNonvirtualFloatMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jdouble (JNICALL *CallNonvirtualDoubleMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ void (JNICALL *CallNonvirtualVoidMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ void (JNICALL *CallNonvirtualVoidMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ void (JNICALL *CallNonvirtualVoidMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jfieldID (JNICALL *GetFieldID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *GetObjectField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jboolean (JNICALL *GetBooleanField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jbyte (JNICALL *GetByteField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jchar (JNICALL *GetCharField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jshort (JNICALL *GetShortField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jint (JNICALL *GetIntField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jlong (JNICALL *GetLongField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jfloat (JNICALL *GetFloatField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jdouble (JNICALL *GetDoubleField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+
+ void (JNICALL *SetObjectField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val);
+ void (JNICALL *SetBooleanField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val);
+ void (JNICALL *SetByteField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val);
+ void (JNICALL *SetCharField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val);
+ void (JNICALL *SetShortField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val);
+ void (JNICALL *SetIntField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jint val);
+ void (JNICALL *SetLongField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val);
+ void (JNICALL *SetFloatField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val);
+ void (JNICALL *SetDoubleField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val);
+
+ jmethodID (JNICALL *GetStaticMethodID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *CallStaticObjectMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *CallStaticObjectMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jobject (JNICALL *CallStaticObjectMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jboolean (JNICALL *CallStaticBooleanMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jboolean (JNICALL *CallStaticBooleanMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jboolean (JNICALL *CallStaticBooleanMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jbyte (JNICALL *CallStaticByteMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jbyte (JNICALL *CallStaticByteMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jbyte (JNICALL *CallStaticByteMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jchar (JNICALL *CallStaticCharMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jchar (JNICALL *CallStaticCharMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jchar (JNICALL *CallStaticCharMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jshort (JNICALL *CallStaticShortMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jshort (JNICALL *CallStaticShortMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jshort (JNICALL *CallStaticShortMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jint (JNICALL *CallStaticIntMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jint (JNICALL *CallStaticIntMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jint (JNICALL *CallStaticIntMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jlong (JNICALL *CallStaticLongMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jlong (JNICALL *CallStaticLongMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jlong (JNICALL *CallStaticLongMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jfloat (JNICALL *CallStaticFloatMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jfloat (JNICALL *CallStaticFloatMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jfloat (JNICALL *CallStaticFloatMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jdouble (JNICALL *CallStaticDoubleMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jdouble (JNICALL *CallStaticDoubleMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jdouble (JNICALL *CallStaticDoubleMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ void (JNICALL *CallStaticVoidMethod)
+ (JNIEnv *env, jclass cls, jmethodID methodID, ...);
+ void (JNICALL *CallStaticVoidMethodV)
+ (JNIEnv *env, jclass cls, jmethodID methodID, va_list args);
+ void (JNICALL *CallStaticVoidMethodA)
+ (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args);
+
+ jfieldID (JNICALL *GetStaticFieldID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+ jobject (JNICALL *GetStaticObjectField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jboolean (JNICALL *GetStaticBooleanField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jbyte (JNICALL *GetStaticByteField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jchar (JNICALL *GetStaticCharField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jshort (JNICALL *GetStaticShortField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jint (JNICALL *GetStaticIntField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jlong (JNICALL *GetStaticLongField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jfloat (JNICALL *GetStaticFloatField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jdouble (JNICALL *GetStaticDoubleField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+
+ void (JNICALL *SetStaticObjectField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value);
+ void (JNICALL *SetStaticBooleanField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value);
+ void (JNICALL *SetStaticByteField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value);
+ void (JNICALL *SetStaticCharField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value);
+ void (JNICALL *SetStaticShortField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value);
+ void (JNICALL *SetStaticIntField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value);
+ void (JNICALL *SetStaticLongField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value);
+ void (JNICALL *SetStaticFloatField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value);
+ void (JNICALL *SetStaticDoubleField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value);
+
+ jstring (JNICALL *NewString)
+ (JNIEnv *env, const jchar *unicode, jsize len);
+ jsize (JNICALL *GetStringLength)
+ (JNIEnv *env, jstring str);
+ const jchar *(JNICALL *GetStringChars)
+ (JNIEnv *env, jstring str, jboolean *isCopy);
+ void (JNICALL *ReleaseStringChars)
+ (JNIEnv *env, jstring str, const jchar *chars);
+
+ jstring (JNICALL *NewStringUTF)
+ (JNIEnv *env, const char *utf);
+ jsize (JNICALL *GetStringUTFLength)
+ (JNIEnv *env, jstring str);
+ const char* (JNICALL *GetStringUTFChars)
+ (JNIEnv *env, jstring str, jboolean *isCopy);
+ void (JNICALL *ReleaseStringUTFChars)
+ (JNIEnv *env, jstring str, const char* chars);
+
+
+ jsize (JNICALL *GetArrayLength)
+ (JNIEnv *env, jarray array);
+
+ jobjectArray (JNICALL *NewObjectArray)
+ (JNIEnv *env, jsize len, jclass clazz, jobject init);
+ jobject (JNICALL *GetObjectArrayElement)
+ (JNIEnv *env, jobjectArray array, jsize index);
+ void (JNICALL *SetObjectArrayElement)
+ (JNIEnv *env, jobjectArray array, jsize index, jobject val);
+
+ jbooleanArray (JNICALL *NewBooleanArray)
+ (JNIEnv *env, jsize len);
+ jbyteArray (JNICALL *NewByteArray)
+ (JNIEnv *env, jsize len);
+ jcharArray (JNICALL *NewCharArray)
+ (JNIEnv *env, jsize len);
+ jshortArray (JNICALL *NewShortArray)
+ (JNIEnv *env, jsize len);
+ jintArray (JNICALL *NewIntArray)
+ (JNIEnv *env, jsize len);
+ jlongArray (JNICALL *NewLongArray)
+ (JNIEnv *env, jsize len);
+ jfloatArray (JNICALL *NewFloatArray)
+ (JNIEnv *env, jsize len);
+ jdoubleArray (JNICALL *NewDoubleArray)
+ (JNIEnv *env, jsize len);
+
+ jboolean * (JNICALL *GetBooleanArrayElements)
+ (JNIEnv *env, jbooleanArray array, jboolean *isCopy);
+ jbyte * (JNICALL *GetByteArrayElements)
+ (JNIEnv *env, jbyteArray array, jboolean *isCopy);
+ jchar * (JNICALL *GetCharArrayElements)
+ (JNIEnv *env, jcharArray array, jboolean *isCopy);
+ jshort * (JNICALL *GetShortArrayElements)
+ (JNIEnv *env, jshortArray array, jboolean *isCopy);
+ jint * (JNICALL *GetIntArrayElements)
+ (JNIEnv *env, jintArray array, jboolean *isCopy);
+ jlong * (JNICALL *GetLongArrayElements)
+ (JNIEnv *env, jlongArray array, jboolean *isCopy);
+ jfloat * (JNICALL *GetFloatArrayElements)
+ (JNIEnv *env, jfloatArray array, jboolean *isCopy);
+ jdouble * (JNICALL *GetDoubleArrayElements)
+ (JNIEnv *env, jdoubleArray array, jboolean *isCopy);
+
+ void (JNICALL *ReleaseBooleanArrayElements)
+ (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode);
+ void (JNICALL *ReleaseByteArrayElements)
+ (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode);
+ void (JNICALL *ReleaseCharArrayElements)
+ (JNIEnv *env, jcharArray array, jchar *elems, jint mode);
+ void (JNICALL *ReleaseShortArrayElements)
+ (JNIEnv *env, jshortArray array, jshort *elems, jint mode);
+ void (JNICALL *ReleaseIntArrayElements)
+ (JNIEnv *env, jintArray array, jint *elems, jint mode);
+ void (JNICALL *ReleaseLongArrayElements)
+ (JNIEnv *env, jlongArray array, jlong *elems, jint mode);
+ void (JNICALL *ReleaseFloatArrayElements)
+ (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode);
+ void (JNICALL *ReleaseDoubleArrayElements)
+ (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode);
+
+ void (JNICALL *GetBooleanArrayRegion)
+ (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf);
+ void (JNICALL *GetByteArrayRegion)
+ (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf);
+ void (JNICALL *GetCharArrayRegion)
+ (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf);
+ void (JNICALL *GetShortArrayRegion)
+ (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf);
+ void (JNICALL *GetIntArrayRegion)
+ (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf);
+ void (JNICALL *GetLongArrayRegion)
+ (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf);
+ void (JNICALL *GetFloatArrayRegion)
+ (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf);
+ void (JNICALL *GetDoubleArrayRegion)
+ (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf);
+
+ void (JNICALL *SetBooleanArrayRegion)
+ (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf);
+ void (JNICALL *SetByteArrayRegion)
+ (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf);
+ void (JNICALL *SetCharArrayRegion)
+ (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf);
+ void (JNICALL *SetShortArrayRegion)
+ (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf);
+ void (JNICALL *SetIntArrayRegion)
+ (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf);
+ void (JNICALL *SetLongArrayRegion)
+ (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf);
+ void (JNICALL *SetFloatArrayRegion)
+ (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf);
+ void (JNICALL *SetDoubleArrayRegion)
+ (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf);
+
+ jint (JNICALL *RegisterNatives)
+ (JNIEnv *env, jclass clazz, const JNINativeMethod *methods,
+ jint nMethods);
+ jint (JNICALL *UnregisterNatives)
+ (JNIEnv *env, jclass clazz);
+
+ jint (JNICALL *MonitorEnter)
+ (JNIEnv *env, jobject obj);
+ jint (JNICALL *MonitorExit)
+ (JNIEnv *env, jobject obj);
+
+ jint (JNICALL *GetJavaVM)
+ (JNIEnv *env, JavaVM **vm);
+
+ void (JNICALL *GetStringRegion)
+ (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf);
+ void (JNICALL *GetStringUTFRegion)
+ (JNIEnv *env, jstring str, jsize start, jsize len, char *buf);
+
+ void * (JNICALL *GetPrimitiveArrayCritical)
+ (JNIEnv *env, jarray array, jboolean *isCopy);
+ void (JNICALL *ReleasePrimitiveArrayCritical)
+ (JNIEnv *env, jarray array, void *carray, jint mode);
+
+ const jchar * (JNICALL *GetStringCritical)
+ (JNIEnv *env, jstring string, jboolean *isCopy);
+ void (JNICALL *ReleaseStringCritical)
+ (JNIEnv *env, jstring string, const jchar *cstring);
+
+ jweak (JNICALL *NewWeakGlobalRef)
+ (JNIEnv *env, jobject obj);
+ void (JNICALL *DeleteWeakGlobalRef)
+ (JNIEnv *env, jweak ref);
+
+ jboolean (JNICALL *ExceptionCheck)
+ (JNIEnv *env);
+
+ jobject (JNICALL *NewDirectByteBuffer)
+ (JNIEnv* env, void* address, jlong capacity);
+ void* (JNICALL *GetDirectBufferAddress)
+ (JNIEnv* env, jobject buf);
+ jlong (JNICALL *GetDirectBufferCapacity)
+ (JNIEnv* env, jobject buf);
+
+ /* New JNI 1.6 Features */
+
+ jobjectRefType (JNICALL *GetObjectRefType)
+ (JNIEnv* env, jobject obj);
+};
+
+/*
+ * We use inlined functions for C++ so that programmers can write:
+ *
+ * env->FindClass("java/lang/String")
+ *
+ * in C++ rather than:
+ *
+ * (*env)->FindClass(env, "java/lang/String")
+ *
+ * in C.
+ */
+
+struct JNIEnv_ {
+ const struct JNINativeInterface_ *functions;
+#ifdef __cplusplus
+
+ jint GetVersion() {
+ return functions->GetVersion(this);
+ }
+ jclass DefineClass(const char *name, jobject loader, const jbyte *buf,
+ jsize len) {
+ return functions->DefineClass(this, name, loader, buf, len);
+ }
+ jclass FindClass(const char *name) {
+ return functions->FindClass(this, name);
+ }
+ jmethodID FromReflectedMethod(jobject method) {
+ return functions->FromReflectedMethod(this,method);
+ }
+ jfieldID FromReflectedField(jobject field) {
+ return functions->FromReflectedField(this,field);
+ }
+
+ jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) {
+ return functions->ToReflectedMethod(this, cls, methodID, isStatic);
+ }
+
+ jclass GetSuperclass(jclass sub) {
+ return functions->GetSuperclass(this, sub);
+ }
+ jboolean IsAssignableFrom(jclass sub, jclass sup) {
+ return functions->IsAssignableFrom(this, sub, sup);
+ }
+
+ jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) {
+ return functions->ToReflectedField(this,cls,fieldID,isStatic);
+ }
+
+ jint Throw(jthrowable obj) {
+ return functions->Throw(this, obj);
+ }
+ jint ThrowNew(jclass clazz, const char *msg) {
+ return functions->ThrowNew(this, clazz, msg);
+ }
+ jthrowable ExceptionOccurred() {
+ return functions->ExceptionOccurred(this);
+ }
+ void ExceptionDescribe() {
+ functions->ExceptionDescribe(this);
+ }
+ void ExceptionClear() {
+ functions->ExceptionClear(this);
+ }
+ void FatalError(const char *msg) {
+ functions->FatalError(this, msg);
+ }
+
+ jint PushLocalFrame(jint capacity) {
+ return functions->PushLocalFrame(this,capacity);
+ }
+ jobject PopLocalFrame(jobject result) {
+ return functions->PopLocalFrame(this,result);
+ }
+
+ jobject NewGlobalRef(jobject lobj) {
+ return functions->NewGlobalRef(this,lobj);
+ }
+ void DeleteGlobalRef(jobject gref) {
+ functions->DeleteGlobalRef(this,gref);
+ }
+ void DeleteLocalRef(jobject obj) {
+ functions->DeleteLocalRef(this, obj);
+ }
+
+ jboolean IsSameObject(jobject obj1, jobject obj2) {
+ return functions->IsSameObject(this,obj1,obj2);
+ }
+
+ jobject NewLocalRef(jobject ref) {
+ return functions->NewLocalRef(this,ref);
+ }
+ jint EnsureLocalCapacity(jint capacity) {
+ return functions->EnsureLocalCapacity(this,capacity);
+ }
+
+ jobject AllocObject(jclass clazz) {
+ return functions->AllocObject(this,clazz);
+ }
+ jobject NewObject(jclass clazz, jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args, methodID);
+ result = functions->NewObjectV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject NewObjectV(jclass clazz, jmethodID methodID,
+ va_list args) {
+ return functions->NewObjectV(this,clazz,methodID,args);
+ }
+ jobject NewObjectA(jclass clazz, jmethodID methodID,
+ const jvalue *args) {
+ return functions->NewObjectA(this,clazz,methodID,args);
+ }
+
+ jclass GetObjectClass(jobject obj) {
+ return functions->GetObjectClass(this,obj);
+ }
+ jboolean IsInstanceOf(jobject obj, jclass clazz) {
+ return functions->IsInstanceOf(this,obj,clazz);
+ }
+
+ jmethodID GetMethodID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetMethodID(this,clazz,name,sig);
+ }
+
+ jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallObjectMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallObjectMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallObjectMethodV(this,obj,methodID,args);
+ }
+ jobject CallObjectMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallObjectMethodA(this,obj,methodID,args);
+ }
+
+ jboolean CallBooleanMethod(jobject obj,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallBooleanMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallBooleanMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallBooleanMethodV(this,obj,methodID,args);
+ }
+ jboolean CallBooleanMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallBooleanMethodA(this,obj,methodID, args);
+ }
+
+ jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallByteMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallByteMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallByteMethodV(this,obj,methodID,args);
+ }
+ jbyte CallByteMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallByteMethodA(this,obj,methodID,args);
+ }
+
+ jchar CallCharMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallCharMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallCharMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallCharMethodV(this,obj,methodID,args);
+ }
+ jchar CallCharMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallCharMethodA(this,obj,methodID,args);
+ }
+
+ jshort CallShortMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallShortMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallShortMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallShortMethodV(this,obj,methodID,args);
+ }
+ jshort CallShortMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallShortMethodA(this,obj,methodID,args);
+ }
+
+ jint CallIntMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallIntMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallIntMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallIntMethodV(this,obj,methodID,args);
+ }
+ jint CallIntMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallIntMethodA(this,obj,methodID,args);
+ }
+
+ jlong CallLongMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallLongMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallLongMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallLongMethodV(this,obj,methodID,args);
+ }
+ jlong CallLongMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallLongMethodA(this,obj,methodID,args);
+ }
+
+ jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallFloatMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallFloatMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallFloatMethodV(this,obj,methodID,args);
+ }
+ jfloat CallFloatMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallFloatMethodA(this,obj,methodID,args);
+ }
+
+ jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallDoubleMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallDoubleMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallDoubleMethodV(this,obj,methodID,args);
+ }
+ jdouble CallDoubleMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallDoubleMethodA(this,obj,methodID,args);
+ }
+
+ void CallVoidMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallVoidMethodV(this,obj,methodID,args);
+ va_end(args);
+ }
+ void CallVoidMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ functions->CallVoidMethodV(this,obj,methodID,args);
+ }
+ void CallVoidMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ functions->CallVoidMethodA(this,obj,methodID,args);
+ }
+
+ jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualObjectMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualBooleanMethodA(this,obj,clazz,
+ methodID, args);
+ }
+
+ jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualByteMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualByteMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jchar CallNonvirtualCharMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualCharMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualCharMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jshort CallNonvirtualShortMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualShortMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualShortMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jint CallNonvirtualIntMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallNonvirtualIntMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualIntMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jint CallNonvirtualIntMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualIntMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jlong CallNonvirtualLongMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualLongMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualLongMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ return functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallNonvirtualFloatMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ return functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallNonvirtualDoubleMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+ va_end(args);
+ }
+ void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+ }
+ void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args);
+ }
+
+ jfieldID GetFieldID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetFieldID(this,clazz,name,sig);
+ }
+
+ jobject GetObjectField(jobject obj, jfieldID fieldID) {
+ return functions->GetObjectField(this,obj,fieldID);
+ }
+ jboolean GetBooleanField(jobject obj, jfieldID fieldID) {
+ return functions->GetBooleanField(this,obj,fieldID);
+ }
+ jbyte GetByteField(jobject obj, jfieldID fieldID) {
+ return functions->GetByteField(this,obj,fieldID);
+ }
+ jchar GetCharField(jobject obj, jfieldID fieldID) {
+ return functions->GetCharField(this,obj,fieldID);
+ }
+ jshort GetShortField(jobject obj, jfieldID fieldID) {
+ return functions->GetShortField(this,obj,fieldID);
+ }
+ jint GetIntField(jobject obj, jfieldID fieldID) {
+ return functions->GetIntField(this,obj,fieldID);
+ }
+ jlong GetLongField(jobject obj, jfieldID fieldID) {
+ return functions->GetLongField(this,obj,fieldID);
+ }
+ jfloat GetFloatField(jobject obj, jfieldID fieldID) {
+ return functions->GetFloatField(this,obj,fieldID);
+ }
+ jdouble GetDoubleField(jobject obj, jfieldID fieldID) {
+ return functions->GetDoubleField(this,obj,fieldID);
+ }
+
+ void SetObjectField(jobject obj, jfieldID fieldID, jobject val) {
+ functions->SetObjectField(this,obj,fieldID,val);
+ }
+ void SetBooleanField(jobject obj, jfieldID fieldID,
+ jboolean val) {
+ functions->SetBooleanField(this,obj,fieldID,val);
+ }
+ void SetByteField(jobject obj, jfieldID fieldID,
+ jbyte val) {
+ functions->SetByteField(this,obj,fieldID,val);
+ }
+ void SetCharField(jobject obj, jfieldID fieldID,
+ jchar val) {
+ functions->SetCharField(this,obj,fieldID,val);
+ }
+ void SetShortField(jobject obj, jfieldID fieldID,
+ jshort val) {
+ functions->SetShortField(this,obj,fieldID,val);
+ }
+ void SetIntField(jobject obj, jfieldID fieldID,
+ jint val) {
+ functions->SetIntField(this,obj,fieldID,val);
+ }
+ void SetLongField(jobject obj, jfieldID fieldID,
+ jlong val) {
+ functions->SetLongField(this,obj,fieldID,val);
+ }
+ void SetFloatField(jobject obj, jfieldID fieldID,
+ jfloat val) {
+ functions->SetFloatField(this,obj,fieldID,val);
+ }
+ void SetDoubleField(jobject obj, jfieldID fieldID,
+ jdouble val) {
+ functions->SetDoubleField(this,obj,fieldID,val);
+ }
+
+ jmethodID GetStaticMethodID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetStaticMethodID(this,clazz,name,sig);
+ }
+
+ jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID,
+ ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID,
+ va_list args) {
+ return functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+ }
+ jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID,
+ const jvalue *args) {
+ return functions->CallStaticObjectMethodA(this,clazz,methodID,args);
+ }
+
+ jboolean CallStaticBooleanMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallStaticBooleanMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+ }
+ jboolean CallStaticBooleanMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticBooleanMethodA(this,clazz,methodID,args);
+ }
+
+ jbyte CallStaticByteMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallStaticByteMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticByteMethodV(this,clazz,methodID,args);
+ }
+ jbyte CallStaticByteMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticByteMethodA(this,clazz,methodID,args);
+ }
+
+ jchar CallStaticCharMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallStaticCharMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticCharMethodV(this,clazz,methodID,args);
+ }
+ jchar CallStaticCharMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticCharMethodA(this,clazz,methodID,args);
+ }
+
+ jshort CallStaticShortMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallStaticShortMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticShortMethodV(this,clazz,methodID,args);
+ }
+ jshort CallStaticShortMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticShortMethodA(this,clazz,methodID,args);
+ }
+
+ jint CallStaticIntMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallStaticIntMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticIntMethodV(this,clazz,methodID,args);
+ }
+ jint CallStaticIntMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticIntMethodA(this,clazz,methodID,args);
+ }
+
+ jlong CallStaticLongMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallStaticLongMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticLongMethodV(this,clazz,methodID,args);
+ }
+ jlong CallStaticLongMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticLongMethodA(this,clazz,methodID,args);
+ }
+
+ jfloat CallStaticFloatMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallStaticFloatMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+ }
+ jfloat CallStaticFloatMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticFloatMethodA(this,clazz,methodID,args);
+ }
+
+ jdouble CallStaticDoubleMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallStaticDoubleMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+ }
+ jdouble CallStaticDoubleMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticDoubleMethodA(this,clazz,methodID,args);
+ }
+
+ void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallStaticVoidMethodV(this,cls,methodID,args);
+ va_end(args);
+ }
+ void CallStaticVoidMethodV(jclass cls, jmethodID methodID,
+ va_list args) {
+ functions->CallStaticVoidMethodV(this,cls,methodID,args);
+ }
+ void CallStaticVoidMethodA(jclass cls, jmethodID methodID,
+ const jvalue * args) {
+ functions->CallStaticVoidMethodA(this,cls,methodID,args);
+ }
+
+ jfieldID GetStaticFieldID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetStaticFieldID(this,clazz,name,sig);
+ }
+ jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticObjectField(this,clazz,fieldID);
+ }
+ jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticBooleanField(this,clazz,fieldID);
+ }
+ jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticByteField(this,clazz,fieldID);
+ }
+ jchar GetStaticCharField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticCharField(this,clazz,fieldID);
+ }
+ jshort GetStaticShortField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticShortField(this,clazz,fieldID);
+ }
+ jint GetStaticIntField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticIntField(this,clazz,fieldID);
+ }
+ jlong GetStaticLongField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticLongField(this,clazz,fieldID);
+ }
+ jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticFloatField(this,clazz,fieldID);
+ }
+ jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticDoubleField(this,clazz,fieldID);
+ }
+
+ void SetStaticObjectField(jclass clazz, jfieldID fieldID,
+ jobject value) {
+ functions->SetStaticObjectField(this,clazz,fieldID,value);
+ }
+ void SetStaticBooleanField(jclass clazz, jfieldID fieldID,
+ jboolean value) {
+ functions->SetStaticBooleanField(this,clazz,fieldID,value);
+ }
+ void SetStaticByteField(jclass clazz, jfieldID fieldID,
+ jbyte value) {
+ functions->SetStaticByteField(this,clazz,fieldID,value);
+ }
+ void SetStaticCharField(jclass clazz, jfieldID fieldID,
+ jchar value) {
+ functions->SetStaticCharField(this,clazz,fieldID,value);
+ }
+ void SetStaticShortField(jclass clazz, jfieldID fieldID,
+ jshort value) {
+ functions->SetStaticShortField(this,clazz,fieldID,value);
+ }
+ void SetStaticIntField(jclass clazz, jfieldID fieldID,
+ jint value) {
+ functions->SetStaticIntField(this,clazz,fieldID,value);
+ }
+ void SetStaticLongField(jclass clazz, jfieldID fieldID,
+ jlong value) {
+ functions->SetStaticLongField(this,clazz,fieldID,value);
+ }
+ void SetStaticFloatField(jclass clazz, jfieldID fieldID,
+ jfloat value) {
+ functions->SetStaticFloatField(this,clazz,fieldID,value);
+ }
+ void SetStaticDoubleField(jclass clazz, jfieldID fieldID,
+ jdouble value) {
+ functions->SetStaticDoubleField(this,clazz,fieldID,value);
+ }
+
+ jstring NewString(const jchar *unicode, jsize len) {
+ return functions->NewString(this,unicode,len);
+ }
+ jsize GetStringLength(jstring str) {
+ return functions->GetStringLength(this,str);
+ }
+ const jchar *GetStringChars(jstring str, jboolean *isCopy) {
+ return functions->GetStringChars(this,str,isCopy);
+ }
+ void ReleaseStringChars(jstring str, const jchar *chars) {
+ functions->ReleaseStringChars(this,str,chars);
+ }
+
+ jstring NewStringUTF(const char *utf) {
+ return functions->NewStringUTF(this,utf);
+ }
+ jsize GetStringUTFLength(jstring str) {
+ return functions->GetStringUTFLength(this,str);
+ }
+ const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
+ return functions->GetStringUTFChars(this,str,isCopy);
+ }
+ void ReleaseStringUTFChars(jstring str, const char* chars) {
+ functions->ReleaseStringUTFChars(this,str,chars);
+ }
+
+ jsize GetArrayLength(jarray array) {
+ return functions->GetArrayLength(this,array);
+ }
+
+ jobjectArray NewObjectArray(jsize len, jclass clazz,
+ jobject init) {
+ return functions->NewObjectArray(this,len,clazz,init);
+ }
+ jobject GetObjectArrayElement(jobjectArray array, jsize index) {
+ return functions->GetObjectArrayElement(this,array,index);
+ }
+ void SetObjectArrayElement(jobjectArray array, jsize index,
+ jobject val) {
+ functions->SetObjectArrayElement(this,array,index,val);
+ }
+
+ jbooleanArray NewBooleanArray(jsize len) {
+ return functions->NewBooleanArray(this,len);
+ }
+ jbyteArray NewByteArray(jsize len) {
+ return functions->NewByteArray(this,len);
+ }
+ jcharArray NewCharArray(jsize len) {
+ return functions->NewCharArray(this,len);
+ }
+ jshortArray NewShortArray(jsize len) {
+ return functions->NewShortArray(this,len);
+ }
+ jintArray NewIntArray(jsize len) {
+ return functions->NewIntArray(this,len);
+ }
+ jlongArray NewLongArray(jsize len) {
+ return functions->NewLongArray(this,len);
+ }
+ jfloatArray NewFloatArray(jsize len) {
+ return functions->NewFloatArray(this,len);
+ }
+ jdoubleArray NewDoubleArray(jsize len) {
+ return functions->NewDoubleArray(this,len);
+ }
+
+ jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) {
+ return functions->GetBooleanArrayElements(this,array,isCopy);
+ }
+ jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) {
+ return functions->GetByteArrayElements(this,array,isCopy);
+ }
+ jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) {
+ return functions->GetCharArrayElements(this,array,isCopy);
+ }
+ jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) {
+ return functions->GetShortArrayElements(this,array,isCopy);
+ }
+ jint * GetIntArrayElements(jintArray array, jboolean *isCopy) {
+ return functions->GetIntArrayElements(this,array,isCopy);
+ }
+ jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) {
+ return functions->GetLongArrayElements(this,array,isCopy);
+ }
+ jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) {
+ return functions->GetFloatArrayElements(this,array,isCopy);
+ }
+ jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) {
+ return functions->GetDoubleArrayElements(this,array,isCopy);
+ }
+
+ void ReleaseBooleanArrayElements(jbooleanArray array,
+ jboolean *elems,
+ jint mode) {
+ functions->ReleaseBooleanArrayElements(this,array,elems,mode);
+ }
+ void ReleaseByteArrayElements(jbyteArray array,
+ jbyte *elems,
+ jint mode) {
+ functions->ReleaseByteArrayElements(this,array,elems,mode);
+ }
+ void ReleaseCharArrayElements(jcharArray array,
+ jchar *elems,
+ jint mode) {
+ functions->ReleaseCharArrayElements(this,array,elems,mode);
+ }
+ void ReleaseShortArrayElements(jshortArray array,
+ jshort *elems,
+ jint mode) {
+ functions->ReleaseShortArrayElements(this,array,elems,mode);
+ }
+ void ReleaseIntArrayElements(jintArray array,
+ jint *elems,
+ jint mode) {
+ functions->ReleaseIntArrayElements(this,array,elems,mode);
+ }
+ void ReleaseLongArrayElements(jlongArray array,
+ jlong *elems,
+ jint mode) {
+ functions->ReleaseLongArrayElements(this,array,elems,mode);
+ }
+ void ReleaseFloatArrayElements(jfloatArray array,
+ jfloat *elems,
+ jint mode) {
+ functions->ReleaseFloatArrayElements(this,array,elems,mode);
+ }
+ void ReleaseDoubleArrayElements(jdoubleArray array,
+ jdouble *elems,
+ jint mode) {
+ functions->ReleaseDoubleArrayElements(this,array,elems,mode);
+ }
+
+ void GetBooleanArrayRegion(jbooleanArray array,
+ jsize start, jsize len, jboolean *buf) {
+ functions->GetBooleanArrayRegion(this,array,start,len,buf);
+ }
+ void GetByteArrayRegion(jbyteArray array,
+ jsize start, jsize len, jbyte *buf) {
+ functions->GetByteArrayRegion(this,array,start,len,buf);
+ }
+ void GetCharArrayRegion(jcharArray array,
+ jsize start, jsize len, jchar *buf) {
+ functions->GetCharArrayRegion(this,array,start,len,buf);
+ }
+ void GetShortArrayRegion(jshortArray array,
+ jsize start, jsize len, jshort *buf) {
+ functions->GetShortArrayRegion(this,array,start,len,buf);
+ }
+ void GetIntArrayRegion(jintArray array,
+ jsize start, jsize len, jint *buf) {
+ functions->GetIntArrayRegion(this,array,start,len,buf);
+ }
+ void GetLongArrayRegion(jlongArray array,
+ jsize start, jsize len, jlong *buf) {
+ functions->GetLongArrayRegion(this,array,start,len,buf);
+ }
+ void GetFloatArrayRegion(jfloatArray array,
+ jsize start, jsize len, jfloat *buf) {
+ functions->GetFloatArrayRegion(this,array,start,len,buf);
+ }
+ void GetDoubleArrayRegion(jdoubleArray array,
+ jsize start, jsize len, jdouble *buf) {
+ functions->GetDoubleArrayRegion(this,array,start,len,buf);
+ }
+
+ void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
+ const jboolean *buf) {
+ functions->SetBooleanArrayRegion(this,array,start,len,buf);
+ }
+ void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
+ const jbyte *buf) {
+ functions->SetByteArrayRegion(this,array,start,len,buf);
+ }
+ void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
+ const jchar *buf) {
+ functions->SetCharArrayRegion(this,array,start,len,buf);
+ }
+ void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
+ const jshort *buf) {
+ functions->SetShortArrayRegion(this,array,start,len,buf);
+ }
+ void SetIntArrayRegion(jintArray array, jsize start, jsize len,
+ const jint *buf) {
+ functions->SetIntArrayRegion(this,array,start,len,buf);
+ }
+ void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
+ const jlong *buf) {
+ functions->SetLongArrayRegion(this,array,start,len,buf);
+ }
+ void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
+ const jfloat *buf) {
+ functions->SetFloatArrayRegion(this,array,start,len,buf);
+ }
+ void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
+ const jdouble *buf) {
+ functions->SetDoubleArrayRegion(this,array,start,len,buf);
+ }
+
+ jint RegisterNatives(jclass clazz, const JNINativeMethod *methods,
+ jint nMethods) {
+ return functions->RegisterNatives(this,clazz,methods,nMethods);
+ }
+ jint UnregisterNatives(jclass clazz) {
+ return functions->UnregisterNatives(this,clazz);
+ }
+
+ jint MonitorEnter(jobject obj) {
+ return functions->MonitorEnter(this,obj);
+ }
+ jint MonitorExit(jobject obj) {
+ return functions->MonitorExit(this,obj);
+ }
+
+ jint GetJavaVM(JavaVM **vm) {
+ return functions->GetJavaVM(this,vm);
+ }
+
+ void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) {
+ functions->GetStringRegion(this,str,start,len,buf);
+ }
+ void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) {
+ functions->GetStringUTFRegion(this,str,start,len,buf);
+ }
+
+ void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) {
+ return functions->GetPrimitiveArrayCritical(this,array,isCopy);
+ }
+ void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) {
+ functions->ReleasePrimitiveArrayCritical(this,array,carray,mode);
+ }
+
+ const jchar * GetStringCritical(jstring string, jboolean *isCopy) {
+ return functions->GetStringCritical(this,string,isCopy);
+ }
+ void ReleaseStringCritical(jstring string, const jchar *cstring) {
+ functions->ReleaseStringCritical(this,string,cstring);
+ }
+
+ jweak NewWeakGlobalRef(jobject obj) {
+ return functions->NewWeakGlobalRef(this,obj);
+ }
+ void DeleteWeakGlobalRef(jweak ref) {
+ functions->DeleteWeakGlobalRef(this,ref);
+ }
+
+ jboolean ExceptionCheck() {
+ return functions->ExceptionCheck(this);
+ }
+
+ jobject NewDirectByteBuffer(void* address, jlong capacity) {
+ return functions->NewDirectByteBuffer(this, address, capacity);
+ }
+ void* GetDirectBufferAddress(jobject buf) {
+ return functions->GetDirectBufferAddress(this, buf);
+ }
+ jlong GetDirectBufferCapacity(jobject buf) {
+ return functions->GetDirectBufferCapacity(this, buf);
+ }
+ jobjectRefType GetObjectRefType(jobject obj) {
+ return functions->GetObjectRefType(this, obj);
+ }
+
+#endif /* __cplusplus */
+};
+
+typedef struct JavaVMOption {
+ char *optionString;
+ void *extraInfo;
+} JavaVMOption;
+
+typedef struct JavaVMInitArgs {
+ jint version;
+
+ jint nOptions;
+ JavaVMOption *options;
+ jboolean ignoreUnrecognized;
+} JavaVMInitArgs;
+
+typedef struct JavaVMAttachArgs {
+ jint version;
+
+ char *name;
+ jobject group;
+} JavaVMAttachArgs;
+
+/* These will be VM-specific. */
+
+#define JDK1_2
+#define JDK1_4
+
+/* End VM-specific. */
+
+struct JNIInvokeInterface_ {
+ void *reserved0;
+ void *reserved1;
+ void *reserved2;
+
+ jint (JNICALL *DestroyJavaVM)(JavaVM *vm);
+
+ jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args);
+
+ jint (JNICALL *DetachCurrentThread)(JavaVM *vm);
+
+ jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version);
+
+ jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args);
+};
+
+struct JavaVM_ {
+ const struct JNIInvokeInterface_ *functions;
+#ifdef __cplusplus
+
+ jint DestroyJavaVM() {
+ return functions->DestroyJavaVM(this);
+ }
+ jint AttachCurrentThread(void **penv, void *args) {
+ return functions->AttachCurrentThread(this, penv, args);
+ }
+ jint DetachCurrentThread() {
+ return functions->DetachCurrentThread(this);
+ }
+
+ jint GetEnv(void **penv, jint version) {
+ return functions->GetEnv(this, penv, version);
+ }
+ jint AttachCurrentThreadAsDaemon(void **penv, void *args) {
+ return functions->AttachCurrentThreadAsDaemon(this, penv, args);
+ }
+#endif
+};
+
+#ifdef _JNI_IMPLEMENTATION_
+#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
+#else
+#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
+#endif
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetDefaultJavaVMInitArgs(void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
+
+/* Defined by native libraries. */
+JNIEXPORT jint JNICALL
+JNI_OnLoad(JavaVM *vm, void *reserved);
+
+JNIEXPORT void JNICALL
+JNI_OnUnload(JavaVM *vm, void *reserved);
+
+#define JNI_VERSION_1_1 0x00010001
+#define JNI_VERSION_1_2 0x00010002
+#define JNI_VERSION_1_4 0x00010004
+#define JNI_VERSION_1_6 0x00010006
+#define JNI_VERSION_1_8 0x00010008
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !_JAVASOFT_JNI_H_ */
diff --git a/staging/darwin-x86/include/jvmti.h b/staging/darwin-x86/include/jvmti.h
new file mode 100644
index 0000000..ee708cb
--- /dev/null
+++ b/staging/darwin-x86/include/jvmti.h
@@ -0,0 +1,2534 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */
+
+
+ /* Include file for the Java(tm) Virtual Machine Tool Interface */
+
+#ifndef _JAVA_JVMTI_H_
+#define _JAVA_JVMTI_H_
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ JVMTI_VERSION_1 = 0x30010000,
+ JVMTI_VERSION_1_0 = 0x30010000,
+ JVMTI_VERSION_1_1 = 0x30010100,
+ JVMTI_VERSION_1_2 = 0x30010200,
+
+ JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (2 * 0x100) + 1 /* version: 1.2.1 */
+};
+
+JNIEXPORT jint JNICALL
+Agent_OnLoad(JavaVM *vm, char *options, void *reserved);
+
+JNIEXPORT jint JNICALL
+Agent_OnAttach(JavaVM* vm, char* options, void* reserved);
+
+JNIEXPORT void JNICALL
+Agent_OnUnload(JavaVM *vm);
+
+ /* Forward declaration of the environment */
+
+struct _jvmtiEnv;
+
+struct jvmtiInterface_1_;
+
+#ifdef __cplusplus
+typedef _jvmtiEnv jvmtiEnv;
+#else
+typedef const struct jvmtiInterface_1_ *jvmtiEnv;
+#endif /* __cplusplus */
+
+/* Derived Base Types */
+
+typedef jobject jthread;
+typedef jobject jthreadGroup;
+typedef jlong jlocation;
+struct _jrawMonitorID;
+typedef struct _jrawMonitorID *jrawMonitorID;
+typedef struct JNINativeInterface_ jniNativeInterface;
+
+ /* Constants */
+
+
+ /* Thread State Flags */
+
+enum {
+ JVMTI_THREAD_STATE_ALIVE = 0x0001,
+ JVMTI_THREAD_STATE_TERMINATED = 0x0002,
+ JVMTI_THREAD_STATE_RUNNABLE = 0x0004,
+ JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400,
+ JVMTI_THREAD_STATE_WAITING = 0x0080,
+ JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010,
+ JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020,
+ JVMTI_THREAD_STATE_SLEEPING = 0x0040,
+ JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100,
+ JVMTI_THREAD_STATE_PARKED = 0x0200,
+ JVMTI_THREAD_STATE_SUSPENDED = 0x100000,
+ JVMTI_THREAD_STATE_INTERRUPTED = 0x200000,
+ JVMTI_THREAD_STATE_IN_NATIVE = 0x400000,
+ JVMTI_THREAD_STATE_VENDOR_1 = 0x10000000,
+ JVMTI_THREAD_STATE_VENDOR_2 = 0x20000000,
+ JVMTI_THREAD_STATE_VENDOR_3 = 0x40000000
+};
+
+ /* java.lang.Thread.State Conversion Masks */
+
+enum {
+ JVMTI_JAVA_LANG_THREAD_STATE_MASK = JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT,
+ JVMTI_JAVA_LANG_THREAD_STATE_NEW = 0,
+ JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED = JVMTI_THREAD_STATE_TERMINATED,
+ JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE,
+ JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER,
+ JVMTI_JAVA_LANG_THREAD_STATE_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY,
+ JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
+};
+
+ /* Thread Priority Constants */
+
+enum {
+ JVMTI_THREAD_MIN_PRIORITY = 1,
+ JVMTI_THREAD_NORM_PRIORITY = 5,
+ JVMTI_THREAD_MAX_PRIORITY = 10
+};
+
+ /* Heap Filter Flags */
+
+enum {
+ JVMTI_HEAP_FILTER_TAGGED = 0x4,
+ JVMTI_HEAP_FILTER_UNTAGGED = 0x8,
+ JVMTI_HEAP_FILTER_CLASS_TAGGED = 0x10,
+ JVMTI_HEAP_FILTER_CLASS_UNTAGGED = 0x20
+};
+
+ /* Heap Visit Control Flags */
+
+enum {
+ JVMTI_VISIT_OBJECTS = 0x100,
+ JVMTI_VISIT_ABORT = 0x8000
+};
+
+ /* Heap Reference Enumeration */
+
+typedef enum {
+ JVMTI_HEAP_REFERENCE_CLASS = 1,
+ JVMTI_HEAP_REFERENCE_FIELD = 2,
+ JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT = 3,
+ JVMTI_HEAP_REFERENCE_CLASS_LOADER = 4,
+ JVMTI_HEAP_REFERENCE_SIGNERS = 5,
+ JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN = 6,
+ JVMTI_HEAP_REFERENCE_INTERFACE = 7,
+ JVMTI_HEAP_REFERENCE_STATIC_FIELD = 8,
+ JVMTI_HEAP_REFERENCE_CONSTANT_POOL = 9,
+ JVMTI_HEAP_REFERENCE_SUPERCLASS = 10,
+ JVMTI_HEAP_REFERENCE_JNI_GLOBAL = 21,
+ JVMTI_HEAP_REFERENCE_SYSTEM_CLASS = 22,
+ JVMTI_HEAP_REFERENCE_MONITOR = 23,
+ JVMTI_HEAP_REFERENCE_STACK_LOCAL = 24,
+ JVMTI_HEAP_REFERENCE_JNI_LOCAL = 25,
+ JVMTI_HEAP_REFERENCE_THREAD = 26,
+ JVMTI_HEAP_REFERENCE_OTHER = 27
+} jvmtiHeapReferenceKind;
+
+ /* Primitive Type Enumeration */
+
+typedef enum {
+ JVMTI_PRIMITIVE_TYPE_BOOLEAN = 90,
+ JVMTI_PRIMITIVE_TYPE_BYTE = 66,
+ JVMTI_PRIMITIVE_TYPE_CHAR = 67,
+ JVMTI_PRIMITIVE_TYPE_SHORT = 83,
+ JVMTI_PRIMITIVE_TYPE_INT = 73,
+ JVMTI_PRIMITIVE_TYPE_LONG = 74,
+ JVMTI_PRIMITIVE_TYPE_FLOAT = 70,
+ JVMTI_PRIMITIVE_TYPE_DOUBLE = 68
+} jvmtiPrimitiveType;
+
+ /* Heap Object Filter Enumeration */
+
+typedef enum {
+ JVMTI_HEAP_OBJECT_TAGGED = 1,
+ JVMTI_HEAP_OBJECT_UNTAGGED = 2,
+ JVMTI_HEAP_OBJECT_EITHER = 3
+} jvmtiHeapObjectFilter;
+
+ /* Heap Root Kind Enumeration */
+
+typedef enum {
+ JVMTI_HEAP_ROOT_JNI_GLOBAL = 1,
+ JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2,
+ JVMTI_HEAP_ROOT_MONITOR = 3,
+ JVMTI_HEAP_ROOT_STACK_LOCAL = 4,
+ JVMTI_HEAP_ROOT_JNI_LOCAL = 5,
+ JVMTI_HEAP_ROOT_THREAD = 6,
+ JVMTI_HEAP_ROOT_OTHER = 7
+} jvmtiHeapRootKind;
+
+ /* Object Reference Enumeration */
+
+typedef enum {
+ JVMTI_REFERENCE_CLASS = 1,
+ JVMTI_REFERENCE_FIELD = 2,
+ JVMTI_REFERENCE_ARRAY_ELEMENT = 3,
+ JVMTI_REFERENCE_CLASS_LOADER = 4,
+ JVMTI_REFERENCE_SIGNERS = 5,
+ JVMTI_REFERENCE_PROTECTION_DOMAIN = 6,
+ JVMTI_REFERENCE_INTERFACE = 7,
+ JVMTI_REFERENCE_STATIC_FIELD = 8,
+ JVMTI_REFERENCE_CONSTANT_POOL = 9
+} jvmtiObjectReferenceKind;
+
+ /* Iteration Control Enumeration */
+
+typedef enum {
+ JVMTI_ITERATION_CONTINUE = 1,
+ JVMTI_ITERATION_IGNORE = 2,
+ JVMTI_ITERATION_ABORT = 0
+} jvmtiIterationControl;
+
+ /* Class Status Flags */
+
+enum {
+ JVMTI_CLASS_STATUS_VERIFIED = 1,
+ JVMTI_CLASS_STATUS_PREPARED = 2,
+ JVMTI_CLASS_STATUS_INITIALIZED = 4,
+ JVMTI_CLASS_STATUS_ERROR = 8,
+ JVMTI_CLASS_STATUS_ARRAY = 16,
+ JVMTI_CLASS_STATUS_PRIMITIVE = 32
+};
+
+ /* Event Enable/Disable */
+
+typedef enum {
+ JVMTI_ENABLE = 1,
+ JVMTI_DISABLE = 0
+} jvmtiEventMode;
+
+ /* Extension Function/Event Parameter Types */
+
+typedef enum {
+ JVMTI_TYPE_JBYTE = 101,
+ JVMTI_TYPE_JCHAR = 102,
+ JVMTI_TYPE_JSHORT = 103,
+ JVMTI_TYPE_JINT = 104,
+ JVMTI_TYPE_JLONG = 105,
+ JVMTI_TYPE_JFLOAT = 106,
+ JVMTI_TYPE_JDOUBLE = 107,
+ JVMTI_TYPE_JBOOLEAN = 108,
+ JVMTI_TYPE_JOBJECT = 109,
+ JVMTI_TYPE_JTHREAD = 110,
+ JVMTI_TYPE_JCLASS = 111,
+ JVMTI_TYPE_JVALUE = 112,
+ JVMTI_TYPE_JFIELDID = 113,
+ JVMTI_TYPE_JMETHODID = 114,
+ JVMTI_TYPE_CCHAR = 115,
+ JVMTI_TYPE_CVOID = 116,
+ JVMTI_TYPE_JNIENV = 117
+} jvmtiParamTypes;
+
+ /* Extension Function/Event Parameter Kinds */
+
+typedef enum {
+ JVMTI_KIND_IN = 91,
+ JVMTI_KIND_IN_PTR = 92,
+ JVMTI_KIND_IN_BUF = 93,
+ JVMTI_KIND_ALLOC_BUF = 94,
+ JVMTI_KIND_ALLOC_ALLOC_BUF = 95,
+ JVMTI_KIND_OUT = 96,
+ JVMTI_KIND_OUT_BUF = 97
+} jvmtiParamKind;
+
+ /* Timer Kinds */
+
+typedef enum {
+ JVMTI_TIMER_USER_CPU = 30,
+ JVMTI_TIMER_TOTAL_CPU = 31,
+ JVMTI_TIMER_ELAPSED = 32
+} jvmtiTimerKind;
+
+ /* Phases of execution */
+
+typedef enum {
+ JVMTI_PHASE_ONLOAD = 1,
+ JVMTI_PHASE_PRIMORDIAL = 2,
+ JVMTI_PHASE_START = 6,
+ JVMTI_PHASE_LIVE = 4,
+ JVMTI_PHASE_DEAD = 8
+} jvmtiPhase;
+
+ /* Version Interface Types */
+
+enum {
+ JVMTI_VERSION_INTERFACE_JNI = 0x00000000,
+ JVMTI_VERSION_INTERFACE_JVMTI = 0x30000000
+};
+
+ /* Version Masks */
+
+enum {
+ JVMTI_VERSION_MASK_INTERFACE_TYPE = 0x70000000,
+ JVMTI_VERSION_MASK_MAJOR = 0x0FFF0000,
+ JVMTI_VERSION_MASK_MINOR = 0x0000FF00,
+ JVMTI_VERSION_MASK_MICRO = 0x000000FF
+};
+
+ /* Version Shifts */
+
+enum {
+ JVMTI_VERSION_SHIFT_MAJOR = 16,
+ JVMTI_VERSION_SHIFT_MINOR = 8,
+ JVMTI_VERSION_SHIFT_MICRO = 0
+};
+
+ /* Verbose Flag Enumeration */
+
+typedef enum {
+ JVMTI_VERBOSE_OTHER = 0,
+ JVMTI_VERBOSE_GC = 1,
+ JVMTI_VERBOSE_CLASS = 2,
+ JVMTI_VERBOSE_JNI = 4
+} jvmtiVerboseFlag;
+
+ /* JLocation Format Enumeration */
+
+typedef enum {
+ JVMTI_JLOCATION_JVMBCI = 1,
+ JVMTI_JLOCATION_MACHINEPC = 2,
+ JVMTI_JLOCATION_OTHER = 0
+} jvmtiJlocationFormat;
+
+ /* Resource Exhaustion Flags */
+
+enum {
+ JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR = 0x0001,
+ JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP = 0x0002,
+ JVMTI_RESOURCE_EXHAUSTED_THREADS = 0x0004
+};
+
+ /* Errors */
+
+typedef enum {
+ JVMTI_ERROR_NONE = 0,
+ JVMTI_ERROR_INVALID_THREAD = 10,
+ JVMTI_ERROR_INVALID_THREAD_GROUP = 11,
+ JVMTI_ERROR_INVALID_PRIORITY = 12,
+ JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13,
+ JVMTI_ERROR_THREAD_SUSPENDED = 14,
+ JVMTI_ERROR_THREAD_NOT_ALIVE = 15,
+ JVMTI_ERROR_INVALID_OBJECT = 20,
+ JVMTI_ERROR_INVALID_CLASS = 21,
+ JVMTI_ERROR_CLASS_NOT_PREPARED = 22,
+ JVMTI_ERROR_INVALID_METHODID = 23,
+ JVMTI_ERROR_INVALID_LOCATION = 24,
+ JVMTI_ERROR_INVALID_FIELDID = 25,
+ JVMTI_ERROR_NO_MORE_FRAMES = 31,
+ JVMTI_ERROR_OPAQUE_FRAME = 32,
+ JVMTI_ERROR_TYPE_MISMATCH = 34,
+ JVMTI_ERROR_INVALID_SLOT = 35,
+ JVMTI_ERROR_DUPLICATE = 40,
+ JVMTI_ERROR_NOT_FOUND = 41,
+ JVMTI_ERROR_INVALID_MONITOR = 50,
+ JVMTI_ERROR_NOT_MONITOR_OWNER = 51,
+ JVMTI_ERROR_INTERRUPT = 52,
+ JVMTI_ERROR_INVALID_CLASS_FORMAT = 60,
+ JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61,
+ JVMTI_ERROR_FAILS_VERIFICATION = 62,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64,
+ JVMTI_ERROR_INVALID_TYPESTATE = 65,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67,
+ JVMTI_ERROR_UNSUPPORTED_VERSION = 68,
+ JVMTI_ERROR_NAMES_DONT_MATCH = 69,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71,
+ JVMTI_ERROR_UNMODIFIABLE_CLASS = 79,
+ JVMTI_ERROR_NOT_AVAILABLE = 98,
+ JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99,
+ JVMTI_ERROR_NULL_POINTER = 100,
+ JVMTI_ERROR_ABSENT_INFORMATION = 101,
+ JVMTI_ERROR_INVALID_EVENT_TYPE = 102,
+ JVMTI_ERROR_ILLEGAL_ARGUMENT = 103,
+ JVMTI_ERROR_NATIVE_METHOD = 104,
+ JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED = 106,
+ JVMTI_ERROR_OUT_OF_MEMORY = 110,
+ JVMTI_ERROR_ACCESS_DENIED = 111,
+ JVMTI_ERROR_WRONG_PHASE = 112,
+ JVMTI_ERROR_INTERNAL = 113,
+ JVMTI_ERROR_UNATTACHED_THREAD = 115,
+ JVMTI_ERROR_INVALID_ENVIRONMENT = 116,
+ JVMTI_ERROR_MAX = 116
+} jvmtiError;
+
+ /* Event IDs */
+
+typedef enum {
+ JVMTI_MIN_EVENT_TYPE_VAL = 50,
+ JVMTI_EVENT_VM_INIT = 50,
+ JVMTI_EVENT_VM_DEATH = 51,
+ JVMTI_EVENT_THREAD_START = 52,
+ JVMTI_EVENT_THREAD_END = 53,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54,
+ JVMTI_EVENT_CLASS_LOAD = 55,
+ JVMTI_EVENT_CLASS_PREPARE = 56,
+ JVMTI_EVENT_VM_START = 57,
+ JVMTI_EVENT_EXCEPTION = 58,
+ JVMTI_EVENT_EXCEPTION_CATCH = 59,
+ JVMTI_EVENT_SINGLE_STEP = 60,
+ JVMTI_EVENT_FRAME_POP = 61,
+ JVMTI_EVENT_BREAKPOINT = 62,
+ JVMTI_EVENT_FIELD_ACCESS = 63,
+ JVMTI_EVENT_FIELD_MODIFICATION = 64,
+ JVMTI_EVENT_METHOD_ENTRY = 65,
+ JVMTI_EVENT_METHOD_EXIT = 66,
+ JVMTI_EVENT_NATIVE_METHOD_BIND = 67,
+ JVMTI_EVENT_COMPILED_METHOD_LOAD = 68,
+ JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69,
+ JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70,
+ JVMTI_EVENT_DATA_DUMP_REQUEST = 71,
+ JVMTI_EVENT_MONITOR_WAIT = 73,
+ JVMTI_EVENT_MONITOR_WAITED = 74,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76,
+ JVMTI_EVENT_RESOURCE_EXHAUSTED = 80,
+ JVMTI_EVENT_GARBAGE_COLLECTION_START = 81,
+ JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82,
+ JVMTI_EVENT_OBJECT_FREE = 83,
+ JVMTI_EVENT_VM_OBJECT_ALLOC = 84,
+ JVMTI_MAX_EVENT_TYPE_VAL = 84
+} jvmtiEvent;
+
+
+ /* Pre-Declarations */
+struct _jvmtiThreadInfo;
+typedef struct _jvmtiThreadInfo jvmtiThreadInfo;
+struct _jvmtiMonitorStackDepthInfo;
+typedef struct _jvmtiMonitorStackDepthInfo jvmtiMonitorStackDepthInfo;
+struct _jvmtiThreadGroupInfo;
+typedef struct _jvmtiThreadGroupInfo jvmtiThreadGroupInfo;
+struct _jvmtiFrameInfo;
+typedef struct _jvmtiFrameInfo jvmtiFrameInfo;
+struct _jvmtiStackInfo;
+typedef struct _jvmtiStackInfo jvmtiStackInfo;
+struct _jvmtiHeapReferenceInfoField;
+typedef struct _jvmtiHeapReferenceInfoField jvmtiHeapReferenceInfoField;
+struct _jvmtiHeapReferenceInfoArray;
+typedef struct _jvmtiHeapReferenceInfoArray jvmtiHeapReferenceInfoArray;
+struct _jvmtiHeapReferenceInfoConstantPool;
+typedef struct _jvmtiHeapReferenceInfoConstantPool jvmtiHeapReferenceInfoConstantPool;
+struct _jvmtiHeapReferenceInfoStackLocal;
+typedef struct _jvmtiHeapReferenceInfoStackLocal jvmtiHeapReferenceInfoStackLocal;
+struct _jvmtiHeapReferenceInfoJniLocal;
+typedef struct _jvmtiHeapReferenceInfoJniLocal jvmtiHeapReferenceInfoJniLocal;
+struct _jvmtiHeapReferenceInfoReserved;
+typedef struct _jvmtiHeapReferenceInfoReserved jvmtiHeapReferenceInfoReserved;
+union _jvmtiHeapReferenceInfo;
+typedef union _jvmtiHeapReferenceInfo jvmtiHeapReferenceInfo;
+struct _jvmtiHeapCallbacks;
+typedef struct _jvmtiHeapCallbacks jvmtiHeapCallbacks;
+struct _jvmtiClassDefinition;
+typedef struct _jvmtiClassDefinition jvmtiClassDefinition;
+struct _jvmtiMonitorUsage;
+typedef struct _jvmtiMonitorUsage jvmtiMonitorUsage;
+struct _jvmtiLineNumberEntry;
+typedef struct _jvmtiLineNumberEntry jvmtiLineNumberEntry;
+struct _jvmtiLocalVariableEntry;
+typedef struct _jvmtiLocalVariableEntry jvmtiLocalVariableEntry;
+struct _jvmtiParamInfo;
+typedef struct _jvmtiParamInfo jvmtiParamInfo;
+struct _jvmtiExtensionFunctionInfo;
+typedef struct _jvmtiExtensionFunctionInfo jvmtiExtensionFunctionInfo;
+struct _jvmtiExtensionEventInfo;
+typedef struct _jvmtiExtensionEventInfo jvmtiExtensionEventInfo;
+struct _jvmtiTimerInfo;
+typedef struct _jvmtiTimerInfo jvmtiTimerInfo;
+struct _jvmtiAddrLocationMap;
+typedef struct _jvmtiAddrLocationMap jvmtiAddrLocationMap;
+
+ /* Function Types */
+
+typedef void (JNICALL *jvmtiStartFunction)
+ (jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg);
+
+typedef jint (JNICALL *jvmtiHeapIterationCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, jint length, void* user_data);
+
+typedef jint (JNICALL *jvmtiHeapReferenceCallback)
+ (jvmtiHeapReferenceKind reference_kind, const jvmtiHeapReferenceInfo* reference_info, jlong class_tag, jlong referrer_class_tag, jlong size, jlong* tag_ptr, jlong* referrer_tag_ptr, jint length, void* user_data);
+
+typedef jint (JNICALL *jvmtiPrimitiveFieldCallback)
+ (jvmtiHeapReferenceKind kind, const jvmtiHeapReferenceInfo* info, jlong object_class_tag, jlong* object_tag_ptr, jvalue value, jvmtiPrimitiveType value_type, void* user_data);
+
+typedef jint (JNICALL *jvmtiArrayPrimitiveValueCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, jint element_count, jvmtiPrimitiveType element_type, const void* elements, void* user_data);
+
+typedef jint (JNICALL *jvmtiStringPrimitiveValueCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, const jchar* value, jint value_length, void* user_data);
+
+typedef jint (JNICALL *jvmtiReservedCallback)
+ ();
+
+typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, void* user_data);
+
+typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback)
+ (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, void* user_data);
+
+typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback)
+ (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong thread_tag, jint depth, jmethodID method, jint slot, void* user_data);
+
+typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback)
+ (jvmtiObjectReferenceKind reference_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data);
+
+typedef jvmtiError (JNICALL *jvmtiExtensionFunction)
+ (jvmtiEnv* jvmti_env, ...);
+
+typedef void (JNICALL *jvmtiExtensionEvent)
+ (jvmtiEnv* jvmti_env, ...);
+
+
+ /* Structure Types */
+struct _jvmtiThreadInfo {
+ char* name;
+ jint priority;
+ jboolean is_daemon;
+ jthreadGroup thread_group;
+ jobject context_class_loader;
+};
+struct _jvmtiMonitorStackDepthInfo {
+ jobject monitor;
+ jint stack_depth;
+};
+struct _jvmtiThreadGroupInfo {
+ jthreadGroup parent;
+ char* name;
+ jint max_priority;
+ jboolean is_daemon;
+};
+struct _jvmtiFrameInfo {
+ jmethodID method;
+ jlocation location;
+};
+struct _jvmtiStackInfo {
+ jthread thread;
+ jint state;
+ jvmtiFrameInfo* frame_buffer;
+ jint frame_count;
+};
+struct _jvmtiHeapReferenceInfoField {
+ jint index;
+};
+struct _jvmtiHeapReferenceInfoArray {
+ jint index;
+};
+struct _jvmtiHeapReferenceInfoConstantPool {
+ jint index;
+};
+struct _jvmtiHeapReferenceInfoStackLocal {
+ jlong thread_tag;
+ jlong thread_id;
+ jint depth;
+ jmethodID method;
+ jlocation location;
+ jint slot;
+};
+struct _jvmtiHeapReferenceInfoJniLocal {
+ jlong thread_tag;
+ jlong thread_id;
+ jint depth;
+ jmethodID method;
+};
+struct _jvmtiHeapReferenceInfoReserved {
+ jlong reserved1;
+ jlong reserved2;
+ jlong reserved3;
+ jlong reserved4;
+ jlong reserved5;
+ jlong reserved6;
+ jlong reserved7;
+ jlong reserved8;
+};
+union _jvmtiHeapReferenceInfo {
+ jvmtiHeapReferenceInfoField field;
+ jvmtiHeapReferenceInfoArray array;
+ jvmtiHeapReferenceInfoConstantPool constant_pool;
+ jvmtiHeapReferenceInfoStackLocal stack_local;
+ jvmtiHeapReferenceInfoJniLocal jni_local;
+ jvmtiHeapReferenceInfoReserved other;
+};
+struct _jvmtiHeapCallbacks {
+ jvmtiHeapIterationCallback heap_iteration_callback;
+ jvmtiHeapReferenceCallback heap_reference_callback;
+ jvmtiPrimitiveFieldCallback primitive_field_callback;
+ jvmtiArrayPrimitiveValueCallback array_primitive_value_callback;
+ jvmtiStringPrimitiveValueCallback string_primitive_value_callback;
+ jvmtiReservedCallback reserved5;
+ jvmtiReservedCallback reserved6;
+ jvmtiReservedCallback reserved7;
+ jvmtiReservedCallback reserved8;
+ jvmtiReservedCallback reserved9;
+ jvmtiReservedCallback reserved10;
+ jvmtiReservedCallback reserved11;
+ jvmtiReservedCallback reserved12;
+ jvmtiReservedCallback reserved13;
+ jvmtiReservedCallback reserved14;
+ jvmtiReservedCallback reserved15;
+};
+struct _jvmtiClassDefinition {
+ jclass klass;
+ jint class_byte_count;
+ const unsigned char* class_bytes;
+};
+struct _jvmtiMonitorUsage {
+ jthread owner;
+ jint entry_count;
+ jint waiter_count;
+ jthread* waiters;
+ jint notify_waiter_count;
+ jthread* notify_waiters;
+};
+struct _jvmtiLineNumberEntry {
+ jlocation start_location;
+ jint line_number;
+};
+struct _jvmtiLocalVariableEntry {
+ jlocation start_location;
+ jint length;
+ char* name;
+ char* signature;
+ char* generic_signature;
+ jint slot;
+};
+struct _jvmtiParamInfo {
+ char* name;
+ jvmtiParamKind kind;
+ jvmtiParamTypes base_type;
+ jboolean null_ok;
+};
+struct _jvmtiExtensionFunctionInfo {
+ jvmtiExtensionFunction func;
+ char* id;
+ char* short_description;
+ jint param_count;
+ jvmtiParamInfo* params;
+ jint error_count;
+ jvmtiError* errors;
+};
+struct _jvmtiExtensionEventInfo {
+ jint extension_event_index;
+ char* id;
+ char* short_description;
+ jint param_count;
+ jvmtiParamInfo* params;
+};
+struct _jvmtiTimerInfo {
+ jlong max_value;
+ jboolean may_skip_forward;
+ jboolean may_skip_backward;
+ jvmtiTimerKind kind;
+ jlong reserved1;
+ jlong reserved2;
+};
+struct _jvmtiAddrLocationMap {
+ const void* start_address;
+ jlocation location;
+};
+
+typedef struct {
+ unsigned int can_tag_objects : 1;
+ unsigned int can_generate_field_modification_events : 1;
+ unsigned int can_generate_field_access_events : 1;
+ unsigned int can_get_bytecodes : 1;
+ unsigned int can_get_synthetic_attribute : 1;
+ unsigned int can_get_owned_monitor_info : 1;
+ unsigned int can_get_current_contended_monitor : 1;
+ unsigned int can_get_monitor_info : 1;
+ unsigned int can_pop_frame : 1;
+ unsigned int can_redefine_classes : 1;
+ unsigned int can_signal_thread : 1;
+ unsigned int can_get_source_file_name : 1;
+ unsigned int can_get_line_numbers : 1;
+ unsigned int can_get_source_debug_extension : 1;
+ unsigned int can_access_local_variables : 1;
+ unsigned int can_maintain_original_method_order : 1;
+ unsigned int can_generate_single_step_events : 1;
+ unsigned int can_generate_exception_events : 1;
+ unsigned int can_generate_frame_pop_events : 1;
+ unsigned int can_generate_breakpoint_events : 1;
+ unsigned int can_suspend : 1;
+ unsigned int can_redefine_any_class : 1;
+ unsigned int can_get_current_thread_cpu_time : 1;
+ unsigned int can_get_thread_cpu_time : 1;
+ unsigned int can_generate_method_entry_events : 1;
+ unsigned int can_generate_method_exit_events : 1;
+ unsigned int can_generate_all_class_hook_events : 1;
+ unsigned int can_generate_compiled_method_load_events : 1;
+ unsigned int can_generate_monitor_events : 1;
+ unsigned int can_generate_vm_object_alloc_events : 1;
+ unsigned int can_generate_native_method_bind_events : 1;
+ unsigned int can_generate_garbage_collection_events : 1;
+ unsigned int can_generate_object_free_events : 1;
+ unsigned int can_force_early_return : 1;
+ unsigned int can_get_owned_monitor_stack_depth_info : 1;
+ unsigned int can_get_constant_pool : 1;
+ unsigned int can_set_native_method_prefix : 1;
+ unsigned int can_retransform_classes : 1;
+ unsigned int can_retransform_any_class : 1;
+ unsigned int can_generate_resource_exhaustion_heap_events : 1;
+ unsigned int can_generate_resource_exhaustion_threads_events : 1;
+ unsigned int : 7;
+ unsigned int : 16;
+ unsigned int : 16;
+ unsigned int : 16;
+ unsigned int : 16;
+ unsigned int : 16;
+} jvmtiCapabilities;
+
+
+ /* Event Definitions */
+
+typedef void (JNICALL *jvmtiEventReserved)(void);
+
+
+typedef void (JNICALL *jvmtiEventBreakpoint)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location);
+
+typedef void (JNICALL *jvmtiEventClassFileLoadHook)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jclass class_being_redefined,
+ jobject loader,
+ const char* name,
+ jobject protection_domain,
+ jint class_data_len,
+ const unsigned char* class_data,
+ jint* new_class_data_len,
+ unsigned char** new_class_data);
+
+typedef void (JNICALL *jvmtiEventClassLoad)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jclass klass);
+
+typedef void (JNICALL *jvmtiEventClassPrepare)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jclass klass);
+
+typedef void (JNICALL *jvmtiEventCompiledMethodLoad)
+ (jvmtiEnv *jvmti_env,
+ jmethodID method,
+ jint code_size,
+ const void* code_addr,
+ jint map_length,
+ const jvmtiAddrLocationMap* map,
+ const void* compile_info);
+
+typedef void (JNICALL *jvmtiEventCompiledMethodUnload)
+ (jvmtiEnv *jvmti_env,
+ jmethodID method,
+ const void* code_addr);
+
+typedef void (JNICALL *jvmtiEventDataDumpRequest)
+ (jvmtiEnv *jvmti_env);
+
+typedef void (JNICALL *jvmtiEventDynamicCodeGenerated)
+ (jvmtiEnv *jvmti_env,
+ const char* name,
+ const void* address,
+ jint length);
+
+typedef void (JNICALL *jvmtiEventException)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jobject exception,
+ jmethodID catch_method,
+ jlocation catch_location);
+
+typedef void (JNICALL *jvmtiEventExceptionCatch)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jobject exception);
+
+typedef void (JNICALL *jvmtiEventFieldAccess)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jclass field_klass,
+ jobject object,
+ jfieldID field);
+
+typedef void (JNICALL *jvmtiEventFieldModification)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jclass field_klass,
+ jobject object,
+ jfieldID field,
+ char signature_type,
+ jvalue new_value);
+
+typedef void (JNICALL *jvmtiEventFramePop)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jboolean was_popped_by_exception);
+
+typedef void (JNICALL *jvmtiEventGarbageCollectionFinish)
+ (jvmtiEnv *jvmti_env);
+
+typedef void (JNICALL *jvmtiEventGarbageCollectionStart)
+ (jvmtiEnv *jvmti_env);
+
+typedef void (JNICALL *jvmtiEventMethodEntry)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method);
+
+typedef void (JNICALL *jvmtiEventMethodExit)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jboolean was_popped_by_exception,
+ jvalue return_value);
+
+typedef void (JNICALL *jvmtiEventMonitorContendedEnter)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object);
+
+typedef void (JNICALL *jvmtiEventMonitorContendedEntered)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object);
+
+typedef void (JNICALL *jvmtiEventMonitorWait)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object,
+ jlong timeout);
+
+typedef void (JNICALL *jvmtiEventMonitorWaited)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object,
+ jboolean timed_out);
+
+typedef void (JNICALL *jvmtiEventNativeMethodBind)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ void* address,
+ void** new_address_ptr);
+
+typedef void (JNICALL *jvmtiEventObjectFree)
+ (jvmtiEnv *jvmti_env,
+ jlong tag);
+
+typedef void (JNICALL *jvmtiEventResourceExhausted)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jint flags,
+ const void* reserved,
+ const char* description);
+
+typedef void (JNICALL *jvmtiEventSingleStep)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location);
+
+typedef void (JNICALL *jvmtiEventThreadEnd)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread);
+
+typedef void (JNICALL *jvmtiEventThreadStart)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread);
+
+typedef void (JNICALL *jvmtiEventVMDeath)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env);
+
+typedef void (JNICALL *jvmtiEventVMInit)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread);
+
+typedef void (JNICALL *jvmtiEventVMObjectAlloc)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object,
+ jclass object_klass,
+ jlong size);
+
+typedef void (JNICALL *jvmtiEventVMStart)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env);
+
+ /* Event Callback Structure */
+
+typedef struct {
+ /* 50 : VM Initialization Event */
+ jvmtiEventVMInit VMInit;
+ /* 51 : VM Death Event */
+ jvmtiEventVMDeath VMDeath;
+ /* 52 : Thread Start */
+ jvmtiEventThreadStart ThreadStart;
+ /* 53 : Thread End */
+ jvmtiEventThreadEnd ThreadEnd;
+ /* 54 : Class File Load Hook */
+ jvmtiEventClassFileLoadHook ClassFileLoadHook;
+ /* 55 : Class Load */
+ jvmtiEventClassLoad ClassLoad;
+ /* 56 : Class Prepare */
+ jvmtiEventClassPrepare ClassPrepare;
+ /* 57 : VM Start Event */
+ jvmtiEventVMStart VMStart;
+ /* 58 : Exception */
+ jvmtiEventException Exception;
+ /* 59 : Exception Catch */
+ jvmtiEventExceptionCatch ExceptionCatch;
+ /* 60 : Single Step */
+ jvmtiEventSingleStep SingleStep;
+ /* 61 : Frame Pop */
+ jvmtiEventFramePop FramePop;
+ /* 62 : Breakpoint */
+ jvmtiEventBreakpoint Breakpoint;
+ /* 63 : Field Access */
+ jvmtiEventFieldAccess FieldAccess;
+ /* 64 : Field Modification */
+ jvmtiEventFieldModification FieldModification;
+ /* 65 : Method Entry */
+ jvmtiEventMethodEntry MethodEntry;
+ /* 66 : Method Exit */
+ jvmtiEventMethodExit MethodExit;
+ /* 67 : Native Method Bind */
+ jvmtiEventNativeMethodBind NativeMethodBind;
+ /* 68 : Compiled Method Load */
+ jvmtiEventCompiledMethodLoad CompiledMethodLoad;
+ /* 69 : Compiled Method Unload */
+ jvmtiEventCompiledMethodUnload CompiledMethodUnload;
+ /* 70 : Dynamic Code Generated */
+ jvmtiEventDynamicCodeGenerated DynamicCodeGenerated;
+ /* 71 : Data Dump Request */
+ jvmtiEventDataDumpRequest DataDumpRequest;
+ /* 72 */
+ jvmtiEventReserved reserved72;
+ /* 73 : Monitor Wait */
+ jvmtiEventMonitorWait MonitorWait;
+ /* 74 : Monitor Waited */
+ jvmtiEventMonitorWaited MonitorWaited;
+ /* 75 : Monitor Contended Enter */
+ jvmtiEventMonitorContendedEnter MonitorContendedEnter;
+ /* 76 : Monitor Contended Entered */
+ jvmtiEventMonitorContendedEntered MonitorContendedEntered;
+ /* 77 */
+ jvmtiEventReserved reserved77;
+ /* 78 */
+ jvmtiEventReserved reserved78;
+ /* 79 */
+ jvmtiEventReserved reserved79;
+ /* 80 : Resource Exhausted */
+ jvmtiEventResourceExhausted ResourceExhausted;
+ /* 81 : Garbage Collection Start */
+ jvmtiEventGarbageCollectionStart GarbageCollectionStart;
+ /* 82 : Garbage Collection Finish */
+ jvmtiEventGarbageCollectionFinish GarbageCollectionFinish;
+ /* 83 : Object Free */
+ jvmtiEventObjectFree ObjectFree;
+ /* 84 : VM Object Allocation */
+ jvmtiEventVMObjectAlloc VMObjectAlloc;
+} jvmtiEventCallbacks;
+
+
+ /* Function Interface */
+
+typedef struct jvmtiInterface_1_ {
+
+ /* 1 : RESERVED */
+ void *reserved1;
+
+ /* 2 : Set Event Notification Mode */
+ jvmtiError (JNICALL *SetEventNotificationMode) (jvmtiEnv* env,
+ jvmtiEventMode mode,
+ jvmtiEvent event_type,
+ jthread event_thread,
+ ...);
+
+ /* 3 : RESERVED */
+ void *reserved3;
+
+ /* 4 : Get All Threads */
+ jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env,
+ jint* threads_count_ptr,
+ jthread** threads_ptr);
+
+ /* 5 : Suspend Thread */
+ jvmtiError (JNICALL *SuspendThread) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 6 : Resume Thread */
+ jvmtiError (JNICALL *ResumeThread) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 7 : Stop Thread */
+ jvmtiError (JNICALL *StopThread) (jvmtiEnv* env,
+ jthread thread,
+ jobject exception);
+
+ /* 8 : Interrupt Thread */
+ jvmtiError (JNICALL *InterruptThread) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 9 : Get Thread Info */
+ jvmtiError (JNICALL *GetThreadInfo) (jvmtiEnv* env,
+ jthread thread,
+ jvmtiThreadInfo* info_ptr);
+
+ /* 10 : Get Owned Monitor Info */
+ jvmtiError (JNICALL *GetOwnedMonitorInfo) (jvmtiEnv* env,
+ jthread thread,
+ jint* owned_monitor_count_ptr,
+ jobject** owned_monitors_ptr);
+
+ /* 11 : Get Current Contended Monitor */
+ jvmtiError (JNICALL *GetCurrentContendedMonitor) (jvmtiEnv* env,
+ jthread thread,
+ jobject* monitor_ptr);
+
+ /* 12 : Run Agent Thread */
+ jvmtiError (JNICALL *RunAgentThread) (jvmtiEnv* env,
+ jthread thread,
+ jvmtiStartFunction proc,
+ const void* arg,
+ jint priority);
+
+ /* 13 : Get Top Thread Groups */
+ jvmtiError (JNICALL *GetTopThreadGroups) (jvmtiEnv* env,
+ jint* group_count_ptr,
+ jthreadGroup** groups_ptr);
+
+ /* 14 : Get Thread Group Info */
+ jvmtiError (JNICALL *GetThreadGroupInfo) (jvmtiEnv* env,
+ jthreadGroup group,
+ jvmtiThreadGroupInfo* info_ptr);
+
+ /* 15 : Get Thread Group Children */
+ jvmtiError (JNICALL *GetThreadGroupChildren) (jvmtiEnv* env,
+ jthreadGroup group,
+ jint* thread_count_ptr,
+ jthread** threads_ptr,
+ jint* group_count_ptr,
+ jthreadGroup** groups_ptr);
+
+ /* 16 : Get Frame Count */
+ jvmtiError (JNICALL *GetFrameCount) (jvmtiEnv* env,
+ jthread thread,
+ jint* count_ptr);
+
+ /* 17 : Get Thread State */
+ jvmtiError (JNICALL *GetThreadState) (jvmtiEnv* env,
+ jthread thread,
+ jint* thread_state_ptr);
+
+ /* 18 : Get Current Thread */
+ jvmtiError (JNICALL *GetCurrentThread) (jvmtiEnv* env,
+ jthread* thread_ptr);
+
+ /* 19 : Get Frame Location */
+ jvmtiError (JNICALL *GetFrameLocation) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jmethodID* method_ptr,
+ jlocation* location_ptr);
+
+ /* 20 : Notify Frame Pop */
+ jvmtiError (JNICALL *NotifyFramePop) (jvmtiEnv* env,
+ jthread thread,
+ jint depth);
+
+ /* 21 : Get Local Variable - Object */
+ jvmtiError (JNICALL *GetLocalObject) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jobject* value_ptr);
+
+ /* 22 : Get Local Variable - Int */
+ jvmtiError (JNICALL *GetLocalInt) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jint* value_ptr);
+
+ /* 23 : Get Local Variable - Long */
+ jvmtiError (JNICALL *GetLocalLong) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jlong* value_ptr);
+
+ /* 24 : Get Local Variable - Float */
+ jvmtiError (JNICALL *GetLocalFloat) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jfloat* value_ptr);
+
+ /* 25 : Get Local Variable - Double */
+ jvmtiError (JNICALL *GetLocalDouble) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jdouble* value_ptr);
+
+ /* 26 : Set Local Variable - Object */
+ jvmtiError (JNICALL *SetLocalObject) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jobject value);
+
+ /* 27 : Set Local Variable - Int */
+ jvmtiError (JNICALL *SetLocalInt) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jint value);
+
+ /* 28 : Set Local Variable - Long */
+ jvmtiError (JNICALL *SetLocalLong) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jlong value);
+
+ /* 29 : Set Local Variable - Float */
+ jvmtiError (JNICALL *SetLocalFloat) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jfloat value);
+
+ /* 30 : Set Local Variable - Double */
+ jvmtiError (JNICALL *SetLocalDouble) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jdouble value);
+
+ /* 31 : Create Raw Monitor */
+ jvmtiError (JNICALL *CreateRawMonitor) (jvmtiEnv* env,
+ const char* name,
+ jrawMonitorID* monitor_ptr);
+
+ /* 32 : Destroy Raw Monitor */
+ jvmtiError (JNICALL *DestroyRawMonitor) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 33 : Raw Monitor Enter */
+ jvmtiError (JNICALL *RawMonitorEnter) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 34 : Raw Monitor Exit */
+ jvmtiError (JNICALL *RawMonitorExit) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 35 : Raw Monitor Wait */
+ jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv* env,
+ jrawMonitorID monitor,
+ jlong millis);
+
+ /* 36 : Raw Monitor Notify */
+ jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 37 : Raw Monitor Notify All */
+ jvmtiError (JNICALL *RawMonitorNotifyAll) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 38 : Set Breakpoint */
+ jvmtiError (JNICALL *SetBreakpoint) (jvmtiEnv* env,
+ jmethodID method,
+ jlocation location);
+
+ /* 39 : Clear Breakpoint */
+ jvmtiError (JNICALL *ClearBreakpoint) (jvmtiEnv* env,
+ jmethodID method,
+ jlocation location);
+
+ /* 40 : RESERVED */
+ void *reserved40;
+
+ /* 41 : Set Field Access Watch */
+ jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 42 : Clear Field Access Watch */
+ jvmtiError (JNICALL *ClearFieldAccessWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 43 : Set Field Modification Watch */
+ jvmtiError (JNICALL *SetFieldModificationWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 44 : Clear Field Modification Watch */
+ jvmtiError (JNICALL *ClearFieldModificationWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 45 : Is Modifiable Class */
+ jvmtiError (JNICALL *IsModifiableClass) (jvmtiEnv* env,
+ jclass klass,
+ jboolean* is_modifiable_class_ptr);
+
+ /* 46 : Allocate */
+ jvmtiError (JNICALL *Allocate) (jvmtiEnv* env,
+ jlong size,
+ unsigned char** mem_ptr);
+
+ /* 47 : Deallocate */
+ jvmtiError (JNICALL *Deallocate) (jvmtiEnv* env,
+ unsigned char* mem);
+
+ /* 48 : Get Class Signature */
+ jvmtiError (JNICALL *GetClassSignature) (jvmtiEnv* env,
+ jclass klass,
+ char** signature_ptr,
+ char** generic_ptr);
+
+ /* 49 : Get Class Status */
+ jvmtiError (JNICALL *GetClassStatus) (jvmtiEnv* env,
+ jclass klass,
+ jint* status_ptr);
+
+ /* 50 : Get Source File Name */
+ jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv* env,
+ jclass klass,
+ char** source_name_ptr);
+
+ /* 51 : Get Class Modifiers */
+ jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv* env,
+ jclass klass,
+ jint* modifiers_ptr);
+
+ /* 52 : Get Class Methods */
+ jvmtiError (JNICALL *GetClassMethods) (jvmtiEnv* env,
+ jclass klass,
+ jint* method_count_ptr,
+ jmethodID** methods_ptr);
+
+ /* 53 : Get Class Fields */
+ jvmtiError (JNICALL *GetClassFields) (jvmtiEnv* env,
+ jclass klass,
+ jint* field_count_ptr,
+ jfieldID** fields_ptr);
+
+ /* 54 : Get Implemented Interfaces */
+ jvmtiError (JNICALL *GetImplementedInterfaces) (jvmtiEnv* env,
+ jclass klass,
+ jint* interface_count_ptr,
+ jclass** interfaces_ptr);
+
+ /* 55 : Is Interface */
+ jvmtiError (JNICALL *IsInterface) (jvmtiEnv* env,
+ jclass klass,
+ jboolean* is_interface_ptr);
+
+ /* 56 : Is Array Class */
+ jvmtiError (JNICALL *IsArrayClass) (jvmtiEnv* env,
+ jclass klass,
+ jboolean* is_array_class_ptr);
+
+ /* 57 : Get Class Loader */
+ jvmtiError (JNICALL *GetClassLoader) (jvmtiEnv* env,
+ jclass klass,
+ jobject* classloader_ptr);
+
+ /* 58 : Get Object Hash Code */
+ jvmtiError (JNICALL *GetObjectHashCode) (jvmtiEnv* env,
+ jobject object,
+ jint* hash_code_ptr);
+
+ /* 59 : Get Object Monitor Usage */
+ jvmtiError (JNICALL *GetObjectMonitorUsage) (jvmtiEnv* env,
+ jobject object,
+ jvmtiMonitorUsage* info_ptr);
+
+ /* 60 : Get Field Name (and Signature) */
+ jvmtiError (JNICALL *GetFieldName) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr);
+
+ /* 61 : Get Field Declaring Class */
+ jvmtiError (JNICALL *GetFieldDeclaringClass) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ jclass* declaring_class_ptr);
+
+ /* 62 : Get Field Modifiers */
+ jvmtiError (JNICALL *GetFieldModifiers) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ jint* modifiers_ptr);
+
+ /* 63 : Is Field Synthetic */
+ jvmtiError (JNICALL *IsFieldSynthetic) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ jboolean* is_synthetic_ptr);
+
+ /* 64 : Get Method Name (and Signature) */
+ jvmtiError (JNICALL *GetMethodName) (jvmtiEnv* env,
+ jmethodID method,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr);
+
+ /* 65 : Get Method Declaring Class */
+ jvmtiError (JNICALL *GetMethodDeclaringClass) (jvmtiEnv* env,
+ jmethodID method,
+ jclass* declaring_class_ptr);
+
+ /* 66 : Get Method Modifiers */
+ jvmtiError (JNICALL *GetMethodModifiers) (jvmtiEnv* env,
+ jmethodID method,
+ jint* modifiers_ptr);
+
+ /* 67 : RESERVED */
+ void *reserved67;
+
+ /* 68 : Get Max Locals */
+ jvmtiError (JNICALL *GetMaxLocals) (jvmtiEnv* env,
+ jmethodID method,
+ jint* max_ptr);
+
+ /* 69 : Get Arguments Size */
+ jvmtiError (JNICALL *GetArgumentsSize) (jvmtiEnv* env,
+ jmethodID method,
+ jint* size_ptr);
+
+ /* 70 : Get Line Number Table */
+ jvmtiError (JNICALL *GetLineNumberTable) (jvmtiEnv* env,
+ jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLineNumberEntry** table_ptr);
+
+ /* 71 : Get Method Location */
+ jvmtiError (JNICALL *GetMethodLocation) (jvmtiEnv* env,
+ jmethodID method,
+ jlocation* start_location_ptr,
+ jlocation* end_location_ptr);
+
+ /* 72 : Get Local Variable Table */
+ jvmtiError (JNICALL *GetLocalVariableTable) (jvmtiEnv* env,
+ jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLocalVariableEntry** table_ptr);
+
+ /* 73 : Set Native Method Prefix */
+ jvmtiError (JNICALL *SetNativeMethodPrefix) (jvmtiEnv* env,
+ const char* prefix);
+
+ /* 74 : Set Native Method Prefixes */
+ jvmtiError (JNICALL *SetNativeMethodPrefixes) (jvmtiEnv* env,
+ jint prefix_count,
+ char** prefixes);
+
+ /* 75 : Get Bytecodes */
+ jvmtiError (JNICALL *GetBytecodes) (jvmtiEnv* env,
+ jmethodID method,
+ jint* bytecode_count_ptr,
+ unsigned char** bytecodes_ptr);
+
+ /* 76 : Is Method Native */
+ jvmtiError (JNICALL *IsMethodNative) (jvmtiEnv* env,
+ jmethodID method,
+ jboolean* is_native_ptr);
+
+ /* 77 : Is Method Synthetic */
+ jvmtiError (JNICALL *IsMethodSynthetic) (jvmtiEnv* env,
+ jmethodID method,
+ jboolean* is_synthetic_ptr);
+
+ /* 78 : Get Loaded Classes */
+ jvmtiError (JNICALL *GetLoadedClasses) (jvmtiEnv* env,
+ jint* class_count_ptr,
+ jclass** classes_ptr);
+
+ /* 79 : Get Classloader Classes */
+ jvmtiError (JNICALL *GetClassLoaderClasses) (jvmtiEnv* env,
+ jobject initiating_loader,
+ jint* class_count_ptr,
+ jclass** classes_ptr);
+
+ /* 80 : Pop Frame */
+ jvmtiError (JNICALL *PopFrame) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 81 : Force Early Return - Object */
+ jvmtiError (JNICALL *ForceEarlyReturnObject) (jvmtiEnv* env,
+ jthread thread,
+ jobject value);
+
+ /* 82 : Force Early Return - Int */
+ jvmtiError (JNICALL *ForceEarlyReturnInt) (jvmtiEnv* env,
+ jthread thread,
+ jint value);
+
+ /* 83 : Force Early Return - Long */
+ jvmtiError (JNICALL *ForceEarlyReturnLong) (jvmtiEnv* env,
+ jthread thread,
+ jlong value);
+
+ /* 84 : Force Early Return - Float */
+ jvmtiError (JNICALL *ForceEarlyReturnFloat) (jvmtiEnv* env,
+ jthread thread,
+ jfloat value);
+
+ /* 85 : Force Early Return - Double */
+ jvmtiError (JNICALL *ForceEarlyReturnDouble) (jvmtiEnv* env,
+ jthread thread,
+ jdouble value);
+
+ /* 86 : Force Early Return - Void */
+ jvmtiError (JNICALL *ForceEarlyReturnVoid) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 87 : Redefine Classes */
+ jvmtiError (JNICALL *RedefineClasses) (jvmtiEnv* env,
+ jint class_count,
+ const jvmtiClassDefinition* class_definitions);
+
+ /* 88 : Get Version Number */
+ jvmtiError (JNICALL *GetVersionNumber) (jvmtiEnv* env,
+ jint* version_ptr);
+
+ /* 89 : Get Capabilities */
+ jvmtiError (JNICALL *GetCapabilities) (jvmtiEnv* env,
+ jvmtiCapabilities* capabilities_ptr);
+
+ /* 90 : Get Source Debug Extension */
+ jvmtiError (JNICALL *GetSourceDebugExtension) (jvmtiEnv* env,
+ jclass klass,
+ char** source_debug_extension_ptr);
+
+ /* 91 : Is Method Obsolete */
+ jvmtiError (JNICALL *IsMethodObsolete) (jvmtiEnv* env,
+ jmethodID method,
+ jboolean* is_obsolete_ptr);
+
+ /* 92 : Suspend Thread List */
+ jvmtiError (JNICALL *SuspendThreadList) (jvmtiEnv* env,
+ jint request_count,
+ const jthread* request_list,
+ jvmtiError* results);
+
+ /* 93 : Resume Thread List */
+ jvmtiError (JNICALL *ResumeThreadList) (jvmtiEnv* env,
+ jint request_count,
+ const jthread* request_list,
+ jvmtiError* results);
+
+ /* 94 : RESERVED */
+ void *reserved94;
+
+ /* 95 : RESERVED */
+ void *reserved95;
+
+ /* 96 : RESERVED */
+ void *reserved96;
+
+ /* 97 : RESERVED */
+ void *reserved97;
+
+ /* 98 : RESERVED */
+ void *reserved98;
+
+ /* 99 : RESERVED */
+ void *reserved99;
+
+ /* 100 : Get All Stack Traces */
+ jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env,
+ jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr,
+ jint* thread_count_ptr);
+
+ /* 101 : Get Thread List Stack Traces */
+ jvmtiError (JNICALL *GetThreadListStackTraces) (jvmtiEnv* env,
+ jint thread_count,
+ const jthread* thread_list,
+ jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr);
+
+ /* 102 : Get Thread Local Storage */
+ jvmtiError (JNICALL *GetThreadLocalStorage) (jvmtiEnv* env,
+ jthread thread,
+ void** data_ptr);
+
+ /* 103 : Set Thread Local Storage */
+ jvmtiError (JNICALL *SetThreadLocalStorage) (jvmtiEnv* env,
+ jthread thread,
+ const void* data);
+
+ /* 104 : Get Stack Trace */
+ jvmtiError (JNICALL *GetStackTrace) (jvmtiEnv* env,
+ jthread thread,
+ jint start_depth,
+ jint max_frame_count,
+ jvmtiFrameInfo* frame_buffer,
+ jint* count_ptr);
+
+ /* 105 : RESERVED */
+ void *reserved105;
+
+ /* 106 : Get Tag */
+ jvmtiError (JNICALL *GetTag) (jvmtiEnv* env,
+ jobject object,
+ jlong* tag_ptr);
+
+ /* 107 : Set Tag */
+ jvmtiError (JNICALL *SetTag) (jvmtiEnv* env,
+ jobject object,
+ jlong tag);
+
+ /* 108 : Force Garbage Collection */
+ jvmtiError (JNICALL *ForceGarbageCollection) (jvmtiEnv* env);
+
+ /* 109 : Iterate Over Objects Reachable From Object */
+ jvmtiError (JNICALL *IterateOverObjectsReachableFromObject) (jvmtiEnv* env,
+ jobject object,
+ jvmtiObjectReferenceCallback object_reference_callback,
+ const void* user_data);
+
+ /* 110 : Iterate Over Reachable Objects */
+ jvmtiError (JNICALL *IterateOverReachableObjects) (jvmtiEnv* env,
+ jvmtiHeapRootCallback heap_root_callback,
+ jvmtiStackReferenceCallback stack_ref_callback,
+ jvmtiObjectReferenceCallback object_ref_callback,
+ const void* user_data);
+
+ /* 111 : Iterate Over Heap */
+ jvmtiError (JNICALL *IterateOverHeap) (jvmtiEnv* env,
+ jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data);
+
+ /* 112 : Iterate Over Instances Of Class */
+ jvmtiError (JNICALL *IterateOverInstancesOfClass) (jvmtiEnv* env,
+ jclass klass,
+ jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data);
+
+ /* 113 : RESERVED */
+ void *reserved113;
+
+ /* 114 : Get Objects With Tags */
+ jvmtiError (JNICALL *GetObjectsWithTags) (jvmtiEnv* env,
+ jint tag_count,
+ const jlong* tags,
+ jint* count_ptr,
+ jobject** object_result_ptr,
+ jlong** tag_result_ptr);
+
+ /* 115 : Follow References */
+ jvmtiError (JNICALL *FollowReferences) (jvmtiEnv* env,
+ jint heap_filter,
+ jclass klass,
+ jobject initial_object,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data);
+
+ /* 116 : Iterate Through Heap */
+ jvmtiError (JNICALL *IterateThroughHeap) (jvmtiEnv* env,
+ jint heap_filter,
+ jclass klass,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data);
+
+ /* 117 : RESERVED */
+ void *reserved117;
+
+ /* 118 : RESERVED */
+ void *reserved118;
+
+ /* 119 : RESERVED */
+ void *reserved119;
+
+ /* 120 : Set JNI Function Table */
+ jvmtiError (JNICALL *SetJNIFunctionTable) (jvmtiEnv* env,
+ const jniNativeInterface* function_table);
+
+ /* 121 : Get JNI Function Table */
+ jvmtiError (JNICALL *GetJNIFunctionTable) (jvmtiEnv* env,
+ jniNativeInterface** function_table);
+
+ /* 122 : Set Event Callbacks */
+ jvmtiError (JNICALL *SetEventCallbacks) (jvmtiEnv* env,
+ const jvmtiEventCallbacks* callbacks,
+ jint size_of_callbacks);
+
+ /* 123 : Generate Events */
+ jvmtiError (JNICALL *GenerateEvents) (jvmtiEnv* env,
+ jvmtiEvent event_type);
+
+ /* 124 : Get Extension Functions */
+ jvmtiError (JNICALL *GetExtensionFunctions) (jvmtiEnv* env,
+ jint* extension_count_ptr,
+ jvmtiExtensionFunctionInfo** extensions);
+
+ /* 125 : Get Extension Events */
+ jvmtiError (JNICALL *GetExtensionEvents) (jvmtiEnv* env,
+ jint* extension_count_ptr,
+ jvmtiExtensionEventInfo** extensions);
+
+ /* 126 : Set Extension Event Callback */
+ jvmtiError (JNICALL *SetExtensionEventCallback) (jvmtiEnv* env,
+ jint extension_event_index,
+ jvmtiExtensionEvent callback);
+
+ /* 127 : Dispose Environment */
+ jvmtiError (JNICALL *DisposeEnvironment) (jvmtiEnv* env);
+
+ /* 128 : Get Error Name */
+ jvmtiError (JNICALL *GetErrorName) (jvmtiEnv* env,
+ jvmtiError error,
+ char** name_ptr);
+
+ /* 129 : Get JLocation Format */
+ jvmtiError (JNICALL *GetJLocationFormat) (jvmtiEnv* env,
+ jvmtiJlocationFormat* format_ptr);
+
+ /* 130 : Get System Properties */
+ jvmtiError (JNICALL *GetSystemProperties) (jvmtiEnv* env,
+ jint* count_ptr,
+ char*** property_ptr);
+
+ /* 131 : Get System Property */
+ jvmtiError (JNICALL *GetSystemProperty) (jvmtiEnv* env,
+ const char* property,
+ char** value_ptr);
+
+ /* 132 : Set System Property */
+ jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env,
+ const char* property,
+ const char* value);
+
+ /* 133 : Get Phase */
+ jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env,
+ jvmtiPhase* phase_ptr);
+
+ /* 134 : Get Current Thread CPU Timer Information */
+ jvmtiError (JNICALL *GetCurrentThreadCpuTimerInfo) (jvmtiEnv* env,
+ jvmtiTimerInfo* info_ptr);
+
+ /* 135 : Get Current Thread CPU Time */
+ jvmtiError (JNICALL *GetCurrentThreadCpuTime) (jvmtiEnv* env,
+ jlong* nanos_ptr);
+
+ /* 136 : Get Thread CPU Timer Information */
+ jvmtiError (JNICALL *GetThreadCpuTimerInfo) (jvmtiEnv* env,
+ jvmtiTimerInfo* info_ptr);
+
+ /* 137 : Get Thread CPU Time */
+ jvmtiError (JNICALL *GetThreadCpuTime) (jvmtiEnv* env,
+ jthread thread,
+ jlong* nanos_ptr);
+
+ /* 138 : Get Timer Information */
+ jvmtiError (JNICALL *GetTimerInfo) (jvmtiEnv* env,
+ jvmtiTimerInfo* info_ptr);
+
+ /* 139 : Get Time */
+ jvmtiError (JNICALL *GetTime) (jvmtiEnv* env,
+ jlong* nanos_ptr);
+
+ /* 140 : Get Potential Capabilities */
+ jvmtiError (JNICALL *GetPotentialCapabilities) (jvmtiEnv* env,
+ jvmtiCapabilities* capabilities_ptr);
+
+ /* 141 : RESERVED */
+ void *reserved141;
+
+ /* 142 : Add Capabilities */
+ jvmtiError (JNICALL *AddCapabilities) (jvmtiEnv* env,
+ const jvmtiCapabilities* capabilities_ptr);
+
+ /* 143 : Relinquish Capabilities */
+ jvmtiError (JNICALL *RelinquishCapabilities) (jvmtiEnv* env,
+ const jvmtiCapabilities* capabilities_ptr);
+
+ /* 144 : Get Available Processors */
+ jvmtiError (JNICALL *GetAvailableProcessors) (jvmtiEnv* env,
+ jint* processor_count_ptr);
+
+ /* 145 : Get Class Version Numbers */
+ jvmtiError (JNICALL *GetClassVersionNumbers) (jvmtiEnv* env,
+ jclass klass,
+ jint* minor_version_ptr,
+ jint* major_version_ptr);
+
+ /* 146 : Get Constant Pool */
+ jvmtiError (JNICALL *GetConstantPool) (jvmtiEnv* env,
+ jclass klass,
+ jint* constant_pool_count_ptr,
+ jint* constant_pool_byte_count_ptr,
+ unsigned char** constant_pool_bytes_ptr);
+
+ /* 147 : Get Environment Local Storage */
+ jvmtiError (JNICALL *GetEnvironmentLocalStorage) (jvmtiEnv* env,
+ void** data_ptr);
+
+ /* 148 : Set Environment Local Storage */
+ jvmtiError (JNICALL *SetEnvironmentLocalStorage) (jvmtiEnv* env,
+ const void* data);
+
+ /* 149 : Add To Bootstrap Class Loader Search */
+ jvmtiError (JNICALL *AddToBootstrapClassLoaderSearch) (jvmtiEnv* env,
+ const char* segment);
+
+ /* 150 : Set Verbose Flag */
+ jvmtiError (JNICALL *SetVerboseFlag) (jvmtiEnv* env,
+ jvmtiVerboseFlag flag,
+ jboolean value);
+
+ /* 151 : Add To System Class Loader Search */
+ jvmtiError (JNICALL *AddToSystemClassLoaderSearch) (jvmtiEnv* env,
+ const char* segment);
+
+ /* 152 : Retransform Classes */
+ jvmtiError (JNICALL *RetransformClasses) (jvmtiEnv* env,
+ jint class_count,
+ const jclass* classes);
+
+ /* 153 : Get Owned Monitor Stack Depth Info */
+ jvmtiError (JNICALL *GetOwnedMonitorStackDepthInfo) (jvmtiEnv* env,
+ jthread thread,
+ jint* monitor_info_count_ptr,
+ jvmtiMonitorStackDepthInfo** monitor_info_ptr);
+
+ /* 154 : Get Object Size */
+ jvmtiError (JNICALL *GetObjectSize) (jvmtiEnv* env,
+ jobject object,
+ jlong* size_ptr);
+
+ /* 155 : Get Local Instance */
+ jvmtiError (JNICALL *GetLocalInstance) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jobject* value_ptr);
+
+} jvmtiInterface_1;
+
+struct _jvmtiEnv {
+ const struct jvmtiInterface_1_ *functions;
+#ifdef __cplusplus
+
+
+ jvmtiError Allocate(jlong size,
+ unsigned char** mem_ptr) {
+ return functions->Allocate(this, size, mem_ptr);
+ }
+
+ jvmtiError Deallocate(unsigned char* mem) {
+ return functions->Deallocate(this, mem);
+ }
+
+ jvmtiError GetThreadState(jthread thread,
+ jint* thread_state_ptr) {
+ return functions->GetThreadState(this, thread, thread_state_ptr);
+ }
+
+ jvmtiError GetCurrentThread(jthread* thread_ptr) {
+ return functions->GetCurrentThread(this, thread_ptr);
+ }
+
+ jvmtiError GetAllThreads(jint* threads_count_ptr,
+ jthread** threads_ptr) {
+ return functions->GetAllThreads(this, threads_count_ptr, threads_ptr);
+ }
+
+ jvmtiError SuspendThread(jthread thread) {
+ return functions->SuspendThread(this, thread);
+ }
+
+ jvmtiError SuspendThreadList(jint request_count,
+ const jthread* request_list,
+ jvmtiError* results) {
+ return functions->SuspendThreadList(this, request_count, request_list, results);
+ }
+
+ jvmtiError ResumeThread(jthread thread) {
+ return functions->ResumeThread(this, thread);
+ }
+
+ jvmtiError ResumeThreadList(jint request_count,
+ const jthread* request_list,
+ jvmtiError* results) {
+ return functions->ResumeThreadList(this, request_count, request_list, results);
+ }
+
+ jvmtiError StopThread(jthread thread,
+ jobject exception) {
+ return functions->StopThread(this, thread, exception);
+ }
+
+ jvmtiError InterruptThread(jthread thread) {
+ return functions->InterruptThread(this, thread);
+ }
+
+ jvmtiError GetThreadInfo(jthread thread,
+ jvmtiThreadInfo* info_ptr) {
+ return functions->GetThreadInfo(this, thread, info_ptr);
+ }
+
+ jvmtiError GetOwnedMonitorInfo(jthread thread,
+ jint* owned_monitor_count_ptr,
+ jobject** owned_monitors_ptr) {
+ return functions->GetOwnedMonitorInfo(this, thread, owned_monitor_count_ptr, owned_monitors_ptr);
+ }
+
+ jvmtiError GetOwnedMonitorStackDepthInfo(jthread thread,
+ jint* monitor_info_count_ptr,
+ jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
+ return functions->GetOwnedMonitorStackDepthInfo(this, thread, monitor_info_count_ptr, monitor_info_ptr);
+ }
+
+ jvmtiError GetCurrentContendedMonitor(jthread thread,
+ jobject* monitor_ptr) {
+ return functions->GetCurrentContendedMonitor(this, thread, monitor_ptr);
+ }
+
+ jvmtiError RunAgentThread(jthread thread,
+ jvmtiStartFunction proc,
+ const void* arg,
+ jint priority) {
+ return functions->RunAgentThread(this, thread, proc, arg, priority);
+ }
+
+ jvmtiError SetThreadLocalStorage(jthread thread,
+ const void* data) {
+ return functions->SetThreadLocalStorage(this, thread, data);
+ }
+
+ jvmtiError GetThreadLocalStorage(jthread thread,
+ void** data_ptr) {
+ return functions->GetThreadLocalStorage(this, thread, data_ptr);
+ }
+
+ jvmtiError GetTopThreadGroups(jint* group_count_ptr,
+ jthreadGroup** groups_ptr) {
+ return functions->GetTopThreadGroups(this, group_count_ptr, groups_ptr);
+ }
+
+ jvmtiError GetThreadGroupInfo(jthreadGroup group,
+ jvmtiThreadGroupInfo* info_ptr) {
+ return functions->GetThreadGroupInfo(this, group, info_ptr);
+ }
+
+ jvmtiError GetThreadGroupChildren(jthreadGroup group,
+ jint* thread_count_ptr,
+ jthread** threads_ptr,
+ jint* group_count_ptr,
+ jthreadGroup** groups_ptr) {
+ return functions->GetThreadGroupChildren(this, group, thread_count_ptr, threads_ptr, group_count_ptr, groups_ptr);
+ }
+
+ jvmtiError GetStackTrace(jthread thread,
+ jint start_depth,
+ jint max_frame_count,
+ jvmtiFrameInfo* frame_buffer,
+ jint* count_ptr) {
+ return functions->GetStackTrace(this, thread, start_depth, max_frame_count, frame_buffer, count_ptr);
+ }
+
+ jvmtiError GetAllStackTraces(jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr,
+ jint* thread_count_ptr) {
+ return functions->GetAllStackTraces(this, max_frame_count, stack_info_ptr, thread_count_ptr);
+ }
+
+ jvmtiError GetThreadListStackTraces(jint thread_count,
+ const jthread* thread_list,
+ jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr) {
+ return functions->GetThreadListStackTraces(this, thread_count, thread_list, max_frame_count, stack_info_ptr);
+ }
+
+ jvmtiError GetFrameCount(jthread thread,
+ jint* count_ptr) {
+ return functions->GetFrameCount(this, thread, count_ptr);
+ }
+
+ jvmtiError PopFrame(jthread thread) {
+ return functions->PopFrame(this, thread);
+ }
+
+ jvmtiError GetFrameLocation(jthread thread,
+ jint depth,
+ jmethodID* method_ptr,
+ jlocation* location_ptr) {
+ return functions->GetFrameLocation(this, thread, depth, method_ptr, location_ptr);
+ }
+
+ jvmtiError NotifyFramePop(jthread thread,
+ jint depth) {
+ return functions->NotifyFramePop(this, thread, depth);
+ }
+
+ jvmtiError ForceEarlyReturnObject(jthread thread,
+ jobject value) {
+ return functions->ForceEarlyReturnObject(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnInt(jthread thread,
+ jint value) {
+ return functions->ForceEarlyReturnInt(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnLong(jthread thread,
+ jlong value) {
+ return functions->ForceEarlyReturnLong(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnFloat(jthread thread,
+ jfloat value) {
+ return functions->ForceEarlyReturnFloat(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnDouble(jthread thread,
+ jdouble value) {
+ return functions->ForceEarlyReturnDouble(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnVoid(jthread thread) {
+ return functions->ForceEarlyReturnVoid(this, thread);
+ }
+
+ jvmtiError FollowReferences(jint heap_filter,
+ jclass klass,
+ jobject initial_object,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data) {
+ return functions->FollowReferences(this, heap_filter, klass, initial_object, callbacks, user_data);
+ }
+
+ jvmtiError IterateThroughHeap(jint heap_filter,
+ jclass klass,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data) {
+ return functions->IterateThroughHeap(this, heap_filter, klass, callbacks, user_data);
+ }
+
+ jvmtiError GetTag(jobject object,
+ jlong* tag_ptr) {
+ return functions->GetTag(this, object, tag_ptr);
+ }
+
+ jvmtiError SetTag(jobject object,
+ jlong tag) {
+ return functions->SetTag(this, object, tag);
+ }
+
+ jvmtiError GetObjectsWithTags(jint tag_count,
+ const jlong* tags,
+ jint* count_ptr,
+ jobject** object_result_ptr,
+ jlong** tag_result_ptr) {
+ return functions->GetObjectsWithTags(this, tag_count, tags, count_ptr, object_result_ptr, tag_result_ptr);
+ }
+
+ jvmtiError ForceGarbageCollection() {
+ return functions->ForceGarbageCollection(this);
+ }
+
+ jvmtiError IterateOverObjectsReachableFromObject(jobject object,
+ jvmtiObjectReferenceCallback object_reference_callback,
+ const void* user_data) {
+ return functions->IterateOverObjectsReachableFromObject(this, object, object_reference_callback, user_data);
+ }
+
+ jvmtiError IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback,
+ jvmtiStackReferenceCallback stack_ref_callback,
+ jvmtiObjectReferenceCallback object_ref_callback,
+ const void* user_data) {
+ return functions->IterateOverReachableObjects(this, heap_root_callback, stack_ref_callback, object_ref_callback, user_data);
+ }
+
+ jvmtiError IterateOverHeap(jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data) {
+ return functions->IterateOverHeap(this, object_filter, heap_object_callback, user_data);
+ }
+
+ jvmtiError IterateOverInstancesOfClass(jclass klass,
+ jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data) {
+ return functions->IterateOverInstancesOfClass(this, klass, object_filter, heap_object_callback, user_data);
+ }
+
+ jvmtiError GetLocalObject(jthread thread,
+ jint depth,
+ jint slot,
+ jobject* value_ptr) {
+ return functions->GetLocalObject(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalInstance(jthread thread,
+ jint depth,
+ jobject* value_ptr) {
+ return functions->GetLocalInstance(this, thread, depth, value_ptr);
+ }
+
+ jvmtiError GetLocalInt(jthread thread,
+ jint depth,
+ jint slot,
+ jint* value_ptr) {
+ return functions->GetLocalInt(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalLong(jthread thread,
+ jint depth,
+ jint slot,
+ jlong* value_ptr) {
+ return functions->GetLocalLong(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalFloat(jthread thread,
+ jint depth,
+ jint slot,
+ jfloat* value_ptr) {
+ return functions->GetLocalFloat(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalDouble(jthread thread,
+ jint depth,
+ jint slot,
+ jdouble* value_ptr) {
+ return functions->GetLocalDouble(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError SetLocalObject(jthread thread,
+ jint depth,
+ jint slot,
+ jobject value) {
+ return functions->SetLocalObject(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalInt(jthread thread,
+ jint depth,
+ jint slot,
+ jint value) {
+ return functions->SetLocalInt(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalLong(jthread thread,
+ jint depth,
+ jint slot,
+ jlong value) {
+ return functions->SetLocalLong(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalFloat(jthread thread,
+ jint depth,
+ jint slot,
+ jfloat value) {
+ return functions->SetLocalFloat(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalDouble(jthread thread,
+ jint depth,
+ jint slot,
+ jdouble value) {
+ return functions->SetLocalDouble(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetBreakpoint(jmethodID method,
+ jlocation location) {
+ return functions->SetBreakpoint(this, method, location);
+ }
+
+ jvmtiError ClearBreakpoint(jmethodID method,
+ jlocation location) {
+ return functions->ClearBreakpoint(this, method, location);
+ }
+
+ jvmtiError SetFieldAccessWatch(jclass klass,
+ jfieldID field) {
+ return functions->SetFieldAccessWatch(this, klass, field);
+ }
+
+ jvmtiError ClearFieldAccessWatch(jclass klass,
+ jfieldID field) {
+ return functions->ClearFieldAccessWatch(this, klass, field);
+ }
+
+ jvmtiError SetFieldModificationWatch(jclass klass,
+ jfieldID field) {
+ return functions->SetFieldModificationWatch(this, klass, field);
+ }
+
+ jvmtiError ClearFieldModificationWatch(jclass klass,
+ jfieldID field) {
+ return functions->ClearFieldModificationWatch(this, klass, field);
+ }
+
+ jvmtiError GetLoadedClasses(jint* class_count_ptr,
+ jclass** classes_ptr) {
+ return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr);
+ }
+
+ jvmtiError GetClassLoaderClasses(jobject initiating_loader,
+ jint* class_count_ptr,
+ jclass** classes_ptr) {
+ return functions->GetClassLoaderClasses(this, initiating_loader, class_count_ptr, classes_ptr);
+ }
+
+ jvmtiError GetClassSignature(jclass klass,
+ char** signature_ptr,
+ char** generic_ptr) {
+ return functions->GetClassSignature(this, klass, signature_ptr, generic_ptr);
+ }
+
+ jvmtiError GetClassStatus(jclass klass,
+ jint* status_ptr) {
+ return functions->GetClassStatus(this, klass, status_ptr);
+ }
+
+ jvmtiError GetSourceFileName(jclass klass,
+ char** source_name_ptr) {
+ return functions->GetSourceFileName(this, klass, source_name_ptr);
+ }
+
+ jvmtiError GetClassModifiers(jclass klass,
+ jint* modifiers_ptr) {
+ return functions->GetClassModifiers(this, klass, modifiers_ptr);
+ }
+
+ jvmtiError GetClassMethods(jclass klass,
+ jint* method_count_ptr,
+ jmethodID** methods_ptr) {
+ return functions->GetClassMethods(this, klass, method_count_ptr, methods_ptr);
+ }
+
+ jvmtiError GetClassFields(jclass klass,
+ jint* field_count_ptr,
+ jfieldID** fields_ptr) {
+ return functions->GetClassFields(this, klass, field_count_ptr, fields_ptr);
+ }
+
+ jvmtiError GetImplementedInterfaces(jclass klass,
+ jint* interface_count_ptr,
+ jclass** interfaces_ptr) {
+ return functions->GetImplementedInterfaces(this, klass, interface_count_ptr, interfaces_ptr);
+ }
+
+ jvmtiError GetClassVersionNumbers(jclass klass,
+ jint* minor_version_ptr,
+ jint* major_version_ptr) {
+ return functions->GetClassVersionNumbers(this, klass, minor_version_ptr, major_version_ptr);
+ }
+
+ jvmtiError GetConstantPool(jclass klass,
+ jint* constant_pool_count_ptr,
+ jint* constant_pool_byte_count_ptr,
+ unsigned char** constant_pool_bytes_ptr) {
+ return functions->GetConstantPool(this, klass, constant_pool_count_ptr, constant_pool_byte_count_ptr, constant_pool_bytes_ptr);
+ }
+
+ jvmtiError IsInterface(jclass klass,
+ jboolean* is_interface_ptr) {
+ return functions->IsInterface(this, klass, is_interface_ptr);
+ }
+
+ jvmtiError IsArrayClass(jclass klass,
+ jboolean* is_array_class_ptr) {
+ return functions->IsArrayClass(this, klass, is_array_class_ptr);
+ }
+
+ jvmtiError IsModifiableClass(jclass klass,
+ jboolean* is_modifiable_class_ptr) {
+ return functions->IsModifiableClass(this, klass, is_modifiable_class_ptr);
+ }
+
+ jvmtiError GetClassLoader(jclass klass,
+ jobject* classloader_ptr) {
+ return functions->GetClassLoader(this, klass, classloader_ptr);
+ }
+
+ jvmtiError GetSourceDebugExtension(jclass klass,
+ char** source_debug_extension_ptr) {
+ return functions->GetSourceDebugExtension(this, klass, source_debug_extension_ptr);
+ }
+
+ jvmtiError RetransformClasses(jint class_count,
+ const jclass* classes) {
+ return functions->RetransformClasses(this, class_count, classes);
+ }
+
+ jvmtiError RedefineClasses(jint class_count,
+ const jvmtiClassDefinition* class_definitions) {
+ return functions->RedefineClasses(this, class_count, class_definitions);
+ }
+
+ jvmtiError GetObjectSize(jobject object,
+ jlong* size_ptr) {
+ return functions->GetObjectSize(this, object, size_ptr);
+ }
+
+ jvmtiError GetObjectHashCode(jobject object,
+ jint* hash_code_ptr) {
+ return functions->GetObjectHashCode(this, object, hash_code_ptr);
+ }
+
+ jvmtiError GetObjectMonitorUsage(jobject object,
+ jvmtiMonitorUsage* info_ptr) {
+ return functions->GetObjectMonitorUsage(this, object, info_ptr);
+ }
+
+ jvmtiError GetFieldName(jclass klass,
+ jfieldID field,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr) {
+ return functions->GetFieldName(this, klass, field, name_ptr, signature_ptr, generic_ptr);
+ }
+
+ jvmtiError GetFieldDeclaringClass(jclass klass,
+ jfieldID field,
+ jclass* declaring_class_ptr) {
+ return functions->GetFieldDeclaringClass(this, klass, field, declaring_class_ptr);
+ }
+
+ jvmtiError GetFieldModifiers(jclass klass,
+ jfieldID field,
+ jint* modifiers_ptr) {
+ return functions->GetFieldModifiers(this, klass, field, modifiers_ptr);
+ }
+
+ jvmtiError IsFieldSynthetic(jclass klass,
+ jfieldID field,
+ jboolean* is_synthetic_ptr) {
+ return functions->IsFieldSynthetic(this, klass, field, is_synthetic_ptr);
+ }
+
+ jvmtiError GetMethodName(jmethodID method,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr) {
+ return functions->GetMethodName(this, method, name_ptr, signature_ptr, generic_ptr);
+ }
+
+ jvmtiError GetMethodDeclaringClass(jmethodID method,
+ jclass* declaring_class_ptr) {
+ return functions->GetMethodDeclaringClass(this, method, declaring_class_ptr);
+ }
+
+ jvmtiError GetMethodModifiers(jmethodID method,
+ jint* modifiers_ptr) {
+ return functions->GetMethodModifiers(this, method, modifiers_ptr);
+ }
+
+ jvmtiError GetMaxLocals(jmethodID method,
+ jint* max_ptr) {
+ return functions->GetMaxLocals(this, method, max_ptr);
+ }
+
+ jvmtiError GetArgumentsSize(jmethodID method,
+ jint* size_ptr) {
+ return functions->GetArgumentsSize(this, method, size_ptr);
+ }
+
+ jvmtiError GetLineNumberTable(jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLineNumberEntry** table_ptr) {
+ return functions->GetLineNumberTable(this, method, entry_count_ptr, table_ptr);
+ }
+
+ jvmtiError GetMethodLocation(jmethodID method,
+ jlocation* start_location_ptr,
+ jlocation* end_location_ptr) {
+ return functions->GetMethodLocation(this, method, start_location_ptr, end_location_ptr);
+ }
+
+ jvmtiError GetLocalVariableTable(jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLocalVariableEntry** table_ptr) {
+ return functions->GetLocalVariableTable(this, method, entry_count_ptr, table_ptr);
+ }
+
+ jvmtiError GetBytecodes(jmethodID method,
+ jint* bytecode_count_ptr,
+ unsigned char** bytecodes_ptr) {
+ return functions->GetBytecodes(this, method, bytecode_count_ptr, bytecodes_ptr);
+ }
+
+ jvmtiError IsMethodNative(jmethodID method,
+ jboolean* is_native_ptr) {
+ return functions->IsMethodNative(this, method, is_native_ptr);
+ }
+
+ jvmtiError IsMethodSynthetic(jmethodID method,
+ jboolean* is_synthetic_ptr) {
+ return functions->IsMethodSynthetic(this, method, is_synthetic_ptr);
+ }
+
+ jvmtiError IsMethodObsolete(jmethodID method,
+ jboolean* is_obsolete_ptr) {
+ return functions->IsMethodObsolete(this, method, is_obsolete_ptr);
+ }
+
+ jvmtiError SetNativeMethodPrefix(const char* prefix) {
+ return functions->SetNativeMethodPrefix(this, prefix);
+ }
+
+ jvmtiError SetNativeMethodPrefixes(jint prefix_count,
+ char** prefixes) {
+ return functions->SetNativeMethodPrefixes(this, prefix_count, prefixes);
+ }
+
+ jvmtiError CreateRawMonitor(const char* name,
+ jrawMonitorID* monitor_ptr) {
+ return functions->CreateRawMonitor(this, name, monitor_ptr);
+ }
+
+ jvmtiError DestroyRawMonitor(jrawMonitorID monitor) {
+ return functions->DestroyRawMonitor(this, monitor);
+ }
+
+ jvmtiError RawMonitorEnter(jrawMonitorID monitor) {
+ return functions->RawMonitorEnter(this, monitor);
+ }
+
+ jvmtiError RawMonitorExit(jrawMonitorID monitor) {
+ return functions->RawMonitorExit(this, monitor);
+ }
+
+ jvmtiError RawMonitorWait(jrawMonitorID monitor,
+ jlong millis) {
+ return functions->RawMonitorWait(this, monitor, millis);
+ }
+
+ jvmtiError RawMonitorNotify(jrawMonitorID monitor) {
+ return functions->RawMonitorNotify(this, monitor);
+ }
+
+ jvmtiError RawMonitorNotifyAll(jrawMonitorID monitor) {
+ return functions->RawMonitorNotifyAll(this, monitor);
+ }
+
+ jvmtiError SetJNIFunctionTable(const jniNativeInterface* function_table) {
+ return functions->SetJNIFunctionTable(this, function_table);
+ }
+
+ jvmtiError GetJNIFunctionTable(jniNativeInterface** function_table) {
+ return functions->GetJNIFunctionTable(this, function_table);
+ }
+
+ jvmtiError SetEventCallbacks(const jvmtiEventCallbacks* callbacks,
+ jint size_of_callbacks) {
+ return functions->SetEventCallbacks(this, callbacks, size_of_callbacks);
+ }
+
+ jvmtiError SetEventNotificationMode(jvmtiEventMode mode,
+ jvmtiEvent event_type,
+ jthread event_thread,
+ ...) {
+ return functions->SetEventNotificationMode(this, mode, event_type, event_thread);
+ }
+
+ jvmtiError GenerateEvents(jvmtiEvent event_type) {
+ return functions->GenerateEvents(this, event_type);
+ }
+
+ jvmtiError GetExtensionFunctions(jint* extension_count_ptr,
+ jvmtiExtensionFunctionInfo** extensions) {
+ return functions->GetExtensionFunctions(this, extension_count_ptr, extensions);
+ }
+
+ jvmtiError GetExtensionEvents(jint* extension_count_ptr,
+ jvmtiExtensionEventInfo** extensions) {
+ return functions->GetExtensionEvents(this, extension_count_ptr, extensions);
+ }
+
+ jvmtiError SetExtensionEventCallback(jint extension_event_index,
+ jvmtiExtensionEvent callback) {
+ return functions->SetExtensionEventCallback(this, extension_event_index, callback);
+ }
+
+ jvmtiError GetPotentialCapabilities(jvmtiCapabilities* capabilities_ptr) {
+ return functions->GetPotentialCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError AddCapabilities(const jvmtiCapabilities* capabilities_ptr) {
+ return functions->AddCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError RelinquishCapabilities(const jvmtiCapabilities* capabilities_ptr) {
+ return functions->RelinquishCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError GetCapabilities(jvmtiCapabilities* capabilities_ptr) {
+ return functions->GetCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) {
+ return functions->GetCurrentThreadCpuTimerInfo(this, info_ptr);
+ }
+
+ jvmtiError GetCurrentThreadCpuTime(jlong* nanos_ptr) {
+ return functions->GetCurrentThreadCpuTime(this, nanos_ptr);
+ }
+
+ jvmtiError GetThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) {
+ return functions->GetThreadCpuTimerInfo(this, info_ptr);
+ }
+
+ jvmtiError GetThreadCpuTime(jthread thread,
+ jlong* nanos_ptr) {
+ return functions->GetThreadCpuTime(this, thread, nanos_ptr);
+ }
+
+ jvmtiError GetTimerInfo(jvmtiTimerInfo* info_ptr) {
+ return functions->GetTimerInfo(this, info_ptr);
+ }
+
+ jvmtiError GetTime(jlong* nanos_ptr) {
+ return functions->GetTime(this, nanos_ptr);
+ }
+
+ jvmtiError GetAvailableProcessors(jint* processor_count_ptr) {
+ return functions->GetAvailableProcessors(this, processor_count_ptr);
+ }
+
+ jvmtiError AddToBootstrapClassLoaderSearch(const char* segment) {
+ return functions->AddToBootstrapClassLoaderSearch(this, segment);
+ }
+
+ jvmtiError AddToSystemClassLoaderSearch(const char* segment) {
+ return functions->AddToSystemClassLoaderSearch(this, segment);
+ }
+
+ jvmtiError GetSystemProperties(jint* count_ptr,
+ char*** property_ptr) {
+ return functions->GetSystemProperties(this, count_ptr, property_ptr);
+ }
+
+ jvmtiError GetSystemProperty(const char* property,
+ char** value_ptr) {
+ return functions->GetSystemProperty(this, property, value_ptr);
+ }
+
+ jvmtiError SetSystemProperty(const char* property,
+ const char* value) {
+ return functions->SetSystemProperty(this, property, value);
+ }
+
+ jvmtiError GetPhase(jvmtiPhase* phase_ptr) {
+ return functions->GetPhase(this, phase_ptr);
+ }
+
+ jvmtiError DisposeEnvironment() {
+ return functions->DisposeEnvironment(this);
+ }
+
+ jvmtiError SetEnvironmentLocalStorage(const void* data) {
+ return functions->SetEnvironmentLocalStorage(this, data);
+ }
+
+ jvmtiError GetEnvironmentLocalStorage(void** data_ptr) {
+ return functions->GetEnvironmentLocalStorage(this, data_ptr);
+ }
+
+ jvmtiError GetVersionNumber(jint* version_ptr) {
+ return functions->GetVersionNumber(this, version_ptr);
+ }
+
+ jvmtiError GetErrorName(jvmtiError error,
+ char** name_ptr) {
+ return functions->GetErrorName(this, error, name_ptr);
+ }
+
+ jvmtiError SetVerboseFlag(jvmtiVerboseFlag flag,
+ jboolean value) {
+ return functions->SetVerboseFlag(this, flag, value);
+ }
+
+ jvmtiError GetJLocationFormat(jvmtiJlocationFormat* format_ptr) {
+ return functions->GetJLocationFormat(this, format_ptr);
+ }
+
+#endif /* __cplusplus */
+};
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !_JAVA_JVMTI_H_ */
+
diff --git a/staging/darwin-x86/include/jvmticmlr.h b/staging/darwin-x86/include/jvmticmlr.h
new file mode 100644
index 0000000..c2106d3
--- /dev/null
+++ b/staging/darwin-x86/include/jvmticmlr.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This header file defines the data structures sent by the VM
+ * through the JVMTI CompiledMethodLoad callback function via the
+ * "void * compile_info" parameter. The memory pointed to by the
+ * compile_info parameter may not be referenced after returning from
+ * the CompiledMethodLoad callback. These are VM implementation
+ * specific data structures that may evolve in future releases. A
+ * JVMTI agent should interpret a non-NULL compile_info as a pointer
+ * to a region of memory containing a list of records. In a typical
+ * usage scenario, a JVMTI agent would cast each record to a
+ * jvmtiCompiledMethodLoadRecordHeader, a struct that represents
+ * arbitrary information. This struct contains a kind field to indicate
+ * the kind of information being passed, and a pointer to the next
+ * record. If the kind field indicates inlining information, then the
+ * agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord.
+ * This record contains an array of PCStackInfo structs, which indicate
+ * for every pc address what are the methods on the invocation stack.
+ * The "methods" and "bcis" fields in each PCStackInfo struct specify a
+ * 1-1 mapping between these inlined methods and their bytecode indices.
+ * This can be used to derive the proper source lines of the inlined
+ * methods.
+ */
+
+#ifndef _JVMTI_CMLR_H_
+#define _JVMTI_CMLR_H_
+
+enum {
+ JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001,
+ JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000,
+
+ JVMTI_CMLR_MAJOR_VERSION = 0x00000001,
+ JVMTI_CMLR_MINOR_VERSION = 0x00000000
+
+ /*
+ * This comment is for the "JDK import from HotSpot" sanity check:
+ * version: 1.0.0
+ */
+};
+
+typedef enum {
+ JVMTI_CMLR_DUMMY = 1,
+ JVMTI_CMLR_INLINE_INFO = 2
+} jvmtiCMLRKind;
+
+/*
+ * Record that represents arbitrary information passed through JVMTI
+ * CompiledMethodLoadEvent void pointer.
+ */
+typedef struct _jvmtiCompiledMethodLoadRecordHeader {
+ jvmtiCMLRKind kind; /* id for the kind of info passed in the record */
+ jint majorinfoversion; /* major and minor info version values. Init'ed */
+ jint minorinfoversion; /* to current version value in jvmtiExport.cpp. */
+
+ struct _jvmtiCompiledMethodLoadRecordHeader* next;
+} jvmtiCompiledMethodLoadRecordHeader;
+
+/*
+ * Record that gives information about the methods on the compile-time
+ * stack at a specific pc address of a compiled method. Each element in
+ * the methods array maps to same element in the bcis array.
+ */
+typedef struct _PCStackInfo {
+ void* pc; /* the pc address for this compiled method */
+ jint numstackframes; /* number of methods on the stack */
+ jmethodID* methods; /* array of numstackframes method ids */
+ jint* bcis; /* array of numstackframes bytecode indices */
+} PCStackInfo;
+
+/*
+ * Record that contains inlining information for each pc address of
+ * an nmethod.
+ */
+typedef struct _jvmtiCompiledMethodLoadInlineRecord {
+ jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
+ jint numpcs; /* number of pc descriptors in this nmethod */
+ PCStackInfo* pcinfo; /* array of numpcs pc descriptors */
+} jvmtiCompiledMethodLoadInlineRecord;
+
+/*
+ * Dummy record used to test that we can pass records with different
+ * information through the void pointer provided that they can be cast
+ * to a jvmtiCompiledMethodLoadRecordHeader.
+ */
+
+typedef struct _jvmtiCompiledMethodLoadDummyRecord {
+ jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
+ char message[50];
+} jvmtiCompiledMethodLoadDummyRecord;
+
+#endif
diff --git a/staging/darwin-x86/jre/ASSEMBLY_EXCEPTION b/staging/darwin-x86/jre/ASSEMBLY_EXCEPTION
new file mode 100644
index 0000000..065b8d9
--- /dev/null
+++ b/staging/darwin-x86/jre/ASSEMBLY_EXCEPTION
@@ -0,0 +1,27 @@
+
+OPENJDK ASSEMBLY EXCEPTION
+
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+only ("GPL2"), with the following clarification and special exception.
+
+ Linking this OpenJDK Code statically or dynamically with other code
+ is making a combined work based on this library. Thus, the terms
+ and conditions of GPL2 cover the whole combination.
+
+ As a special exception, Oracle gives you permission to link this
+ OpenJDK Code with certain code licensed by Oracle as indicated at
+ http://openjdk.java.net/legal/exception-modules-2007-05-08.html
+ ("Designated Exception Modules") to produce an executable,
+ regardless of the license terms of the Designated Exception Modules,
+ and to copy and distribute the resulting executable under GPL2,
+ provided that the Designated Exception Modules continue to be
+ governed by the licenses under which they were offered by Oracle.
+
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception). If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
diff --git a/staging/darwin-x86/jre/LICENSE b/staging/darwin-x86/jre/LICENSE
new file mode 100644
index 0000000..8b400c7
--- /dev/null
+++ b/staging/darwin-x86/jre/LICENSE
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have. You must
+make sure that they, too, receive or can get the source code. And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+ a) You must cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in whole or
+ in part contains or is derived from the Program or any part thereof, to be
+ licensed as a whole at no charge to all third parties under the terms of
+ this License.
+
+ c) If the modified program normally reads commands interactively when run,
+ you must cause it, when started running for such interactive use in the
+ most ordinary way, to print or display an announcement including an
+ appropriate copyright notice and a notice that there is no warranty (or
+ else, saying that you provide a warranty) and that users may redistribute
+ the program under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the Program is
+ not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable source
+ code, which must be distributed under the terms of Sections 1 and 2 above
+ on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three years, to
+ give any third party, for a charge no more than your cost of physically
+ performing source distribution, a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed only
+ for noncommercial distribution and only if you received the program in
+ object code or executable form with such an offer, in accord with
+ Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not
+accept this License. Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein. You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+ One line to give the program's name and a brief idea of what it does.
+
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program 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 for
+ more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+ with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
+ software, and you are welcome to redistribute it under certain conditions;
+ type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary. Here
+is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ 'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ signature of Ty Coon, 1 April 1989
+
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+ Linking this library statically or dynamically with other modules is making
+ a combined work based on this library. Thus, the terms and conditions of
+ the GNU General Public License cover the whole combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent modules,
+ and to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent module,
+ the terms and conditions of the license of that module. An independent
+ module is a module which is not derived from or based on this library. If
+ you modify this library, you may extend this exception to your version of
+ the library, but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version.
diff --git a/staging/darwin-x86/jre/THIRD_PARTY_README b/staging/darwin-x86/jre/THIRD_PARTY_README
new file mode 100644
index 0000000..2b20da2
--- /dev/null
+++ b/staging/darwin-x86/jre/THIRD_PARTY_README
@@ -0,0 +1,3574 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to ASM Bytecode Manipulation
+Framework v5.0.3, which may be included with JRE 8, and JDK 8, and
+OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2011 France Télécom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+3. 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.
+
+THIS 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.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to BSDiff v4.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 2003-2005 Colin Percival
+All rights reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted providing that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CodeViewer 1.0, which may be
+included with JDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1999 by CoolServlets.com.
+
+Any errors or suggested improvements to this class can be reported as
+instructed on CoolServlets.com. We hope you enjoy this program... your
+comments will encourage further development! This software is distributed
+under the terms of the BSD License. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+Neither name of CoolServlets.com nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY COOLSERVLETS.COM 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 AUTHOR 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."
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Cryptix AES 3.2.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Cryptix General License
+
+Copyright (c) 1995-2005 The Cryptix Foundation Limited.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ 1. Redistributions of source code must retain the copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED 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 CRYPTIX FOUNDATION LIMITED 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CUP Parser Generator for
+Java 0.10k, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both the
+copyright notice and this permission notice and warranty disclaimer appear in
+supporting documentation, and that the names of the authors or their
+employers not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+The authors and their employers disclaim all warranties with regard to
+this software, including all implied warranties of merchantability and fitness.
+In no event shall the authors or their employers be liable for any special,
+indirect or consequential damages or any damages whatsoever resulting from
+loss of use, data or profits, whether in an action of contract, negligence or
+other tortious action, arising out of or in connection with the use or
+performance of this software.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Document Object Model (DOM) Level 2
+& 3, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+W3C SOFTWARE NOTICE AND LICENSE
+
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee)
+agree that you have read, understood, and will comply with the following terms
+and conditions.
+
+Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without fee
+or royalty is hereby granted, provided that you include the following on ALL
+copies of the software and documentation or portions thereof, including
+modifications:
+
+ 1.The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+
+ 2.Any pre-existing intellectual property disclaimers, notices, or terms and
+ conditions. If none exist, the W3C Software Short Notice should be included
+ (hypertext is preferred, text is permitted) within the body of any
+ redistributed or derivative code.
+
+ 3.Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
+THIRD PARTY PATENTS,COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION. The name and trademarks of copyright holders may NOT be used
+in advertising or publicity pertaining to the software without specific,
+written prior permission. Title to copyright in this software and any
+associated documentation will at all times remain with copyright holders.
+
+____________________________________
+
+This formulation of W3C's notice and license became active on December 31
+2002. This version removes the copyright ownership notice such that this
+license can be used with materials other than those owned by the W3C, reflects
+that ERCIM is now a host of the W3C, includes references to this specific
+dated version of the license, and removes the ambiguous grant of "use".
+Otherwise, this version is the same as the previous version and is written so
+as to preserve the Free Software Foundation's assessment of GPL compatibility
+and OSI's certification under the Open Source Definition. Please see our
+Copyright FAQ for common questions about using materials from our site,
+including specific terms and conditions for packages like libwww, Amaya, and
+Jigsaw. Other questions about this notice can be directed to
+site-policy@w3.org.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Dynalink v0.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2009-2013, Attila Szegedi
+
+All rights reserved.Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following conditions are
+met:* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer. * 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. * Neither the name of Attila
+Szegedi nor the names of its contributors may be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+THIS 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 HOLDER 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 THEPOSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Elliptic Curve Cryptography, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+You are receiving a copy of the Elliptic Curve Cryptography library in source
+form with the JDK 8 and OpenJDK 8 source distributions, and as object code in
+the JRE 8 & JDK 8 runtimes.
+
+In the case of the JRE 8 & JDK 8 runtimes, the terms of the Oracle license do
+NOT apply to the Elliptic Curve Cryptography library; it is licensed under the
+following license, separately from Oracle's JDK & JRE. If you do not wish to
+install the Elliptic Curve Cryptography library, you may delete the library
+named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows
+systems) from the JRE bin directory reserved for native libraries.
+
+
+--- begin of LICENSE ---
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ECMAScript Language
+Specification ECMA-262 Edition 5.1 which may be included with
+JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright notice
+Copyright © 2011 Ecma International
+Ecma International
+Rue du Rhone 114
+CH-1204 Geneva
+Tel: +41 22 849 6000
+Fax: +41 22 849 6001
+Web: http://www.ecma-international.org
+
+This document and possible translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it or assist
+in its implementation may be prepared, copied, published, and distributed, in
+whole or in part, without restriction of any kind, provided that the above
+copyright notice and this section are included on all such copies and derivative
+works. However, this document itself may not be modified in any way, including
+by removing the copyright notice or references to Ecma International, except as
+needed for the purpose of developing any document or deliverable produced by
+Ecma International (in which case the rules applied to copyrights must be
+followed) or as required to translate it into languages other than English. The
+limited permissions granted above are perpetual and will not be revoked by Ecma
+International or its successors or assigns. This document and the information
+contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL
+DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
+WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP
+RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE." Software License
+
+All Software contained in this document ("Software)" is protected by copyright
+and is being made available under the "BSD License", included below. This
+Software may be subject to third party rights (rights from parties other than
+Ecma International), including patent rights, and no licenses under such third
+party rights are granted under this license even if the third party concerned is
+a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS
+AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR
+INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO
+IMPLEMENT ECMA INTERNATIONAL STANDARDS*. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. 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.
+
+3. Neither the name of the authors nor Ecma International may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "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 ECMA INTERNATIONAL 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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Dynalink library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Copyright (c) 2009-2013, Attila Szegedi
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* 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.
+* Neither the name of the copyright holder nor the names of
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS 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 COPYRIGHT HOLDER
+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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Joni library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to FontConfig 2.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 source distributions on
+Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright © 2001,2003 Keith Packard
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and that
+the name of Keith Packard not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior permission.
+Keith Packard makes no representations about the suitability of this software
+for any purpose. It is provided "as is" without express or implied warranty.
+
+KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL KEITH
+PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IAIK PKCS#11 Wrapper,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+IAIK PKCS#11 Wrapper License
+
+Copyright (c) 2002 Graz University of Technology. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by IAIK of Graz University of
+ Technology."
+
+ Alternately, this acknowledgment may appear in the software itself, if and
+ wherever such third-party acknowledgments normally appear.
+
+4. The names "Graz University of Technology" and "IAIK of Graz University of
+ Technology" must not be used to endorse or promote products derived from this
+ software without prior written permission.
+
+5. Products derived from this software may not be called "IAIK PKCS Wrapper",
+ nor may "IAIK" appear in their name, without prior written permission of
+ Graz University of Technology.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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
+LICENSOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ICU4C 4.0.1 and ICU4J 4.4, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1995-2010 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+provided that the above copyright notice(s) and this permission notice appear
+in all copies of the Software and that both the above copyright notice(s) and
+this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+All trademarks and registered trademarks mentioned herein are the property of
+their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IJG JPEG 6b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Joni v1.1.9, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to JOpt-Simple v3.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2004-2009 Paul R. Holser, Jr.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality, which
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ (C) Copyright IBM Corp. 1999 All Rights Reserved.
+ Copyright 1997 The Open Group Research Institute. All rights reserved.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality from
+FundsXpress, INC., which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (C) 1998 by the FundsXpress, INC.
+
+ All rights reserved.
+
+ Export of this software from the United States of America may require
+ a specific license from the United States Government. It is the
+ responsibility of any person or organization contemplating export to
+ obtain such a license before exporting.
+
+ WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ distribute this software and its documentation for any purpose and
+ without fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation, and that
+ the name of FundsXpress. not be used in advertising or publicity pertaining
+ to distribution of the software without specific, written prior
+ permission. FundsXpress makes no representations about the suitability of
+ this software for any purpose. It is provided "as is" without express
+ or implied warranty.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kronos OpenGL headers, which may be
+included with JDK 8 and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2007 The Khronos Group Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and/or associated documentation files (the "Materials"), to
+ deal in the Materials without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Materials, and to permit persons to whom the Materials are
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Materials.
+
+ THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE
+ MATERIALS.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions Copyright Eastman Kodak Company 1992
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to libpng 1.6.16, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors
+
+ Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
+Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6
+with the following individuals added to the list of Contributing Authors
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Gilles Vollant
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-0.96,
+with the following individuals added to the list of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996, 1997 Andreas Dilger
+Distributed according to the same disclaimer and license as libpng-0.88,
+with the following individuals added to the list of Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+1. The origin of this source code must not be misrepresented.
+
+2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+
+A "png_get_copyright" function is available, for convenient use in "about"
+boxes and the like:
+
+ printf("%s",png_get_copyright(NULL));
+
+Also, the PNG logo (in PNG format, of course) is supplied in the
+files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
+certification mark of the Open Source Initiative.
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+December 22, 2014
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Little CMS 2.7, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Little CMS
+Copyright (c) 1998-2015 Marti Maria Saguer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Lucida is a registered trademark or trademark of Bigelow & Holmes in the
+U.S. and other countries.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mesa 3D Graphics Library v4.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Mesa 3-D graphics library
+ Version: 4.1
+
+ Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mozilla Network Security
+Services (NSS), which is supplied with the JDK test suite in the OpenJDK
+source code repository. It is licensed under Mozilla Public License (MPL),
+version 2.0.
+
+The NSS libraries are supplied in executable form, built from unmodified
+NSS source code labeled with the "NSS_3_16_RTM" HG tag.
+
+The NSS source code is available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/src
+
+The NSS libraries are available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/lib
+
+--- begin of LICENSE ---
+
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1999-2004 David Corcoran <corcoran@linuxnet.com>
+Copyright (c) 1999-2004 Ludovic Rousseau <ludovic.rousseau (at) free.fr>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. 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.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by:
+ David Corcoran <corcoran@linuxnet.com>
+ http://www.linuxnet.com (MUSCLE)
+4. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+Changes to this license can be made only by the copyright author with
+explicit written consent.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PorterStemmer v4, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+See: http://tartarus.org/~martin/PorterStemmer
+
+The software is completely free for any purpose, unless notes at the head of
+the program text indicates otherwise (which is rare). In any case, the notes
+about licensing are never more restrictive than the BSD License.
+
+In every case where the software is not written by me (Martin Porter), this
+licensing arrangement has been endorsed by the contributor, and it is
+therefore unnecessary to ask the contributor again to confirm it.
+
+I have not asked any contributors (or their employers, if they have them) for
+proofs that they have the right to distribute their software in this way.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Relax NG Object/Parser v.20050510,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) Kohsuke Kawaguchi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions: The above copyright
+notice and this permission notice shall be included in all copies or
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to RelaxNGCC v1.12, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2003 Daisuke Okajima and Kohsuke Kawaguchi.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by Daisuke Okajima
+ and Kohsuke Kawaguchi (http://relaxngcc.sf.net/)."
+
+Alternately, this acknowledgment may appear in the software itself, if and
+wherever such third-party acknowledgments normally appear.
+
+4. The names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission. For
+ written permission, please contact the copyright holders.
+
+5. Products derived from this software may not be called "RELAXNGCC", nor may
+ "RELAXNGCC" appear in their name, without prior written permission of the
+ copyright holders.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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 APACHE
+SOFTWARE FOUNDATION OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SAX 2.0.1, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ SAX is free!
+
+ In fact, it's not possible to own a license to SAX, since it's been placed in
+ the public domain.
+
+ No Warranty
+
+ Because SAX is released to the public domain, there is no warranty for the
+ design or for the software implementation, to the extent permitted by
+ applicable law. Except when otherwise stated in writing the copyright holders
+ and/or other parties provide SAX "as is" without warranty of any kind, either
+ expressed or implied, including, but not limited to, the implied warranties
+ of merchantability and fitness for a particular purpose. The entire risk as
+ to the quality and performance of SAX is with you. Should SAX prove
+ defective, you assume the cost of all necessary servicing, repair or
+ correction.
+
+ In no event unless required by applicable law or agreed to in writing will
+ any copyright holder, or any other party who may modify and/or redistribute
+ SAX, be liable to you for damages, including any general, special, incidental
+ or consequential damages arising out of the use or inability to use SAX
+ (including but not limited to loss of data or data being rendered inaccurate
+ or losses sustained by you or third parties or a failure of the SAX to
+ operate with any other programs), even if such holder or other party has been
+ advised of the possibility of such damages.
+
+ Copyright Disclaimers
+
+ This page includes statements to that effect by David Megginson, who would
+ have been able to claim copyright for the original work. SAX 1.0
+
+ Version 1.0 of the Simple API for XML (SAX), created collectively by the
+ membership of the XML-DEV mailing list, is hereby released into the public
+ domain.
+
+ No one owns SAX: you may use it freely in both commercial and non-commercial
+ applications, bundle it with your software distribution, include it on a
+ CD-ROM, list the source code in a book, mirror the documentation at your own
+ web site, or use it in any other way you see fit.
+
+ David Megginson, sax@megginson.com
+ 1998-05-11
+
+ SAX 2.0
+
+ I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and
+ release all of the SAX 2.0 source code, compiled code, and documentation
+ contained in this distribution into the Public Domain. SAX comes with NO
+ WARRANTY or guarantee of fitness for any purpose.
+
+ David Megginson, david@megginson.com
+ 2000-05-05
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SoftFloat version 2b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux/ARM.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+SoftFloat was written by me, John R. Hauser. This work was made possible in
+part by the International Computer Science Institute, located at Suite 600,
+1947 Center Street, Berkeley, California 94704. Funding was partially
+provided by the National Science Foundation under grant MIP-9311980. The
+original version of this code was written as part of a project to build
+a fixed-point vector processor in collaboration with the University of
+California at Berkeley, overseen by Profs. Nelson Morgan and John Wawrzynek.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL
+LOSSES, COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO
+FURTHERMORE EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER
+SCIENCE INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES,
+COSTS, OR OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE
+SOFTWARE.
+
+Derivative works are acceptable, even for commercial purposes, provided
+that the minimal documentation requirements stated in the source code are
+satisfied.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Sparkle 1.5,
+which may be included with JRE 8 on Mac OS X.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2012 Sparkle.org and Andy Matuschak
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions licensed from Taligent, Inc.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Thai Dictionary, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (C) 1982 The Royal Institute, Thai Royal Government.
+
+Copyright (C) 1998 National Electronics and Computer Technology Center,
+National Science and Technology Development Agency,
+Ministry of Science Technology and Environment,
+Thai Royal Government.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Unicode 6.2.0 & CLDR 21.0.1
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Unicode Terms of Use
+
+For the general privacy policy governing access to this site, see the Unicode
+Privacy Policy. For trademark usage, see the Unicode® Consortium Name and
+Trademark Usage Policy.
+
+A. Unicode Copyright.
+ 1. Copyright © 1991-2013 Unicode, Inc. All rights reserved.
+
+ 2. Certain documents and files on this website contain a legend indicating
+ that "Modification is permitted." Any person is hereby authorized,
+ without fee, to modify such documents and files to create derivative
+ works conforming to the Unicode® Standard, subject to Terms and
+ Conditions herein.
+
+ 3. Any person is hereby authorized, without fee, to view, use, reproduce,
+ and distribute all documents and files solely for informational
+ purposes in the creation of products supporting the Unicode Standard,
+ subject to the Terms and Conditions herein.
+
+ 4. Further specifications of rights and restrictions pertaining to the use
+ of the particular set of data files known as the "Unicode Character
+ Database" can be found in Exhibit 1.
+
+ 5. Each version of the Unicode Standard has further specifications of
+ rights and restrictions of use. For the book editions (Unicode 5.0 and
+ earlier), these are found on the back of the title page. The online
+ code charts carry specific restrictions. All other files, including
+ online documentation of the core specification for Unicode 6.0 and
+ later, are covered under these general Terms of Use.
+
+ 6. No license is granted to "mirror" the Unicode website where a fee is
+ charged for access to the "mirror" site.
+
+ 7. Modification is not permitted with respect to this document. All copies
+ of this document must be verbatim.
+
+B. Restricted Rights Legend. Any technical data or software which is licensed
+ to the United States of America, its agencies and/or instrumentalities
+ under this Agreement is commercial technical data or commercial computer
+ software developed exclusively at private expense as defined in FAR 2.101,
+ or DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
+ duplication, or disclosure by the Government is subject to restrictions as
+ set forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov
+ 1995) and this Agreement. For Software, in accordance with FAR 12-212 or
+ DFARS 227-7202, as applicable, use, duplication or disclosure by the
+ Government is subject to the restrictions set forth in this Agreement.
+
+C. Warranties and Disclaimers.
+ 1. This publication and/or website may include technical or typographical
+ errors or other inaccuracies . Changes are periodically added to the
+ information herein; these changes will be incorporated in new editions
+ of the publication and/or website. Unicode may make improvements and/or
+ changes in the product(s) and/or program(s) described in this
+ publication and/or website at any time.
+
+ 2. If this file has been purchased on magnetic or optical media from
+ Unicode, Inc. the sole and exclusive remedy for any claim will be
+ exchange of the defective media within ninety (90) days of original
+ purchase.
+
+ 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR SOFTWARE IS
+ PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, IMPLIED,
+ OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+ UNICODE AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR
+ OMISSIONS IN THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH
+ ARE REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE.
+
+D. Waiver of Damages. In no event shall Unicode or its licensors be liable for
+ any special, incidental, indirect or consequential damages of any kind, or
+ any damages whatsoever, whether or not Unicode was advised of the
+ possibility of the damage, including, without limitation, those resulting
+ from the following: loss of use, data or profits, in connection with the
+ use, modification or distribution of this information or its derivatives.
+
+E.Trademarks & Logos.
+ 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode,
+ Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of
+ Unicode, Inc. Use of the information and materials found on this
+ website indicates your acknowledgement of Unicode, Inc.’s exclusive
+ worldwide rights in the Unicode Word Mark, the Unicode Logo, and the
+ Unicode trade names.
+
+ 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark
+ Policy”) are incorporated herein by reference and you agree to abide by
+ the provisions of the Trademark Policy, which may be changed from time
+ to time in the sole discretion of Unicode, Inc.
+
+ 3. All third party trademarks referenced herein are the property of their
+ respective owners.
+
+Miscellaneous.
+ 1. Jurisdiction and Venue. This server is operated from a location in the
+ State of California, United States of America. Unicode makes no
+ representation that the materials are appropriate for use in other
+ locations. If you access this server from other locations, you are
+ responsible for compliance with local laws. This Agreement, all use of
+ this site and any claims and damages resulting from use of this site are
+ governed solely by the laws of the State of California without regard to
+ any principles which would apply the laws of a different jurisdiction.
+ The user agrees that any disputes regarding this site shall be resolved
+ solely in the courts located in Santa Clara County, California. The user
+ agrees said courts have personal jurisdiction and agree to waive any
+ right to transfer the dispute to any other forum.
+
+ 2. Modification by Unicode. Unicode shall have the right to modify this
+ Agreement at any time by posting it to this site. The user may not
+ assign any part of this Agreement without Unicode’s prior written
+ consent.
+
+ 3. Taxes. The user agrees to pay any taxes arising from access to this
+ website or use of the information herein, except for those based on
+ Unicode’s net income.
+
+ 4. Severability. If any provision of this Agreement is declared invalid or
+ unenforceable, the remaining provisions of this Agreement shall remain
+ in effect.
+
+ 5. Entire Agreement. This Agreement constitutes the entire agreement
+ between the parties.
+
+EXHIBIT 1
+UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+Unicode Data Files include all data files under the directories
+http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+http://www.unicode.org/cldr/data/. Unicode Data Files do not include PDF
+online code charts under the directory http://www.unicode.org/Public/.
+Software includes any source code published in the Unicode Standard or under
+the directories http://www.unicode.org/Public/,
+http://www.unicode.org/reports/, and http://www.unicode.org/cldr/data/.
+
+NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING,
+INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA
+FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO
+BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT
+AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR
+SOFTWARE.
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright © 1991-2012 Unicode, Inc. All rights reserved. Distributed under the
+Terms of Use in http://www.unicode.org/copyright.html.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the Unicode data files and any associated documentation (the "Data Files")
+or Unicode software and any associated documentation (the "Software") to deal
+in the Data Files or Software without restriction, including without
+limitation the rights to use, copy, modify, merge, publish, distribute, and/or
+sell copies of the Data Files or Software, and to permit persons to whom the
+Data Files or Software are furnished to do so, provided that (a) the above
+copyright notice(s) and this permission notice appear with all copies of the
+Data Files or Software, (b) both the above copyright notice(s) and this
+permission notice appear in associated documentation, and (c) there is clear
+notice in each modified Data File or in the Software as well as in the
+documentation associated with the Data File(s) or Software that the data or
+software has been modified.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
+DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in these Data Files or Software without prior written authorization of the
+copyright holder.
+
+Unicode and the Unicode logo are trademarks of Unicode, Inc. in the United
+States and other countries. All third party trademarks referenced herein are
+the property of their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to UPX v3.01, which may be included
+with JRE 8 on Windows.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+
+ ooooo ooo ooooooooo. ooooooo ooooo
+ `888' `8' `888 `Y88. `8888 d8'
+ 888 8 888 .d88' Y888..8P
+ 888 8 888ooo88P' `8888'
+ 888 8 888 .8PY888.
+ `88. .8' 888 d8' `888b
+ `YbodP' o888o o888o o88888o
+
+
+ The Ultimate Packer for eXecutables
+ Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
+ http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
+ http://www.nexus.hu/upx
+ http://upx.tsx.org
+
+
+PLEASE CAREFULLY READ THIS LICENSE AGREEMENT, ESPECIALLY IF YOU PLAN
+TO MODIFY THE UPX SOURCE CODE OR USE A MODIFIED UPX VERSION.
+
+
+ABSTRACT
+========
+
+ UPX and UCL are copyrighted software distributed under the terms
+ of the GNU General Public License (hereinafter the "GPL").
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ As a special exception we grant the free usage of UPX for all
+ executables, including commercial programs.
+ See below for details and restrictions.
+
+
+COPYRIGHT
+=========
+
+ UPX and UCL are copyrighted software. All rights remain with the authors.
+
+ UPX is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+ UPX is Copyright (C) 1996-2000 Laszlo Molnar
+
+ UCL is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+
+
+GNU GENERAL PUBLIC LICENSE
+==========================
+
+ UPX and the UCL library are free software; you can redistribute them
+ and/or modify them under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ UPX and UCL are distributed in the hope that they 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+
+
+SPECIAL EXCEPTION FOR COMPRESSED EXECUTABLES
+============================================
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ Hereby Markus F.X.J. Oberhumer and Laszlo Molnar grant you special
+ permission to freely use and distribute all UPX compressed programs
+ (including commercial ones), subject to the following restrictions:
+
+ 1. You must compress your program with a completely unmodified UPX
+ version; either with our precompiled version, or (at your option)
+ with a self compiled version of the unmodified UPX sources as
+ distributed by us.
+ 2. This also implies that the UPX stub must be completely unmodfied, i.e.
+ the stub imbedded in your compressed program must be byte-identical
+ to the stub that is produced by the official unmodified UPX version.
+ 3. The decompressor and any other code from the stub must exclusively get
+ used by the unmodified UPX stub for decompressing your program at
+ program startup. No portion of the stub may get read, copied,
+ called or otherwise get used or accessed by your program.
+
+
+ANNOTATIONS
+===========
+
+ - You can use a modified UPX version or modified UPX stub only for
+ programs that are compatible with the GNU General Public License.
+
+ - We grant you special permission to freely use and distribute all UPX
+ compressed programs. But any modification of the UPX stub (such as,
+ but not limited to, removing our copyright string or making your
+ program non-decompressible) will immediately revoke your right to
+ use and distribute a UPX compressed program.
+
+ - UPX is not a software protection tool; by requiring that you use
+ the unmodified UPX version for your proprietary programs we
+ make sure that any user can decompress your program. This protects
+ both you and your users as nobody can hide malicious code -
+ any program that cannot be decompressed is highly suspicious
+ by definition.
+
+ - You can integrate all or part of UPX and UCL into projects that
+ are compatible with the GNU GPL, but obviously you cannot grant
+ any special exceptions beyond the GPL for our code in your project.
+
+ - We want to actively support manufacturers of virus scanners and
+ similar security software. Please contact us if you would like to
+ incorporate parts of UPX or UCL into such a product.
+
+
+
+Markus F.X.J. Oberhumer Laszlo Molnar
+markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
+
+Linz, Austria, 25 Feb 2000
+
+Additional License(s)
+
+The UPX license file is at http://upx.sourceforge.net/upx-license.html.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Xfree86-VidMode Extension 1.0,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Version 1.1 of XFree86 ProjectLicence.
+
+Copyright (C) 1994-2004 The XFree86 Project, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicence, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so,subject to the following conditions:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice,this list of conditions, and the following disclaimer.
+
+ 2. 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, and in the same place
+ and form as other copyright, license and disclaimer information.
+
+ 3. The end-user documentation included with the redistribution, if any,must
+ include the following acknowledgment: "This product includes
+ software developed by The XFree86 Project, Inc (http://www.xfree86.org/) and
+ its contributors", in the same place and form as other third-party
+ acknowledgments. Alternately, this acknowledgment may appear in the software
+ itself, in the same form and location as other such third-party
+ acknowledgments.
+
+ 4. Except as contained in this notice, the name of The XFree86 Project,Inc
+ shall not be used in advertising or otherwise to promote the sale, use
+ or other dealings in this Software without prior written authorization from
+ The XFree86 Project, Inc.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 XFREE86 PROJECT, INC OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to X Window System 6.8.2, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+ Licenses
+The X.Org Foundation March 2004
+
+1. Introduction
+
+The X.org Foundation X Window System distribution is a compilation of code and
+documentation from many sources. This document is intended primarily as a
+guide to the licenses used in the distribution: you must check each file
+and/or package for precise redistribution terms. None-the-less, this summary
+may be useful to many users. No software incorporating the XFree86 1.1 license
+has been incorporated.
+
+This document is based on the compilation from XFree86.
+
+2. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following
+copyright/license:
+
+Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the XFree86 Project.
+
+3. Other Licenses
+
+Portions of code are covered by the following licenses/copyrights. See
+individual files for the copyright dates.
+
+3.1. X/MIT Copyrights
+
+3.1.1. X Consortium
+
+Copyright (C) <date> X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
+3.1.2. The Open Group
+
+Copyright <date> The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation.
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from The Open Group. 3.2.
+Berkeley-based copyrights:
+
+o
+3.2.1. General
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.2. UCB/LBL
+
+Copyright (c) 1993 The Regents of the University of California. All rights
+reserved.
+
+This software was developed by the Computer Systems Engineering group at
+Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
+Berkeley.
+
+All advertising materials mentioning features or use of this software must
+display the following acknowledgement: This product includes software
+developed by the University of California, Lawrence Berkeley Laboratory.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the University of California, Berkeley and its contributors.
+
+ 4. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. 3.2.3. The
+NetBSD Foundation, Inc.
+
+Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation by Ben
+Collver <collver1@attbi.com>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the NetBSD Foundation, Inc. and its contributors.
+
+ 4. Neither the name of The NetBSD Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. 3.2.4. Theodore
+Ts'o.
+
+Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights
+reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ and the entire permission notice in its entirety, including the disclaimer
+ of warranties.
+
+ 2. 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.
+
+ 3. he name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR 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 NOT ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.2.5. Theo de Raadt and Damien Miller
+
+Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c)
+2001-2002 Damien Miller. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.6. Todd C. Miller
+
+Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 3.2.7. Thomas
+Winischhofer
+
+Copyright (C) 2001-2004 Thomas Winischhofer
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED 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 AUTHOR 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. 3.3. NVIDIA Corp
+
+Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+NOTICE TO USER: The source code is copyrighted under U.S. and international
+laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as design
+patents pending on the design and interface of the NV chips. Users and
+possessors of this source code are hereby granted a nonexclusive, royalty-free
+copyright and design patent license to use this code in individual and
+commercial software.
+
+Any use of this source code must include, in the user documentation and
+internal comments to the code, notices to the end user as follows:
+
+Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. and
+foreign countries.
+
+NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
+WARRANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
+FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. 3.4. GLX Public
+License
+
+GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
+
+Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
+grants permission to Recipient (defined below), under Recipient's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below), and to permit persons to whom the Subject Software is
+furnished in accordance with this License to do the same, subject to all of
+the following terms and conditions, which Recipient accepts by engaging in any
+such use, copying, modifying, merging, publishing, distributing, sublicensing
+or selling:
+
+1. Definitions.
+
+ (a) "Original Software" means source code of computer software code which
+ is described in Exhibit A as Original Software.
+
+ (b) "Modifications" means any addition to or deletion from the substance
+ or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of files, a
+ Modification means (i) any addition to or deletion from the contents of a
+ file containing Original Software or previous Modifications and (ii) any
+ new file that contains any part of the Original Code or previous
+ Modifications.
+
+ (c) "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ (d) "Recipient" means an individual or a legal entity exercising rights
+ under, and complying with all of the terms of, this License. For legal
+ entities, "Recipient" includes any entity which controls, is controlled
+ by, or is under common control with Recipient. For purposes of this
+ definition, "control" of an entity means (a) the power, direct or
+ indirect, to direct or manage such entity, or (b) ownership of fifty
+ percent (50%) or more of the outstanding shares or beneficial ownership of
+ such entity.
+
+2. Redistribution of Source Code Subject to These Terms. Redistributions of
+Subject Software in source code form must retain the notice set forth in
+Exhibit A, below, in every file. A copy of this License must be included in
+any documentation for such Subject Software where the recipients' rights
+relating to Subject Software are described. Recipient may distribute the
+source code version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the source code version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+3. Redistribution in Executable Form. The notice set forth in Exhibit A must
+be conspicuously included in any notice in an executable version of Subject
+Software, related documentation or collateral in which Recipient describes the
+user's rights relating to the Subject Software. Recipient may distribute the
+executable version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the executable version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+4. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software which is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+5. No Trademark Rights. This License does not grant any rights to use any
+trade name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from
+the Subject Software without prior written permission of SGI.
+
+6. No Other Rights. This License does not grant any rights with respect to the
+OpenGL API or to any software or hardware implementation thereof or to any
+other software whatsoever, nor shall any other rights or licenses not
+expressly granted hereunder arise by implication, estoppel or otherwise with
+respect to the Subject Software. Title to and ownership of the Original
+Software at all times remains with SGI. All rights in the Original Software
+not expressly granted under this License are reserved.
+
+7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+8. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Exhibit A notice required under Sections 2 and 3,
+above, and in the text of any related documentation, license agreement or
+collateral in which Recipient describes end user's rights relating to the
+Subject Software. If Recipient obtains such knowledge after it makes Subject
+Software available to any other person or entity, Recipient shall take other
+steps (such as notifying appropriate mailing lists or newsgroups) reasonably
+calculated to inform those who received the Subject Software that new
+knowledge has been obtained.
+
+9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
+THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
+TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
+THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
+
+11. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. from
+and against any loss, liability, damages, costs or expenses (including the
+payment of reasonable attorneys fees) arising out of Recipient's use,
+modification, reproduction and distribution of the Subject Software or out of
+any representation or warranty made by Recipient.
+
+12. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+13. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed so as to achieve as nearly as
+possible the same economic effect as the original provision and the remainder
+of this License will remain in effect. This License shall be governed by and
+construed in accordance with the laws of the United States and the State of
+California as applied to agreements entered into and to be performed entirely
+within California between California residents. Any litigation relating to
+this License shall be subject to the exclusive jurisdiction of the Federal
+Courts of the Northern District of California (or, absent subject matter
+jurisdiction in such courts, the courts of the State of California), with
+venue lying exclusively in Santa Clara County, California, with the losing
+party responsible for costs, including without limitation, court costs and
+reasonable attorneys fees and expenses. The application of the United Nations
+Convention on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of a contract
+shall be construed against the drafter shall not apply to this License.
+
+Exhibit A
+
+The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and 13
+of the GLX Public License Version 1.0 (the "License"). You may not use this
+file except in compliance with those sections of the License. You may obtain a
+copy of the License at Silicon Graphics, Inc., attn: Legal Services, 2011 N.
+Shoreline Blvd., Mountain View, CA 94043 or at
+http://www.sgi.com/software/opensource/glx/license.html.
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software is GLX version 1.2 source code, released February, 1999.
+The developer of the Original Software is Silicon Graphics, Inc. Those
+portions of the Subject Software created by Silicon Graphics, Inc. are
+Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. 3.5. CID
+Font Code Public License
+
+CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
+
+Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
+hereby grants permission to Recipient (defined below), under SGI's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below) in both source code and executable form, and to permit persons
+to whom the Subject Software is furnished in accordance with this License to
+do the same, subject to all of the following terms and conditions, which
+Recipient accepts by engaging in any such use, copying, modifying, merging,
+publication, distributing, sublicensing or selling:
+
+1. Definitions.
+
+ a. "Original Software" means source code of computer software code that is
+ described in Exhibit A as Original Software.
+
+ b. "Modifications" means any addition to or deletion from the substance or
+ structure of either the Original Software or any previous Modifications.
+ When Subject Software is released as a series of files, a Modification
+ means (i) any addition to or deletion from the contents of a file
+ containing Original Software or previous Modifications and (ii) any new
+ file that contains any part of the Original Code or previous
+ Modifications.
+
+ c. "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ d. "Recipient" means an individual or a legal entity exercising rights
+ under the terms of this License. For legal entities, "Recipient" includes
+ any entity that controls, is controlled by, or is under common control
+ with Recipient. For purposes of this definition, "control" of an entity
+ means (i) the power, direct or indirect, to direct or manage such entity,
+ or (ii) ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+ e. "Required Notice" means the notice set forth in Exhibit A to this
+ License.
+
+ f. "Accompanying Technology" means any software or other technology that
+ is not a Modification and that is distributed or made publicly available
+ by Recipient with the Subject Software. Separate software files that do
+ not contain any Original Software or any previous Modification shall not
+ be deemed a Modification, even if such software files are aggregated as
+ part of a product, or in any medium of storage, with any file that does
+ contain Original Software or any previous Modification.
+
+2. License Terms. All distribution of the Subject Software must be made
+subject to the terms of this License. A copy of this License and the Required
+Notice must be included in any documentation for Subject Software where
+Recipient's rights relating to Subject Software and/or any Accompanying
+Technology are described. Distributions of Subject Software in source code
+form must also include the Required Notice in every file distributed. In
+addition, a ReadMe file entitled "Important Legal Notice" must be distributed
+with each distribution of one or more files that incorporate Subject Software.
+That file must be included with distributions made in both source code and
+executable form. A copy of the License and the Required Notice must be
+included in that file. Recipient may distribute Accompanying Technology under
+a license of Recipient's choice, which may contain terms different from this
+License, provided that (i) Recipient is in compliance with the terms of this
+License, (ii) such other license terms do not modify or supersede the terms of
+this License as applicable to the Subject Software, (iii) Recipient hereby
+indemnifies SGI for any liability incurred by SGI as a result of the
+distribution of Accompanying Technology or the use of other license terms.
+
+3. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software that is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+4. Trademark Rights. This License does not grant any rights to use any trade
+name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from or
+incorporating any Subject Software without prior written permission of SGI.
+
+5. No Other Rights. No rights or licenses not expressly granted hereunder
+shall arise by implication, estoppel or otherwise. Title to and ownership of
+the Original Software at all times remains with SGI. All rights in the
+Original Software not expressly granted under this License are reserved.
+
+6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity, or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+7. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Required Notice, and in the text of any related
+documentation, license agreement or collateral in which Recipient describes
+end user's rights relating to the Subject Software. If Recipient obtains such
+knowledge after it makes Subject Software available to any other person or
+entity, Recipient shall take other steps (such as notifying appropriate
+mailing lists or newsgroups) reasonably calculated to provide such knowledge
+to those who received the Subject Software.
+
+8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
+LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
+
+10. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold SGI and its successors and assigns
+harmless from and against any loss, liability, damages, costs or expenses
+(including the payment of reasonable attorneys fees) arising out of
+(Recipient's use, modification, reproduction and distribution of the Subject
+Software or out of any representation or warranty made by Recipient.
+
+11. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+12. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable by any judicial or administrative authority having proper
+jurisdiction with respect thereto, such provision shall be reformed so as to
+achieve as nearly as possible the same economic effect as the original
+provision and the remainder of this License will remain in effect. This
+License shall be governed by and construed in accordance with the laws of the
+United States and the State of California as applied to agreements entered
+into and to be performed entirely within California between California
+residents. Any litigation relating to this License shall be subject to the
+exclusive jurisdiction of the Federal Courts of the Northern District of
+California (or, absent subject matter jurisdiction in such courts, the courts
+of the State of California), with venue lying exclusively in Santa Clara
+County, California, with the losing party responsible for costs, including
+without limitation, court costs and reasonable attorneys fees and expenses.
+The application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or regulation that
+provides that the language of a contract shall be construed against the
+drafter shall not apply to this License.
+
+Exhibit A
+
+Copyright (c) 1994-1999 Silicon Graphics, Inc.
+
+The contents of this file are subject to the CID Font Code Public License
+Version 1.0 (the "License"). You may not use this file except in compliance
+with the License. You may obtain a copy of the License at Silicon Graphics,
+Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+or at http://www.sgi.com/software/opensource/cid/license.html
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
+NON-INFRINGEMENT. See the License for the specific language governing rights
+and limitations under the License.
+
+The Original Software (as defined in the License) is CID font code that was
+developed by Silicon Graphics, Inc. Those portions of the Subject Software (as
+defined in the License) that were created by Silicon Graphics, Inc. are
+Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
+
+[NOTE: When using this text in connection with Subject Software delivered
+solely in object code form, Recipient may replace the words "this file" with
+"this software" in both the first and second sentences.] 3.6. Bitstream Vera
+Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as long as
+"Bitstream" or "Vera" are not in the names), and full redistribution (so long
+as they are not *sold* by themselves). They can be be bundled, redistributed
+and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a
+trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit persons to
+whom the Font Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular the
+designs of glyphs or characters in the Fonts may be modified and additional
+glyphs or characters may be added to the Fonts, only if the fonts are renamed
+to names not containing either the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream Vera"
+names.
+
+The Font Software may be sold as part of a larger software package but no copy
+of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
+SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO
+USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome Foundation,
+and Bitstream Inc., shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Font Software without prior written
+authorization from the Gnome Foundation or Bitstream Inc., respectively. For
+further information, contact: fonts at gnome dot org. 3.7. Bigelow & Holmes
+Inc and URW++ GmbH Luxi font license
+
+Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction
+code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a
+registered trademark of Bigelow & Holmes Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of these Fonts and associated documentation files (the "Font Software"), to
+deal in the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, sublicense, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software.
+
+The Font Software may not be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may not be modified nor may
+additional glyphs or characters be added to the Fonts. This License becomes
+null and void when the Fonts or Font Software have been modified.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++
+GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY
+GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
+SOFTWARE.
+
+Except as contained in this notice, the names of Bigelow & Holmes Inc. and
+URW++ GmbH. shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Font Software without prior written
+authorization from Bigelow & Holmes Inc. and URW++ GmbH.
+
+For further information, contact:
+
+info@urwpp.de or design@bigelowandholmes.com
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to zlib v1.2.8, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ version 1.2.8, April 28th, 2013
+
+ Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to the following which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+ Apache Commons Math 3.2
+ Apache Derby 10.11.1.2
+ Apache Jakarta BCEL 5.1
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XML Security for Java 1.5.4
+ Apache Xalan-Java 2.7.1
+ Apache Xerces Java 2.10.0
+ Apache XML Resolver 1.1
+ Dynalink 0.5
+
+
+--- begin of LICENSE ---
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
diff --git a/staging/darwin-x86/jre/bin/java b/staging/darwin-x86/jre/bin/java
new file mode 100755
index 0000000..886384d
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/java
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/jjs b/staging/darwin-x86/jre/bin/jjs
new file mode 100755
index 0000000..2fe6f47
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/jjs
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/keytool b/staging/darwin-x86/jre/bin/keytool
new file mode 100755
index 0000000..f33144f
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/keytool
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/orbd b/staging/darwin-x86/jre/bin/orbd
new file mode 100755
index 0000000..f00cef6
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/orbd
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/pack200 b/staging/darwin-x86/jre/bin/pack200
new file mode 100755
index 0000000..726cca5
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/pack200
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/policytool b/staging/darwin-x86/jre/bin/policytool
new file mode 100755
index 0000000..7f23ef1
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/policytool
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/rmid b/staging/darwin-x86/jre/bin/rmid
new file mode 100755
index 0000000..b572dd0
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/rmid
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/rmiregistry b/staging/darwin-x86/jre/bin/rmiregistry
new file mode 100755
index 0000000..78ebf2c
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/rmiregistry
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/servertool b/staging/darwin-x86/jre/bin/servertool
new file mode 100755
index 0000000..d273d86
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/servertool
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/tnameserv b/staging/darwin-x86/jre/bin/tnameserv
new file mode 100755
index 0000000..e516c42
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/tnameserv
Binary files differ
diff --git a/staging/darwin-x86/jre/bin/unpack200 b/staging/darwin-x86/jre/bin/unpack200
new file mode 100755
index 0000000..e72457c
--- /dev/null
+++ b/staging/darwin-x86/jre/bin/unpack200
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/calendars.properties b/staging/darwin-x86/jre/lib/calendars.properties
new file mode 100644
index 0000000..49f68ac
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/calendars.properties
@@ -0,0 +1,60 @@
+# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Japanese imperial calendar
+#
+# Meiji since 1868-01-01 00:00:00 local time (Gregorian)
+# Taisho since 1912-07-30 00:00:00 local time (Gregorian)
+# Showa since 1926-12-25 00:00:00 local time (Gregorian)
+# Heisei since 1989-01-08 00:00:00 local time (Gregorian)
+calendar.japanese.type: LocalGregorianCalendar
+calendar.japanese.eras: \
+ name=Meiji,abbr=M,since=-3218832000000; \
+ name=Taisho,abbr=T,since=-1812153600000; \
+ name=Showa,abbr=S,since=-1357603200000; \
+ name=Heisei,abbr=H,since=600220800000
+
+#
+# Taiwanese calendar
+# Minguo since 1911-01-01 00:00:00 local time (Gregorian)
+calendar.taiwanese.type: LocalGregorianCalendar
+calendar.taiwanese.eras: \
+ name=MinGuo,since=-1830384000000
+
+#
+# Thai Buddhist calendar
+# Buddhist Era since -542-01-01 00:00:00 local time (Gregorian)
+calendar.thai-buddhist.type: LocalGregorianCalendar
+calendar.thai-buddhist.eras: \
+ name=BuddhistEra,abbr=B.E.,since=-79302585600000
+calendar.thai-buddhist.year-boundary: \
+ day1=4-1,since=-79302585600000; \
+ day1=1-1,since=-915148800000
+
+#
+# Hijrah calendars
+#
+calendar.hijrah.Hijrah-umalqura: hijrah-config-umalqura.properties
+calendar.hijrah.Hijrah-umalqura.type: islamic-umalqura
diff --git a/staging/darwin-x86/jre/lib/charsets.jar b/staging/darwin-x86/jre/lib/charsets.jar
new file mode 100644
index 0000000..26c548c
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/charsets.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/classlist b/staging/darwin-x86/jre/lib/classlist
new file mode 100644
index 0000000..6f854b4
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/classlist
@@ -0,0 +1,2208 @@
+apple/laf/JRSUIConstants
+apple/laf/JRSUIConstants$AlignmentHorizontal
+apple/laf/JRSUIConstants$AlignmentVertical
+apple/laf/JRSUIConstants$Animating
+apple/laf/JRSUIConstants$DoubleValue
+apple/laf/JRSUIConstants$Focused
+apple/laf/JRSUIConstants$FrameOnly
+apple/laf/JRSUIConstants$Hit
+apple/laf/JRSUIConstants$IndicatorOnly
+apple/laf/JRSUIConstants$Key
+apple/laf/JRSUIConstants$NothingToScroll
+apple/laf/JRSUIConstants$Orientation
+apple/laf/JRSUIConstants$Property
+apple/laf/JRSUIConstants$PropertyEncoding
+apple/laf/JRSUIConstants$ScrollBarPart
+apple/laf/JRSUIConstants$SegmentPosition
+apple/laf/JRSUIConstants$SegmentTrailingSeparator
+apple/laf/JRSUIConstants$ShowArrows
+apple/laf/JRSUIConstants$Size
+apple/laf/JRSUIConstants$State
+apple/laf/JRSUIConstants$Widget
+apple/laf/JRSUIControl
+apple/laf/JRSUIControl$BufferState
+apple/laf/JRSUIControl$ThreadLocalByteBuffer
+apple/laf/JRSUIState
+apple/laf/JRSUIState$ScrollBarState
+apple/laf/JRSUIState$ValueState
+apple/laf/JRSUIStateFactory
+apple/laf/JRSUIUtils
+apple/laf/JRSUIUtils$NineSliceMetricsProvider
+apple/laf/JRSUIUtils$TabbedPane
+com/apple/eawt/AboutHandler
+com/apple/eawt/AppEventListener
+com/apple/eawt/AppReOpenedListener
+com/apple/eawt/OpenFilesHandler
+com/apple/eawt/PreferencesHandler
+com/apple/eawt/PrintFilesHandler
+com/apple/eawt/QuitHandler
+com/apple/eawt/QuitStrategy
+com/apple/eawt/_AppEventHandler
+com/apple/eawt/_AppEventHandler$_AboutDispatcher
+com/apple/eawt/_AppEventHandler$_AppEventDispatcher
+com/apple/eawt/_AppEventHandler$_AppEventMultiplexor
+com/apple/eawt/_AppEventHandler$_AppForegroundDispatcher
+com/apple/eawt/_AppEventHandler$_AppReOpenedDispatcher
+com/apple/eawt/_AppEventHandler$_BooleanAppEventMultiplexor
+com/apple/eawt/_AppEventHandler$_HiddenAppDispatcher
+com/apple/eawt/_AppEventHandler$_NativeEvent
+com/apple/eawt/_AppEventHandler$_OpenAppDispatcher
+com/apple/eawt/_AppEventHandler$_OpenFileDispatcher
+com/apple/eawt/_AppEventHandler$_OpenURIDispatcher
+com/apple/eawt/_AppEventHandler$_PreferencesDispatcher
+com/apple/eawt/_AppEventHandler$_PrintFileDispatcher
+com/apple/eawt/_AppEventHandler$_QueuingAppEventDispatcher
+com/apple/eawt/_AppEventHandler$_QuitDispatcher
+com/apple/eawt/_AppEventHandler$_ScreenSleepDispatcher
+com/apple/eawt/_AppEventHandler$_SystemSleepDispatcher
+com/apple/eawt/_AppEventHandler$_UserSessionDispatcher
+com/apple/eawt/_AppEventLegacyHandler
+com/apple/eawt/_AppMenuBarHandler
+com/apple/eawt/_OpenAppHandler
+com/apple/laf/AquaBorder
+com/apple/laf/AquaButtonBorder
+com/apple/laf/AquaButtonBorder$1
+com/apple/laf/AquaButtonBorder$Dynamic
+com/apple/laf/AquaButtonBorder$Dynamic$1
+com/apple/laf/AquaButtonBorder$Named
+com/apple/laf/AquaButtonBorder$Toggle
+com/apple/laf/AquaButtonBorder$Toolbar
+com/apple/laf/AquaButtonExtendedTypes
+com/apple/laf/AquaButtonExtendedTypes$1
+com/apple/laf/AquaButtonExtendedTypes$2
+com/apple/laf/AquaButtonExtendedTypes$3
+com/apple/laf/AquaButtonExtendedTypes$4
+com/apple/laf/AquaButtonExtendedTypes$5
+com/apple/laf/AquaButtonExtendedTypes$6
+com/apple/laf/AquaButtonExtendedTypes$7
+com/apple/laf/AquaButtonExtendedTypes$8
+com/apple/laf/AquaButtonExtendedTypes$BorderDefinedTypeSpecifier
+com/apple/laf/AquaButtonExtendedTypes$BorderDefinedTypeSpecifier$1
+com/apple/laf/AquaButtonExtendedTypes$SegmentedBorderDefinedTypeSpecifier
+com/apple/laf/AquaButtonExtendedTypes$SegmentedNamedBorder
+com/apple/laf/AquaButtonExtendedTypes$TypeSpecifier
+com/apple/laf/AquaButtonToggleUI
+com/apple/laf/AquaButtonUI
+com/apple/laf/AquaButtonUI$AquaButtonListener
+com/apple/laf/AquaButtonUI$AquaHierarchyButtonListener
+com/apple/laf/AquaCaret
+com/apple/laf/AquaComboBoxButton
+com/apple/laf/AquaComboBoxButton$1
+com/apple/laf/AquaComboBoxPopup
+com/apple/laf/AquaComboBoxPopup$1
+com/apple/laf/AquaComboBoxRenderer
+com/apple/laf/AquaComboBoxRendererInternal
+com/apple/laf/AquaComboBoxUI
+com/apple/laf/AquaComboBoxUI$1
+com/apple/laf/AquaComboBoxUI$10
+com/apple/laf/AquaComboBoxUI$11
+com/apple/laf/AquaComboBoxUI$12
+com/apple/laf/AquaComboBoxUI$12$1
+com/apple/laf/AquaComboBoxUI$12$2
+com/apple/laf/AquaComboBoxUI$12$3
+com/apple/laf/AquaComboBoxUI$12$4
+com/apple/laf/AquaComboBoxUI$12$5
+com/apple/laf/AquaComboBoxUI$12$6
+com/apple/laf/AquaComboBoxUI$12$7
+com/apple/laf/AquaComboBoxUI$2
+com/apple/laf/AquaComboBoxUI$3
+com/apple/laf/AquaComboBoxUI$4
+com/apple/laf/AquaComboBoxUI$5
+com/apple/laf/AquaComboBoxUI$6
+com/apple/laf/AquaComboBoxUI$7
+com/apple/laf/AquaComboBoxUI$8
+com/apple/laf/AquaComboBoxUI$9
+com/apple/laf/AquaComboBoxUI$AquaComboBoxEditor
+com/apple/laf/AquaComboBoxUI$AquaComboBoxLayoutManager
+com/apple/laf/AquaComboBoxUI$AquaCustomComboTextField
+com/apple/laf/AquaComboBoxUI$AquaCustomComboTextField$1
+com/apple/laf/AquaComboBoxUI$ComboBoxAction
+com/apple/laf/AquaFocusHandler
+com/apple/laf/AquaFocusHandler$1
+com/apple/laf/AquaFonts
+com/apple/laf/AquaFonts$1
+com/apple/laf/AquaFonts$2
+com/apple/laf/AquaFonts$3
+com/apple/laf/AquaFonts$4
+com/apple/laf/AquaFonts$5
+com/apple/laf/AquaFonts$6
+com/apple/laf/AquaFonts$7
+com/apple/laf/AquaFonts$DerivedUIResourceFont
+com/apple/laf/AquaHighlighter
+com/apple/laf/AquaHighlighter$1
+com/apple/laf/AquaHighlighter$AquaHighlightPainter
+com/apple/laf/AquaIcon$CachingScalingIcon
+com/apple/laf/AquaIcon$InvertableIcon
+com/apple/laf/AquaIcon$SystemIcon
+com/apple/laf/AquaIcon$SystemIconSingleton
+com/apple/laf/AquaIcon$SystemIconUIResourceSingleton
+com/apple/laf/AquaImageFactory
+com/apple/laf/AquaImageFactory$IconUIResourceSingleton
+com/apple/laf/AquaImageFactory$InvertableImageIcon
+com/apple/laf/AquaImageFactory$NamedImageSingleton
+com/apple/laf/AquaImageFactory$SystemColorProxy
+com/apple/laf/AquaKeyBindings
+com/apple/laf/AquaKeyBindings$AquaMultilineAction
+com/apple/laf/AquaKeyBindings$BindingsProvider
+com/apple/laf/AquaKeyBindings$LateBoundInputMap
+com/apple/laf/AquaKeyBindings$SimpleBinding
+com/apple/laf/AquaLabelUI
+com/apple/laf/AquaListUI
+com/apple/laf/AquaListUI$AquaHomeEndAction
+com/apple/laf/AquaListUI$AquaPropertyChangeHandler
+com/apple/laf/AquaListUI$FocusHandler
+com/apple/laf/AquaListUI$MouseInputHandler
+com/apple/laf/AquaLookAndFeel
+com/apple/laf/AquaLookAndFeel$1
+com/apple/laf/AquaLookAndFeel$2
+com/apple/laf/AquaLookAndFeel$3
+com/apple/laf/AquaMenuBarBorder
+com/apple/laf/AquaMenuBarUI
+com/apple/laf/AquaMenuBorder
+com/apple/laf/AquaMenuItemUI
+com/apple/laf/AquaMenuItemUI$IndeterminateListener
+com/apple/laf/AquaMenuPainter
+com/apple/laf/AquaMenuPainter$Client
+com/apple/laf/AquaMenuPainter$RecyclableBorder
+com/apple/laf/AquaMenuUI
+com/apple/laf/AquaMenuUI$AquaMouseInputHandler
+com/apple/laf/AquaMenuUI$MenuDragMouseHandler
+com/apple/laf/AquaMnemonicHandler
+com/apple/laf/AquaMnemonicHandler$AltProcessor
+com/apple/laf/AquaPainter
+com/apple/laf/AquaPainter$1
+com/apple/laf/AquaPainter$AquaNineSlicingImagePainter
+com/apple/laf/AquaPainter$AquaSingleImagePainter
+com/apple/laf/AquaPanelUI
+com/apple/laf/AquaPopupMenuSeparatorUI
+com/apple/laf/AquaPopupMenuUI
+com/apple/laf/AquaRootPaneUI
+com/apple/laf/AquaScrollBarUI
+com/apple/laf/AquaScrollBarUI$1
+com/apple/laf/AquaScrollBarUI$ModelListener
+com/apple/laf/AquaScrollBarUI$PropertyChangeHandler
+com/apple/laf/AquaScrollBarUI$ScrollListener
+com/apple/laf/AquaScrollBarUI$TrackListener
+com/apple/laf/AquaScrollPaneUI
+com/apple/laf/AquaScrollPaneUI$XYMouseWheelHandler
+com/apple/laf/AquaScrollRegionBorder
+com/apple/laf/AquaTableHeaderBorder
+com/apple/laf/AquaTableHeaderBorder$1
+com/apple/laf/AquaTextAreaUI
+com/apple/laf/AquaTextFieldBorder
+com/apple/laf/AquaTextFieldSearch
+com/apple/laf/AquaTextFieldSearch$SearchFieldBorder
+com/apple/laf/AquaTextFieldSearch$SearchFieldPropertyListener
+com/apple/laf/AquaTextFieldUI
+com/apple/laf/AquaToolBarSeparatorUI
+com/apple/laf/AquaToolBarUI
+com/apple/laf/AquaToolBarUI$ToolBarBorder
+com/apple/laf/AquaUtilControlSize
+com/apple/laf/AquaUtilControlSize$PropertySizeListener
+com/apple/laf/AquaUtilControlSize$SizeDescriptor
+com/apple/laf/AquaUtilControlSize$SizeVariant
+com/apple/laf/AquaUtilControlSize$Sizeable
+com/apple/laf/AquaUtils
+com/apple/laf/AquaUtils$2
+com/apple/laf/AquaUtils$5
+com/apple/laf/AquaUtils$6
+com/apple/laf/AquaUtils$JComponentPainter
+com/apple/laf/AquaUtils$RecyclableSingleton
+com/apple/laf/AquaUtils$RecyclableSingletonFromDefaultConstructor
+com/apple/laf/ClientPropertyApplicator
+com/apple/laf/ClientPropertyApplicator$Property
+com/apple/laf/ImageCache
+com/apple/laf/ImageCache$1
+com/apple/laf/ImageCache$PixelCountSoftReference
+com/apple/laf/ScreenMenuBar
+com/apple/laf/ScreenMenuBarProvider
+com/apple/laf/ScreenMenuPropertyHandler
+com/apple/laf/ScreenPopupFactory
+com/apple/laf/ScreenPopupFactory$1
+com/apple/laf/resources/aqua
+com/sun/java/swing/SwingUtilities3
+com/sun/swing/internal/plaf/basic/resources/basic
+java/applet/Applet
+java/awt/AWTEvent
+java/awt/AWTEvent$1
+java/awt/AWTEvent$2
+java/awt/AWTEventMulticaster
+java/awt/AWTKeyStroke
+java/awt/AWTKeyStroke$1
+java/awt/ActiveEvent
+java/awt/Adjustable
+java/awt/AlphaComposite
+java/awt/BasicStroke
+java/awt/BorderLayout
+java/awt/Canvas
+java/awt/CardLayout
+java/awt/Color
+java/awt/Component
+java/awt/Component$1
+java/awt/Component$3
+java/awt/Component$AWTTreeLock
+java/awt/Component$DummyRequestFocusController
+java/awt/ComponentOrientation
+java/awt/Composite
+java/awt/Conditional
+java/awt/Container
+java/awt/Container$1
+java/awt/Container$EventTargetFilter
+java/awt/Container$MouseEventTargetFilter
+java/awt/ContainerOrderFocusTraversalPolicy
+java/awt/Cursor
+java/awt/Cursor$1
+java/awt/DefaultFocusTraversalPolicy
+java/awt/DefaultKeyboardFocusManager
+java/awt/DefaultKeyboardFocusManager$1
+java/awt/DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent
+java/awt/DefaultKeyboardFocusManager$TypeAheadMarker
+java/awt/Dialog
+java/awt/Dialog$1
+java/awt/Dialog$3
+java/awt/Dialog$ModalExclusionType
+java/awt/Dialog$ModalityType
+java/awt/Dimension
+java/awt/Event
+java/awt/EventDispatchThread
+java/awt/EventDispatchThread$1
+java/awt/EventDispatchThread$HierarchyEventFilter
+java/awt/EventFilter
+java/awt/EventFilter$FilterAction
+java/awt/EventQueue
+java/awt/EventQueue$1
+java/awt/EventQueue$2
+java/awt/EventQueue$3
+java/awt/EventQueue$4
+java/awt/EventQueue$5
+java/awt/FlowLayout
+java/awt/FocusTraversalPolicy
+java/awt/Font
+java/awt/Font$FontAccessImpl
+java/awt/FontMetrics
+java/awt/Frame
+java/awt/Frame$1
+java/awt/Graphics
+java/awt/Graphics2D
+java/awt/GraphicsCallback
+java/awt/GraphicsCallback$PaintCallback
+java/awt/GraphicsConfiguration
+java/awt/GraphicsDevice
+java/awt/GraphicsEnvironment
+java/awt/GraphicsEnvironment$1
+java/awt/Image
+java/awt/Image$1
+java/awt/ImageCapabilities
+java/awt/ImageMediaEntry
+java/awt/Insets
+java/awt/ItemSelectable
+java/awt/KeyEventDispatcher
+java/awt/KeyEventPostProcessor
+java/awt/KeyboardFocusManager
+java/awt/KeyboardFocusManager$1
+java/awt/KeyboardFocusManager$2
+java/awt/KeyboardFocusManager$3
+java/awt/KeyboardFocusManager$HeavyweightFocusRequest
+java/awt/KeyboardFocusManager$LightweightFocusRequest
+java/awt/Label
+java/awt/LayoutManager
+java/awt/LayoutManager2
+java/awt/LightweightDispatcher
+java/awt/LightweightDispatcher$1
+java/awt/LightweightDispatcher$2
+java/awt/MediaEntry
+java/awt/MediaTracker
+java/awt/MenuBar
+java/awt/MenuComponent
+java/awt/MenuContainer
+java/awt/ModalEventFilter
+java/awt/ModalEventFilter$1
+java/awt/ModalEventFilter$ApplicationModalEventFilter
+java/awt/Paint
+java/awt/Panel
+java/awt/Point
+java/awt/PrintGraphics
+java/awt/Queue
+java/awt/Rectangle
+java/awt/RenderingHints
+java/awt/RenderingHints$Key
+java/awt/SecondaryLoop
+java/awt/SentEvent
+java/awt/SequencedEvent
+java/awt/Shape
+java/awt/SplashScreen
+java/awt/Stroke
+java/awt/SystemColor
+java/awt/Toolkit
+java/awt/Toolkit$1
+java/awt/Toolkit$2
+java/awt/Toolkit$3
+java/awt/Toolkit$4
+java/awt/Toolkit$5
+java/awt/Toolkit$DesktopPropertyChangeSupport
+java/awt/Toolkit$SelectiveAWTEventListener
+java/awt/Toolkit$ToolkitEventMulticaster
+java/awt/Transparency
+java/awt/TrayIcon
+java/awt/VKCollection
+java/awt/WaitDispatchSupport
+java/awt/WaitDispatchSupport$1
+java/awt/WaitDispatchSupport$2
+java/awt/WaitDispatchSupport$5
+java/awt/Window
+java/awt/Window$1
+java/awt/Window$1DisposeAction
+java/awt/Window$Type
+java/awt/Window$WindowDisposerRecord
+java/awt/color/ColorSpace
+java/awt/color/ICC_ColorSpace
+java/awt/color/ICC_Profile
+java/awt/color/ICC_Profile$1
+java/awt/color/ICC_ProfileRGB
+java/awt/datatransfer/Clipboard
+java/awt/datatransfer/ClipboardOwner
+java/awt/datatransfer/DataFlavor
+java/awt/datatransfer/FlavorMap
+java/awt/datatransfer/FlavorTable
+java/awt/datatransfer/MimeType
+java/awt/datatransfer/MimeTypeParameterList
+java/awt/datatransfer/MimeTypeParseException
+java/awt/datatransfer/SystemFlavorMap
+java/awt/datatransfer/SystemFlavorMap$1
+java/awt/datatransfer/SystemFlavorMap$2
+java/awt/datatransfer/Transferable
+java/awt/dnd/DropTarget
+java/awt/dnd/DropTargetContext
+java/awt/dnd/DropTargetListener
+java/awt/dnd/peer/DragSourceContextPeer
+java/awt/dnd/peer/DropTargetPeer
+java/awt/event/AWTEventListener
+java/awt/event/AWTEventListenerProxy
+java/awt/event/ActionEvent
+java/awt/event/ActionListener
+java/awt/event/AdjustmentEvent
+java/awt/event/AdjustmentListener
+java/awt/event/ComponentAdapter
+java/awt/event/ComponentEvent
+java/awt/event/ComponentListener
+java/awt/event/ContainerEvent
+java/awt/event/ContainerListener
+java/awt/event/FocusAdapter
+java/awt/event/FocusEvent
+java/awt/event/FocusListener
+java/awt/event/HierarchyBoundsListener
+java/awt/event/HierarchyEvent
+java/awt/event/HierarchyListener
+java/awt/event/InputEvent
+java/awt/event/InputEvent$1
+java/awt/event/InputMethodEvent
+java/awt/event/InputMethodListener
+java/awt/event/InvocationEvent
+java/awt/event/ItemListener
+java/awt/event/KeyAdapter
+java/awt/event/KeyEvent
+java/awt/event/KeyEvent$1
+java/awt/event/KeyListener
+java/awt/event/MouseAdapter
+java/awt/event/MouseEvent
+java/awt/event/MouseListener
+java/awt/event/MouseMotionAdapter
+java/awt/event/MouseMotionListener
+java/awt/event/MouseWheelEvent
+java/awt/event/MouseWheelListener
+java/awt/event/NativeLibLoader
+java/awt/event/NativeLibLoader$1
+java/awt/event/PaintEvent
+java/awt/event/TextListener
+java/awt/event/WindowAdapter
+java/awt/event/WindowEvent
+java/awt/event/WindowFocusListener
+java/awt/event/WindowListener
+java/awt/event/WindowStateListener
+java/awt/font/FontRenderContext
+java/awt/font/GlyphVector
+java/awt/font/LineMetrics
+java/awt/font/TextAttribute
+java/awt/geom/AffineTransform
+java/awt/geom/Dimension2D
+java/awt/geom/GeneralPath
+java/awt/geom/Path2D
+java/awt/geom/Path2D$Float
+java/awt/geom/Point2D
+java/awt/geom/Point2D$Double
+java/awt/geom/Point2D$Float
+java/awt/geom/Rectangle2D
+java/awt/geom/Rectangle2D$Double
+java/awt/geom/Rectangle2D$Float
+java/awt/geom/RectangularShape
+java/awt/im/InputContext
+java/awt/im/InputMethodRequests
+java/awt/im/spi/InputMethod
+java/awt/im/spi/InputMethodContext
+java/awt/im/spi/InputMethodDescriptor
+java/awt/image/BufferStrategy
+java/awt/image/BufferedImage
+java/awt/image/BufferedImage$1
+java/awt/image/ColorModel
+java/awt/image/ColorModel$1
+java/awt/image/ComponentSampleModel
+java/awt/image/DataBuffer
+java/awt/image/DataBuffer$1
+java/awt/image/DataBufferByte
+java/awt/image/DataBufferInt
+java/awt/image/DirectColorModel
+java/awt/image/FilteredImageSource
+java/awt/image/ImageConsumer
+java/awt/image/ImageFilter
+java/awt/image/ImageObserver
+java/awt/image/ImageProducer
+java/awt/image/IndexColorModel
+java/awt/image/PackedColorModel
+java/awt/image/PixelInterleavedSampleModel
+java/awt/image/RGBImageFilter
+java/awt/image/Raster
+java/awt/image/RenderedImage
+java/awt/image/SampleModel
+java/awt/image/SinglePixelPackedSampleModel
+java/awt/image/VolatileImage
+java/awt/image/WritableRaster
+java/awt/image/WritableRenderedImage
+java/awt/peer/CanvasPeer
+java/awt/peer/ComponentPeer
+java/awt/peer/ContainerPeer
+java/awt/peer/DialogPeer
+java/awt/peer/FramePeer
+java/awt/peer/KeyboardFocusManagerPeer
+java/awt/peer/LabelPeer
+java/awt/peer/LightweightPeer
+java/awt/peer/PanelPeer
+java/awt/peer/WindowPeer
+java/awt/print/PrinterGraphics
+java/beans/ChangeListenerMap
+java/beans/PropertyChangeEvent
+java/beans/PropertyChangeListener
+java/beans/PropertyChangeListenerProxy
+java/beans/PropertyChangeSupport
+java/beans/PropertyChangeSupport$PropertyChangeListenerMap
+java/io/Bits
+java/io/BufferedInputStream
+java/io/BufferedOutputStream
+java/io/BufferedReader
+java/io/BufferedWriter
+java/io/ByteArrayInputStream
+java/io/ByteArrayOutputStream
+java/io/Closeable
+java/io/DataInput
+java/io/DataInputStream
+java/io/DataOutput
+java/io/DataOutputStream
+java/io/DefaultFileSystem
+java/io/EOFException
+java/io/ExpiringCache
+java/io/ExpiringCache$1
+java/io/ExpiringCache$Entry
+java/io/Externalizable
+java/io/File
+java/io/File$PathStatus
+java/io/FileDescriptor
+java/io/FileDescriptor$1
+java/io/FileInputStream
+java/io/FileInputStream$1
+java/io/FileNotFoundException
+java/io/FileOutputStream
+java/io/FileOutputStream$1
+java/io/FilePermission
+java/io/FilePermission$1
+java/io/FilePermissionCollection
+java/io/FileReader
+java/io/FileSystem
+java/io/FileWriter
+java/io/FilenameFilter
+java/io/FilterInputStream
+java/io/FilterOutputStream
+java/io/FilterReader
+java/io/Flushable
+java/io/IOException
+java/io/InputStream
+java/io/InputStreamReader
+java/io/ObjectInput
+java/io/ObjectInputStream
+java/io/ObjectOutput
+java/io/ObjectOutputStream
+java/io/ObjectOutputStream$BlockDataOutputStream
+java/io/ObjectOutputStream$HandleTable
+java/io/ObjectOutputStream$ReplaceTable
+java/io/ObjectStreamClass
+java/io/ObjectStreamClass$2
+java/io/ObjectStreamClass$Caches
+java/io/ObjectStreamClass$EntryFuture
+java/io/ObjectStreamClass$FieldReflector
+java/io/ObjectStreamClass$FieldReflectorKey
+java/io/ObjectStreamClass$WeakClassKey
+java/io/ObjectStreamConstants
+java/io/ObjectStreamField
+java/io/OutputStream
+java/io/OutputStreamWriter
+java/io/PrintStream
+java/io/PrintWriter
+java/io/RandomAccessFile
+java/io/Reader
+java/io/Serializable
+java/io/StringReader
+java/io/StringWriter
+java/io/UnixFileSystem
+java/io/UnsupportedEncodingException
+java/io/Writer
+java/lang/AbstractStringBuilder
+java/lang/Appendable
+java/lang/ApplicationShutdownHooks
+java/lang/ApplicationShutdownHooks$1
+java/lang/ArithmeticException
+java/lang/ArrayIndexOutOfBoundsException
+java/lang/ArrayStoreException
+java/lang/AutoCloseable
+java/lang/Boolean
+java/lang/BootstrapMethodError
+java/lang/Byte
+java/lang/CharSequence
+java/lang/Character
+java/lang/Character$CharacterCache
+java/lang/CharacterData
+java/lang/CharacterDataLatin1
+java/lang/Class
+java/lang/Class$1
+java/lang/Class$3
+java/lang/Class$4
+java/lang/Class$AnnotationData
+java/lang/Class$Atomic
+java/lang/Class$ReflectionData
+java/lang/ClassCastException
+java/lang/ClassLoader
+java/lang/ClassLoader$2
+java/lang/ClassLoader$3
+java/lang/ClassLoader$NativeLibrary
+java/lang/ClassLoader$ParallelLoaders
+java/lang/ClassLoaderHelper
+java/lang/ClassNotFoundException
+java/lang/ClassValue$ClassValueMap
+java/lang/CloneNotSupportedException
+java/lang/Cloneable
+java/lang/Comparable
+java/lang/Compiler
+java/lang/Compiler$1
+java/lang/Double
+java/lang/Enum
+java/lang/Error
+java/lang/Exception
+java/lang/ExceptionInInitializerError
+java/lang/Float
+java/lang/IllegalAccessError
+java/lang/IllegalAccessException
+java/lang/IllegalArgumentException
+java/lang/IllegalMonitorStateException
+java/lang/IllegalStateException
+java/lang/IncompatibleClassChangeError
+java/lang/IndexOutOfBoundsException
+java/lang/InstantiationException
+java/lang/Integer
+java/lang/Integer$IntegerCache
+java/lang/InternalError
+java/lang/InterruptedException
+java/lang/Iterable
+java/lang/LinkageError
+java/lang/Long
+java/lang/Long$LongCache
+java/lang/Math
+java/lang/NoClassDefFoundError
+java/lang/NoSuchFieldException
+java/lang/NoSuchMethodError
+java/lang/NoSuchMethodException
+java/lang/NullPointerException
+java/lang/Number
+java/lang/NumberFormatException
+java/lang/Object
+java/lang/OutOfMemoryError
+java/lang/Package
+java/lang/Process
+java/lang/ProcessBuilder
+java/lang/ProcessBuilder$NullInputStream
+java/lang/ProcessBuilder$NullOutputStream
+java/lang/ProcessEnvironment
+java/lang/ProcessEnvironment$ExternalData
+java/lang/ProcessEnvironment$StringEnvironment
+java/lang/ProcessEnvironment$Value
+java/lang/ProcessEnvironment$Variable
+java/lang/ProcessImpl
+java/lang/Readable
+java/lang/ReflectiveOperationException
+java/lang/Runnable
+java/lang/Runtime
+java/lang/RuntimeException
+java/lang/RuntimePermission
+java/lang/SecurityException
+java/lang/SecurityManager
+java/lang/Short
+java/lang/Short$ShortCache
+java/lang/Shutdown
+java/lang/Shutdown$Lock
+java/lang/StackOverflowError
+java/lang/StackTraceElement
+java/lang/StrictMath
+java/lang/String
+java/lang/String$CaseInsensitiveComparator
+java/lang/StringBuffer
+java/lang/StringBuilder
+java/lang/StringCoding
+java/lang/StringCoding$StringDecoder
+java/lang/StringCoding$StringEncoder
+java/lang/StringIndexOutOfBoundsException
+java/lang/System
+java/lang/System$2
+java/lang/SystemClassLoaderAction
+java/lang/Terminator
+java/lang/Terminator$1
+java/lang/Thread
+java/lang/Thread$UncaughtExceptionHandler
+java/lang/ThreadDeath
+java/lang/ThreadGroup
+java/lang/ThreadLocal
+java/lang/ThreadLocal$ThreadLocalMap
+java/lang/ThreadLocal$ThreadLocalMap$Entry
+java/lang/Throwable
+java/lang/Throwable$PrintStreamOrWriter
+java/lang/Throwable$WrappedPrintStream
+java/lang/Throwable$WrappedPrintWriter
+java/lang/UNIXProcess
+java/lang/UNIXProcess$1
+java/lang/UNIXProcess$2
+java/lang/UNIXProcess$3
+java/lang/UNIXProcess$4
+java/lang/UNIXProcess$LaunchMechanism
+java/lang/UNIXProcess$ProcessPipeInputStream
+java/lang/UNIXProcess$ProcessPipeOutputStream
+java/lang/UNIXProcess$ProcessReaperThreadFactory
+java/lang/UNIXProcess$ProcessReaperThreadFactory$1
+java/lang/UnsatisfiedLinkError
+java/lang/UnsupportedOperationException
+java/lang/VirtualMachineError
+java/lang/Void
+java/lang/annotation/Annotation
+java/lang/invoke/CallSite
+java/lang/invoke/ConstantCallSite
+java/lang/invoke/DirectMethodHandle
+java/lang/invoke/Invokers
+java/lang/invoke/LambdaForm
+java/lang/invoke/LambdaForm$NamedFunction
+java/lang/invoke/MagicLambdaImpl
+java/lang/invoke/MemberName
+java/lang/invoke/MemberName$Factory
+java/lang/invoke/MethodHandle
+java/lang/invoke/MethodHandleImpl
+java/lang/invoke/MethodHandleNatives
+java/lang/invoke/MethodHandleStatics
+java/lang/invoke/MethodHandleStatics$1
+java/lang/invoke/MethodType
+java/lang/invoke/MethodType$ConcurrentWeakInternSet
+java/lang/invoke/MethodType$ConcurrentWeakInternSet$WeakEntry
+java/lang/invoke/MethodTypeForm
+java/lang/invoke/MutableCallSite
+java/lang/invoke/VolatileCallSite
+java/lang/ref/FinalReference
+java/lang/ref/Finalizer
+java/lang/ref/Finalizer$FinalizerThread
+java/lang/ref/PhantomReference
+java/lang/ref/Reference
+java/lang/ref/Reference$Lock
+java/lang/ref/Reference$ReferenceHandler
+java/lang/ref/ReferenceQueue
+java/lang/ref/ReferenceQueue$Lock
+java/lang/ref/ReferenceQueue$Null
+java/lang/ref/SoftReference
+java/lang/ref/WeakReference
+java/lang/reflect/AccessibleObject
+java/lang/reflect/AnnotatedElement
+java/lang/reflect/Array
+java/lang/reflect/Constructor
+java/lang/reflect/Executable
+java/lang/reflect/Field
+java/lang/reflect/GenericDeclaration
+java/lang/reflect/InvocationHandler
+java/lang/reflect/InvocationTargetException
+java/lang/reflect/Member
+java/lang/reflect/Method
+java/lang/reflect/Modifier
+java/lang/reflect/Parameter
+java/lang/reflect/Proxy
+java/lang/reflect/Proxy$KeyFactory
+java/lang/reflect/Proxy$ProxyClassFactory
+java/lang/reflect/ReflectAccess
+java/lang/reflect/ReflectPermission
+java/lang/reflect/Type
+java/lang/reflect/WeakCache
+java/net/AbstractPlainSocketImpl
+java/net/AbstractPlainSocketImpl$1
+java/net/Authenticator
+java/net/ConnectException
+java/net/DefaultInterface
+java/net/HttpURLConnection
+java/net/Inet4Address
+java/net/Inet6Address
+java/net/Inet6Address$Inet6AddressHolder
+java/net/Inet6AddressImpl
+java/net/InetAddress
+java/net/InetAddress$1
+java/net/InetAddress$2
+java/net/InetAddress$Cache
+java/net/InetAddress$Cache$Type
+java/net/InetAddress$InetAddressHolder
+java/net/InetAddressImpl
+java/net/InetAddressImplFactory
+java/net/InetSocketAddress
+java/net/InetSocketAddress$InetSocketAddressHolder
+java/net/InterfaceAddress
+java/net/JarURLConnection
+java/net/MalformedURLException
+java/net/NetworkInterface
+java/net/NetworkInterface$1
+java/net/NetworkInterface$2
+java/net/Parts
+java/net/PlainSocketImpl
+java/net/Proxy
+java/net/Proxy$Type
+java/net/ProxySelector
+java/net/ServerSocket
+java/net/Socket
+java/net/SocketAddress
+java/net/SocketException
+java/net/SocketImpl
+java/net/SocketOptions
+java/net/SocksConsts
+java/net/SocksSocketImpl
+java/net/SocksSocketImpl$3
+java/net/URI
+java/net/URI$Parser
+java/net/URL
+java/net/URLClassLoader
+java/net/URLClassLoader$1
+java/net/URLClassLoader$2
+java/net/URLClassLoader$3
+java/net/URLClassLoader$3$1
+java/net/URLClassLoader$7
+java/net/URLConnection
+java/net/URLStreamHandler
+java/net/URLStreamHandlerFactory
+java/nio/Bits
+java/nio/Bits$1
+java/nio/Buffer
+java/nio/ByteBuffer
+java/nio/ByteBufferAsIntBufferB
+java/nio/ByteBufferAsShortBufferB
+java/nio/ByteOrder
+java/nio/CharBuffer
+java/nio/DirectByteBuffer
+java/nio/DirectByteBuffer$Deallocator
+java/nio/DirectLongBufferU
+java/nio/HeapByteBuffer
+java/nio/HeapCharBuffer
+java/nio/IntBuffer
+java/nio/LongBuffer
+java/nio/MappedByteBuffer
+java/nio/ShortBuffer
+java/nio/channels/ByteChannel
+java/nio/channels/Channel
+java/nio/channels/FileChannel
+java/nio/channels/GatheringByteChannel
+java/nio/channels/InterruptibleChannel
+java/nio/channels/ReadableByteChannel
+java/nio/channels/ScatteringByteChannel
+java/nio/channels/SeekableByteChannel
+java/nio/channels/WritableByteChannel
+java/nio/channels/spi/AbstractInterruptibleChannel
+java/nio/channels/spi/AbstractInterruptibleChannel$1
+java/nio/charset/Charset
+java/nio/charset/CharsetDecoder
+java/nio/charset/CharsetEncoder
+java/nio/charset/CoderResult
+java/nio/charset/CoderResult$1
+java/nio/charset/CoderResult$2
+java/nio/charset/CoderResult$Cache
+java/nio/charset/CodingErrorAction
+java/nio/charset/StandardCharsets
+java/nio/charset/spi/CharsetProvider
+java/nio/file/Path
+java/nio/file/Watchable
+java/nio/file/attribute/FileAttribute
+java/rmi/MarshalledObject
+java/rmi/Remote
+java/security/AccessControlContext
+java/security/AccessController
+java/security/AllPermission
+java/security/AllPermissionCollection
+java/security/BasicPermission
+java/security/BasicPermissionCollection
+java/security/CodeSigner
+java/security/CodeSource
+java/security/Guard
+java/security/Permission
+java/security/PermissionCollection
+java/security/Permissions
+java/security/Principal
+java/security/PrivilegedAction
+java/security/PrivilegedActionException
+java/security/PrivilegedExceptionAction
+java/security/ProtectionDomain
+java/security/ProtectionDomain$1
+java/security/ProtectionDomain$3
+java/security/ProtectionDomain$Key
+java/security/SecureClassLoader
+java/security/UnresolvedPermission
+java/security/cert/Certificate
+java/text/AttributedCharacterIterator
+java/text/AttributedCharacterIterator$Attribute
+java/text/AttributedString
+java/text/AttributedString$AttributedStringIterator
+java/text/CharacterIterator
+java/text/FieldPosition
+java/text/Format
+java/text/Format$Field
+java/text/MessageFormat
+java/text/MessageFormat$Field
+java/text/spi/BreakIteratorProvider
+java/text/spi/CollatorProvider
+java/text/spi/DateFormatProvider
+java/text/spi/DateFormatSymbolsProvider
+java/text/spi/DecimalFormatSymbolsProvider
+java/text/spi/NumberFormatProvider
+java/util/AbstractCollection
+java/util/AbstractList
+java/util/AbstractList$Itr
+java/util/AbstractMap
+java/util/AbstractQueue
+java/util/AbstractSequentialList
+java/util/AbstractSet
+java/util/ArrayDeque
+java/util/ArrayList
+java/util/ArrayList$Itr
+java/util/ArrayList$ListItr
+java/util/ArrayList$SubList
+java/util/ArrayList$SubList$1
+java/util/Arrays
+java/util/Arrays$ArrayList
+java/util/Arrays$LegacyMergeSort
+java/util/BitSet
+java/util/Collection
+java/util/Collections
+java/util/Collections$EmptyEnumeration
+java/util/Collections$EmptyList
+java/util/Collections$EmptyMap
+java/util/Collections$EmptySet
+java/util/Collections$SetFromMap
+java/util/Collections$SynchronizedCollection
+java/util/Collections$SynchronizedMap
+java/util/Collections$SynchronizedSet
+java/util/Collections$UnmodifiableCollection
+java/util/Collections$UnmodifiableCollection$1
+java/util/Collections$UnmodifiableList
+java/util/Collections$UnmodifiableMap
+java/util/Collections$UnmodifiableRandomAccessList
+java/util/Collections$UnmodifiableSet
+java/util/Collections$UnmodifiableSortedSet
+java/util/ComparableTimSort
+java/util/Comparator
+java/util/Date
+java/util/Deque
+java/util/Dictionary
+java/util/Enumeration
+java/util/EventListener
+java/util/EventListenerProxy
+java/util/EventObject
+java/util/HashMap
+java/util/HashMap$EntryIterator
+java/util/HashMap$EntrySet
+java/util/HashMap$HashIterator
+java/util/HashMap$KeyIterator
+java/util/HashMap$KeySet
+java/util/HashMap$Node
+java/util/HashMap$TreeNode
+java/util/HashMap$ValueIterator
+java/util/HashMap$Values
+java/util/HashSet
+java/util/Hashtable
+java/util/Hashtable$Entry
+java/util/Hashtable$EntrySet
+java/util/Hashtable$Enumerator
+java/util/Hashtable$ValueCollection
+java/util/IdentityHashMap
+java/util/IdentityHashMap$IdentityHashMapIterator
+java/util/IdentityHashMap$KeyIterator
+java/util/IdentityHashMap$KeySet
+java/util/Iterator
+java/util/LinkedHashMap
+java/util/LinkedHashMap$Entry
+java/util/LinkedHashMap$LinkedEntryIterator
+java/util/LinkedHashMap$LinkedEntrySet
+java/util/LinkedHashMap$LinkedHashIterator
+java/util/LinkedHashMap$LinkedKeyIterator
+java/util/LinkedHashMap$LinkedKeySet
+java/util/LinkedHashSet
+java/util/LinkedList
+java/util/LinkedList$ListItr
+java/util/LinkedList$Node
+java/util/List
+java/util/ListIterator
+java/util/ListResourceBundle
+java/util/Locale
+java/util/Locale$1
+java/util/Locale$Cache
+java/util/Locale$Category
+java/util/Locale$LocaleKey
+java/util/Map
+java/util/Map$Entry
+java/util/MissingResourceException
+java/util/NavigableMap
+java/util/NavigableSet
+java/util/Objects
+java/util/PriorityQueue
+java/util/Properties
+java/util/Properties$LineReader
+java/util/PropertyResourceBundle
+java/util/Queue
+java/util/Random
+java/util/RandomAccess
+java/util/ResourceBundle
+java/util/ResourceBundle$1
+java/util/ResourceBundle$BundleReference
+java/util/ResourceBundle$CacheKey
+java/util/ResourceBundle$CacheKeyReference
+java/util/ResourceBundle$Control
+java/util/ResourceBundle$Control$1
+java/util/ResourceBundle$Control$CandidateListCache
+java/util/ResourceBundle$LoaderReference
+java/util/ResourceBundle$RBClassLoader
+java/util/ResourceBundle$RBClassLoader$1
+java/util/ResourceBundle$SingleFormatControl
+java/util/ServiceLoader
+java/util/ServiceLoader$1
+java/util/ServiceLoader$LazyIterator
+java/util/Set
+java/util/SortedMap
+java/util/SortedSet
+java/util/Stack
+java/util/StringTokenizer
+java/util/TimSort
+java/util/TimeZone
+java/util/TimeZone$1
+java/util/TreeMap
+java/util/TreeMap$Entry
+java/util/TreeMap$KeyIterator
+java/util/TreeMap$KeySet
+java/util/TreeMap$PrivateEntryIterator
+java/util/TreeSet
+java/util/Vector
+java/util/Vector$1
+java/util/Vector$Itr
+java/util/Vector$ListItr
+java/util/WeakHashMap
+java/util/WeakHashMap$Entry
+java/util/WeakHashMap$HashIterator
+java/util/WeakHashMap$KeyIterator
+java/util/WeakHashMap$KeySet
+java/util/concurrent/AbstractExecutorService
+java/util/concurrent/BlockingQueue
+java/util/concurrent/ConcurrentHashMap
+java/util/concurrent/ConcurrentHashMap$BaseIterator
+java/util/concurrent/ConcurrentHashMap$CollectionView
+java/util/concurrent/ConcurrentHashMap$CounterCell
+java/util/concurrent/ConcurrentHashMap$EntrySetView
+java/util/concurrent/ConcurrentHashMap$ForwardingNode
+java/util/concurrent/ConcurrentHashMap$KeyIterator
+java/util/concurrent/ConcurrentHashMap$KeySetView
+java/util/concurrent/ConcurrentHashMap$Node
+java/util/concurrent/ConcurrentHashMap$Segment
+java/util/concurrent/ConcurrentHashMap$Traverser
+java/util/concurrent/ConcurrentHashMap$ValuesView
+java/util/concurrent/ConcurrentMap
+java/util/concurrent/CopyOnWriteArrayList
+java/util/concurrent/DelayQueue
+java/util/concurrent/Delayed
+java/util/concurrent/Executor
+java/util/concurrent/ExecutorService
+java/util/concurrent/Executors
+java/util/concurrent/RejectedExecutionHandler
+java/util/concurrent/SynchronousQueue
+java/util/concurrent/SynchronousQueue$TransferStack
+java/util/concurrent/SynchronousQueue$TransferStack$SNode
+java/util/concurrent/SynchronousQueue$Transferer
+java/util/concurrent/ThreadFactory
+java/util/concurrent/ThreadPoolExecutor
+java/util/concurrent/ThreadPoolExecutor$AbortPolicy
+java/util/concurrent/ThreadPoolExecutor$Worker
+java/util/concurrent/TimeUnit
+java/util/concurrent/TimeUnit$1
+java/util/concurrent/TimeUnit$2
+java/util/concurrent/TimeUnit$3
+java/util/concurrent/TimeUnit$4
+java/util/concurrent/TimeUnit$5
+java/util/concurrent/TimeUnit$6
+java/util/concurrent/TimeUnit$7
+java/util/concurrent/atomic/AtomicBoolean
+java/util/concurrent/atomic/AtomicInteger
+java/util/concurrent/atomic/AtomicLong
+java/util/concurrent/atomic/AtomicReferenceFieldUpdater
+java/util/concurrent/atomic/AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl
+java/util/concurrent/atomic/AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl$1
+java/util/concurrent/locks/AbstractOwnableSynchronizer
+java/util/concurrent/locks/AbstractQueuedSynchronizer
+java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject
+java/util/concurrent/locks/AbstractQueuedSynchronizer$Node
+java/util/concurrent/locks/Condition
+java/util/concurrent/locks/Lock
+java/util/concurrent/locks/LockSupport
+java/util/concurrent/locks/ReadWriteLock
+java/util/concurrent/locks/ReentrantLock
+java/util/concurrent/locks/ReentrantLock$NonfairSync
+java/util/concurrent/locks/ReentrantLock$Sync
+java/util/concurrent/locks/ReentrantReadWriteLock
+java/util/concurrent/locks/ReentrantReadWriteLock$NonfairSync
+java/util/concurrent/locks/ReentrantReadWriteLock$ReadLock
+java/util/concurrent/locks/ReentrantReadWriteLock$Sync
+java/util/concurrent/locks/ReentrantReadWriteLock$Sync$ThreadLocalHoldCounter
+java/util/concurrent/locks/ReentrantReadWriteLock$WriteLock
+java/util/function/BiFunction
+java/util/jar/Attributes
+java/util/jar/Attributes$Name
+java/util/jar/JarEntry
+java/util/jar/JarFile
+java/util/jar/JarFile$JarEntryIterator
+java/util/jar/JarFile$JarFileEntry
+java/util/jar/JarVerifier
+java/util/jar/JarVerifier$3
+java/util/jar/JavaUtilJarAccessImpl
+java/util/jar/Manifest
+java/util/jar/Manifest$FastInputStream
+java/util/logging/Handler
+java/util/logging/Level
+java/util/logging/Level$KnownLevel
+java/util/logging/LogManager
+java/util/logging/LogManager$1
+java/util/logging/LogManager$2
+java/util/logging/LogManager$3
+java/util/logging/LogManager$5
+java/util/logging/LogManager$Cleaner
+java/util/logging/LogManager$LogNode
+java/util/logging/LogManager$LoggerContext
+java/util/logging/LogManager$LoggerContext$1
+java/util/logging/LogManager$LoggerWeakRef
+java/util/logging/LogManager$RootLogger
+java/util/logging/LogManager$SystemLoggerContext
+java/util/logging/Logger
+java/util/logging/Logger$1
+java/util/logging/LoggingPermission
+java/util/logging/LoggingProxyImpl
+java/util/spi/CalendarDataProvider
+java/util/spi/CurrencyNameProvider
+java/util/spi/LocaleNameProvider
+java/util/spi/LocaleServiceProvider
+java/util/spi/ResourceBundleControlProvider
+java/util/spi/TimeZoneNameProvider
+java/util/zip/CRC32
+java/util/zip/Checksum
+java/util/zip/Inflater
+java/util/zip/InflaterInputStream
+java/util/zip/ZStreamRef
+java/util/zip/ZipCoder
+java/util/zip/ZipConstants
+java/util/zip/ZipEntry
+java/util/zip/ZipException
+java/util/zip/ZipFile
+java/util/zip/ZipFile$1
+java/util/zip/ZipFile$ZipEntryIterator
+java/util/zip/ZipFile$ZipFileInflaterInputStream
+java/util/zip/ZipFile$ZipFileInputStream
+java/util/zip/ZipUtils
+javax/accessibility/Accessible
+javax/accessibility/AccessibleContext
+javax/swing/AbstractAction
+javax/swing/AbstractButton
+javax/swing/AbstractButton$Handler
+javax/swing/AbstractListModel
+javax/swing/Action
+javax/swing/ActionMap
+javax/swing/AncestorNotifier
+javax/swing/ArrayTable
+javax/swing/Autoscroller
+javax/swing/BorderFactory
+javax/swing/BoundedRangeModel
+javax/swing/Box
+javax/swing/Box$Filler
+javax/swing/BoxLayout
+javax/swing/ButtonGroup
+javax/swing/ButtonModel
+javax/swing/CellRendererPane
+javax/swing/ClientPropertyKey
+javax/swing/ClientPropertyKey$1
+javax/swing/ComboBoxEditor
+javax/swing/ComboBoxModel
+javax/swing/ComponentInputMap
+javax/swing/DefaultBoundedRangeModel
+javax/swing/DefaultButtonModel
+javax/swing/DefaultComboBoxModel
+javax/swing/DefaultListCellRenderer
+javax/swing/DefaultListCellRenderer$UIResource
+javax/swing/DefaultListSelectionModel
+javax/swing/DefaultSingleSelectionModel
+javax/swing/DropMode
+javax/swing/FocusManager
+javax/swing/GrayFilter
+javax/swing/Icon
+javax/swing/ImageIcon
+javax/swing/ImageIcon$1
+javax/swing/ImageIcon$2
+javax/swing/ImageIcon$2$1
+javax/swing/ImageIcon$3
+javax/swing/InputMap
+javax/swing/InternalFrameFocusTraversalPolicy
+javax/swing/JButton
+javax/swing/JCheckBox
+javax/swing/JCheckBoxMenuItem
+javax/swing/JComboBox
+javax/swing/JComboBox$1
+javax/swing/JComboBox$KeySelectionManager
+javax/swing/JComponent
+javax/swing/JComponent$1
+javax/swing/JComponent$2
+javax/swing/JDialog
+javax/swing/JEditorPane
+javax/swing/JFrame
+javax/swing/JInternalFrame
+javax/swing/JLabel
+javax/swing/JLayer
+javax/swing/JLayeredPane
+javax/swing/JList
+javax/swing/JMenu
+javax/swing/JMenu$MenuChangeListener
+javax/swing/JMenu$WinListener
+javax/swing/JMenuBar
+javax/swing/JMenuItem
+javax/swing/JMenuItem$MenuItemFocusListener
+javax/swing/JPanel
+javax/swing/JPasswordField
+javax/swing/JPopupMenu
+javax/swing/JPopupMenu$Separator
+javax/swing/JRadioButton
+javax/swing/JRadioButtonMenuItem
+javax/swing/JRootPane
+javax/swing/JRootPane$1
+javax/swing/JRootPane$RootLayout
+javax/swing/JScrollBar
+javax/swing/JScrollBar$ModelListener
+javax/swing/JScrollPane
+javax/swing/JScrollPane$ScrollBar
+javax/swing/JSeparator
+javax/swing/JSplitPane
+javax/swing/JTextArea
+javax/swing/JTextField
+javax/swing/JTextField$NotifyAction
+javax/swing/JTextField$ScrollRepainter
+javax/swing/JToggleButton
+javax/swing/JToggleButton$ToggleButtonModel
+javax/swing/JToolBar
+javax/swing/JToolBar$DefaultToolBarLayout
+javax/swing/JToolBar$Separator
+javax/swing/JViewport
+javax/swing/JViewport$ViewListener
+javax/swing/JWindow
+javax/swing/KeyStroke
+javax/swing/KeyboardManager
+javax/swing/KeyboardManager$ComponentKeyStrokePair
+javax/swing/LayoutComparator
+javax/swing/LayoutFocusTraversalPolicy
+javax/swing/ListCellRenderer
+javax/swing/ListModel
+javax/swing/ListSelectionModel
+javax/swing/LookAndFeel
+javax/swing/MenuElement
+javax/swing/MenuSelectionManager
+javax/swing/MultiUIDefaults
+javax/swing/MutableComboBoxModel
+javax/swing/PopupFactory
+javax/swing/RepaintManager
+javax/swing/RepaintManager$2
+javax/swing/RepaintManager$3
+javax/swing/RepaintManager$DisplayChangedHandler
+javax/swing/RepaintManager$PaintManager
+javax/swing/RepaintManager$ProcessingRunnable
+javax/swing/RootPaneContainer
+javax/swing/ScrollPaneConstants
+javax/swing/ScrollPaneLayout
+javax/swing/ScrollPaneLayout$UIResource
+javax/swing/Scrollable
+javax/swing/SingleSelectionModel
+javax/swing/SizeRequirements
+javax/swing/SortingFocusTraversalPolicy
+javax/swing/SwingConstants
+javax/swing/SwingContainerOrderFocusTraversalPolicy
+javax/swing/SwingDefaultFocusTraversalPolicy
+javax/swing/SwingHeavyWeight
+javax/swing/SwingPaintEventDispatcher
+javax/swing/SwingUtilities
+javax/swing/SwingUtilities$SharedOwnerFrame
+javax/swing/Timer
+javax/swing/Timer$DoPostEvent
+javax/swing/TimerQueue
+javax/swing/TimerQueue$1
+javax/swing/TimerQueue$DelayedTimer
+javax/swing/ToolTipManager
+javax/swing/ToolTipManager$AccessibilityKeyListener
+javax/swing/ToolTipManager$MoveBeforeEnterListener
+javax/swing/ToolTipManager$insideTimerAction
+javax/swing/ToolTipManager$outsideTimerAction
+javax/swing/ToolTipManager$stillInsideTimerAction
+javax/swing/TransferHandler
+javax/swing/TransferHandler$DropHandler
+javax/swing/TransferHandler$HasGetTransferHandler
+javax/swing/TransferHandler$SwingDropTarget
+javax/swing/TransferHandler$TransferAction
+javax/swing/TransferHandler$TransferAction$1
+javax/swing/TransferHandler$TransferAction$2
+javax/swing/TransferHandler$TransferSupport
+javax/swing/UIDefaults
+javax/swing/UIDefaults$ActiveValue
+javax/swing/UIDefaults$LazyInputMap
+javax/swing/UIDefaults$LazyValue
+javax/swing/UIDefaults$TextAndMnemonicHashMap
+javax/swing/UIManager
+javax/swing/UIManager$1
+javax/swing/UIManager$2
+javax/swing/UIManager$LAFState
+javax/swing/UIManager$LookAndFeelInfo
+javax/swing/ViewportLayout
+javax/swing/WindowConstants
+javax/swing/border/AbstractBorder
+javax/swing/border/BevelBorder
+javax/swing/border/Border
+javax/swing/border/CompoundBorder
+javax/swing/border/EmptyBorder
+javax/swing/border/EtchedBorder
+javax/swing/border/LineBorder
+javax/swing/border/MatteBorder
+javax/swing/event/AncestorEvent
+javax/swing/event/AncestorListener
+javax/swing/event/CaretEvent
+javax/swing/event/CaretListener
+javax/swing/event/ChangeEvent
+javax/swing/event/ChangeListener
+javax/swing/event/DocumentEvent
+javax/swing/event/DocumentEvent$ElementChange
+javax/swing/event/DocumentEvent$EventType
+javax/swing/event/DocumentListener
+javax/swing/event/EventListenerList
+javax/swing/event/ListDataListener
+javax/swing/event/ListSelectionListener
+javax/swing/event/MenuDragMouseListener
+javax/swing/event/MenuEvent
+javax/swing/event/MenuKeyListener
+javax/swing/event/MenuListener
+javax/swing/event/MouseInputAdapter
+javax/swing/event/MouseInputListener
+javax/swing/event/PopupMenuListener
+javax/swing/event/UndoableEditEvent
+javax/swing/event/UndoableEditListener
+javax/swing/plaf/ActionMapUIResource
+javax/swing/plaf/BorderUIResource
+javax/swing/plaf/BorderUIResource$EmptyBorderUIResource
+javax/swing/plaf/BorderUIResource$LineBorderUIResource
+javax/swing/plaf/ButtonUI
+javax/swing/plaf/ColorUIResource
+javax/swing/plaf/ComboBoxUI
+javax/swing/plaf/ComponentInputMapUIResource
+javax/swing/plaf/ComponentUI
+javax/swing/plaf/DimensionUIResource
+javax/swing/plaf/FontUIResource
+javax/swing/plaf/IconUIResource
+javax/swing/plaf/InputMapUIResource
+javax/swing/plaf/InsetsUIResource
+javax/swing/plaf/LabelUI
+javax/swing/plaf/ListUI
+javax/swing/plaf/MenuBarUI
+javax/swing/plaf/MenuItemUI
+javax/swing/plaf/PanelUI
+javax/swing/plaf/PopupMenuUI
+javax/swing/plaf/RootPaneUI
+javax/swing/plaf/ScrollBarUI
+javax/swing/plaf/ScrollPaneUI
+javax/swing/plaf/SeparatorUI
+javax/swing/plaf/TextUI
+javax/swing/plaf/ToolBarUI
+javax/swing/plaf/UIResource
+javax/swing/plaf/ViewportUI
+javax/swing/plaf/basic/BasicBorders$ButtonBorder
+javax/swing/plaf/basic/BasicBorders$MarginBorder
+javax/swing/plaf/basic/BasicBorders$RadioButtonBorder
+javax/swing/plaf/basic/BasicBorders$RolloverButtonBorder
+javax/swing/plaf/basic/BasicBorders$RolloverMarginBorder
+javax/swing/plaf/basic/BasicButtonListener
+javax/swing/plaf/basic/BasicButtonUI
+javax/swing/plaf/basic/BasicComboBoxEditor
+javax/swing/plaf/basic/BasicComboBoxEditor$BorderlessTextField
+javax/swing/plaf/basic/BasicComboBoxEditor$UIResource
+javax/swing/plaf/basic/BasicComboBoxUI
+javax/swing/plaf/basic/BasicComboBoxUI$ComboBoxLayoutManager
+javax/swing/plaf/basic/BasicComboBoxUI$DefaultKeySelectionManager
+javax/swing/plaf/basic/BasicComboBoxUI$FocusHandler
+javax/swing/plaf/basic/BasicComboBoxUI$Handler
+javax/swing/plaf/basic/BasicComboPopup
+javax/swing/plaf/basic/BasicComboPopup$EmptyListModelClass
+javax/swing/plaf/basic/BasicComboPopup$Handler
+javax/swing/plaf/basic/BasicGraphicsUtils
+javax/swing/plaf/basic/BasicHTML
+javax/swing/plaf/basic/BasicIconFactory
+javax/swing/plaf/basic/BasicIconFactory$MenuItemArrowIcon
+javax/swing/plaf/basic/BasicIconFactory$MenuItemCheckIcon
+javax/swing/plaf/basic/BasicLabelUI
+javax/swing/plaf/basic/BasicListUI
+javax/swing/plaf/basic/BasicListUI$FocusHandler
+javax/swing/plaf/basic/BasicListUI$Handler
+javax/swing/plaf/basic/BasicListUI$ListTransferHandler
+javax/swing/plaf/basic/BasicListUI$MouseInputHandler
+javax/swing/plaf/basic/BasicListUI$PropertyChangeHandler
+javax/swing/plaf/basic/BasicLookAndFeel
+javax/swing/plaf/basic/BasicLookAndFeel$1
+javax/swing/plaf/basic/BasicLookAndFeel$2
+javax/swing/plaf/basic/BasicLookAndFeel$AWTEventHelper
+javax/swing/plaf/basic/BasicMenuBarUI
+javax/swing/plaf/basic/BasicMenuBarUI$Handler
+javax/swing/plaf/basic/BasicMenuItemUI
+javax/swing/plaf/basic/BasicMenuItemUI$Handler
+javax/swing/plaf/basic/BasicMenuUI
+javax/swing/plaf/basic/BasicMenuUI$ChangeHandler
+javax/swing/plaf/basic/BasicMenuUI$Handler
+javax/swing/plaf/basic/BasicMenuUI$MouseInputHandler
+javax/swing/plaf/basic/BasicPanelUI
+javax/swing/plaf/basic/BasicPopupMenuUI
+javax/swing/plaf/basic/BasicPopupMenuUI$BasicMenuKeyListener
+javax/swing/plaf/basic/BasicPopupMenuUI$BasicPopupMenuListener
+javax/swing/plaf/basic/BasicPopupMenuUI$MenuKeyboardHelper
+javax/swing/plaf/basic/BasicPopupMenuUI$MenuKeyboardHelper$1
+javax/swing/plaf/basic/BasicPopupMenuUI$MouseGrabber
+javax/swing/plaf/basic/BasicRootPaneUI
+javax/swing/plaf/basic/BasicRootPaneUI$RootPaneInputMap
+javax/swing/plaf/basic/BasicScrollPaneUI
+javax/swing/plaf/basic/BasicScrollPaneUI$Handler
+javax/swing/plaf/basic/BasicScrollPaneUI$MouseWheelHandler
+javax/swing/plaf/basic/BasicSeparatorUI
+javax/swing/plaf/basic/BasicTextAreaUI
+javax/swing/plaf/basic/BasicTextFieldUI
+javax/swing/plaf/basic/BasicTextUI
+javax/swing/plaf/basic/BasicTextUI$BasicCursor
+javax/swing/plaf/basic/BasicTextUI$DragListener
+javax/swing/plaf/basic/BasicTextUI$FocusAction
+javax/swing/plaf/basic/BasicTextUI$RootView
+javax/swing/plaf/basic/BasicTextUI$TextActionWrapper
+javax/swing/plaf/basic/BasicTextUI$TextTransferHandler
+javax/swing/plaf/basic/BasicTextUI$TextTransferHandler$TextTransferable
+javax/swing/plaf/basic/BasicTextUI$UpdateHandler
+javax/swing/plaf/basic/BasicToolBarSeparatorUI
+javax/swing/plaf/basic/BasicToolBarUI
+javax/swing/plaf/basic/BasicToolBarUI$Handler
+javax/swing/plaf/basic/BasicTransferable
+javax/swing/plaf/basic/BasicViewportUI
+javax/swing/plaf/basic/ComboPopup
+javax/swing/plaf/basic/DefaultMenuLayout
+javax/swing/plaf/basic/DragRecognitionSupport$BeforeDrag
+javax/swing/plaf/basic/LazyActionMap
+javax/swing/plaf/metal/DefaultMetalTheme
+javax/swing/plaf/metal/DefaultMetalTheme$FontDelegate
+javax/swing/plaf/metal/DefaultMetalTheme$FontDelegate$1
+javax/swing/plaf/metal/MetalLookAndFeel
+javax/swing/plaf/metal/MetalTheme
+javax/swing/plaf/synth/SynthConstants
+javax/swing/plaf/synth/SynthUI
+javax/swing/text/AbstractDocument
+javax/swing/text/AbstractDocument$1
+javax/swing/text/AbstractDocument$AbstractElement
+javax/swing/text/AbstractDocument$AttributeContext
+javax/swing/text/AbstractDocument$BidiElement
+javax/swing/text/AbstractDocument$BidiRootElement
+javax/swing/text/AbstractDocument$BranchElement
+javax/swing/text/AbstractDocument$Content
+javax/swing/text/AbstractDocument$DefaultDocumentEvent
+javax/swing/text/AbstractDocument$ElementEdit
+javax/swing/text/AbstractDocument$InsertStringResult
+javax/swing/text/AbstractDocument$LeafElement
+javax/swing/text/AttributeSet
+javax/swing/text/AttributeSet$CharacterAttribute
+javax/swing/text/AttributeSet$ColorAttribute
+javax/swing/text/AttributeSet$FontAttribute
+javax/swing/text/AttributeSet$ParagraphAttribute
+javax/swing/text/Caret
+javax/swing/text/DefaultCaret
+javax/swing/text/DefaultCaret$1
+javax/swing/text/DefaultCaret$Handler
+javax/swing/text/DefaultEditorKit
+javax/swing/text/DefaultEditorKit$BeepAction
+javax/swing/text/DefaultEditorKit$BeginAction
+javax/swing/text/DefaultEditorKit$BeginLineAction
+javax/swing/text/DefaultEditorKit$BeginParagraphAction
+javax/swing/text/DefaultEditorKit$BeginWordAction
+javax/swing/text/DefaultEditorKit$CopyAction
+javax/swing/text/DefaultEditorKit$CutAction
+javax/swing/text/DefaultEditorKit$DefaultKeyTypedAction
+javax/swing/text/DefaultEditorKit$DeleteNextCharAction
+javax/swing/text/DefaultEditorKit$DeletePrevCharAction
+javax/swing/text/DefaultEditorKit$DeleteWordAction
+javax/swing/text/DefaultEditorKit$DumpModelAction
+javax/swing/text/DefaultEditorKit$EndAction
+javax/swing/text/DefaultEditorKit$EndLineAction
+javax/swing/text/DefaultEditorKit$EndParagraphAction
+javax/swing/text/DefaultEditorKit$EndWordAction
+javax/swing/text/DefaultEditorKit$InsertBreakAction
+javax/swing/text/DefaultEditorKit$InsertContentAction
+javax/swing/text/DefaultEditorKit$InsertTabAction
+javax/swing/text/DefaultEditorKit$NextVisualPositionAction
+javax/swing/text/DefaultEditorKit$NextWordAction
+javax/swing/text/DefaultEditorKit$PageAction
+javax/swing/text/DefaultEditorKit$PasteAction
+javax/swing/text/DefaultEditorKit$PreviousWordAction
+javax/swing/text/DefaultEditorKit$ReadOnlyAction
+javax/swing/text/DefaultEditorKit$SelectAllAction
+javax/swing/text/DefaultEditorKit$SelectLineAction
+javax/swing/text/DefaultEditorKit$SelectParagraphAction
+javax/swing/text/DefaultEditorKit$SelectWordAction
+javax/swing/text/DefaultEditorKit$ToggleComponentOrientationAction
+javax/swing/text/DefaultEditorKit$UnselectAction
+javax/swing/text/DefaultEditorKit$VerticalPageAction
+javax/swing/text/DefaultEditorKit$WritableAction
+javax/swing/text/DefaultHighlighter
+javax/swing/text/DefaultHighlighter$DefaultHighlightPainter
+javax/swing/text/DefaultHighlighter$HighlightInfo
+javax/swing/text/DefaultHighlighter$LayeredHighlightInfo
+javax/swing/text/DefaultHighlighter$SafeDamager
+javax/swing/text/Document
+javax/swing/text/EditorKit
+javax/swing/text/Element
+javax/swing/text/FieldView
+javax/swing/text/GapContent
+javax/swing/text/GapContent$InsertUndo
+javax/swing/text/GapContent$MarkData
+javax/swing/text/GapContent$MarkVector
+javax/swing/text/GapContent$StickyPosition
+javax/swing/text/GapVector
+javax/swing/text/Highlighter
+javax/swing/text/Highlighter$Highlight
+javax/swing/text/Highlighter$HighlightPainter
+javax/swing/text/JTextComponent
+javax/swing/text/JTextComponent$1
+javax/swing/text/JTextComponent$DefaultKeymap
+javax/swing/text/JTextComponent$KeymapActionMap
+javax/swing/text/JTextComponent$KeymapWrapper
+javax/swing/text/JTextComponent$MutableCaretEvent
+javax/swing/text/Keymap
+javax/swing/text/LayeredHighlighter
+javax/swing/text/LayeredHighlighter$LayerPainter
+javax/swing/text/MutableAttributeSet
+javax/swing/text/PlainDocument
+javax/swing/text/PlainView
+javax/swing/text/Position
+javax/swing/text/Position$Bias
+javax/swing/text/Segment
+javax/swing/text/SegmentCache
+javax/swing/text/SegmentCache$CachedSegment
+javax/swing/text/SimpleAttributeSet
+javax/swing/text/SimpleAttributeSet$EmptyAttributeSet
+javax/swing/text/Style
+javax/swing/text/StyleConstants
+javax/swing/text/StyleConstants$CharacterConstants
+javax/swing/text/StyleConstants$ColorConstants
+javax/swing/text/StyleConstants$FontConstants
+javax/swing/text/StyleConstants$ParagraphConstants
+javax/swing/text/StyleContext
+javax/swing/text/StyleContext$FontKey
+javax/swing/text/StyleContext$KeyEnumeration
+javax/swing/text/StyleContext$NamedStyle
+javax/swing/text/StyleContext$SmallAttributeSet
+javax/swing/text/TabExpander
+javax/swing/text/TextAction
+javax/swing/text/Utilities
+javax/swing/text/View
+javax/swing/text/ViewFactory
+javax/swing/tree/TreeNode
+javax/swing/undo/AbstractUndoableEdit
+javax/swing/undo/CompoundEdit
+javax/swing/undo/UndoableEdit
+sun/awt/AWTAccessor
+sun/awt/AWTAccessor$AWTEventAccessor
+sun/awt/AWTAccessor$ClientPropertyKeyAccessor
+sun/awt/AWTAccessor$ComponentAccessor
+sun/awt/AWTAccessor$ContainerAccessor
+sun/awt/AWTAccessor$CursorAccessor
+sun/awt/AWTAccessor$DefaultKeyboardFocusManagerAccessor
+sun/awt/AWTAccessor$EventQueueAccessor
+sun/awt/AWTAccessor$FrameAccessor
+sun/awt/AWTAccessor$InputEventAccessor
+sun/awt/AWTAccessor$KeyEventAccessor
+sun/awt/AWTAccessor$KeyboardFocusManagerAccessor
+sun/awt/AWTAccessor$ToolkitAccessor
+sun/awt/AWTAccessor$WindowAccessor
+sun/awt/AWTAutoShutdown
+sun/awt/AppContext
+sun/awt/AppContext$1
+sun/awt/AppContext$2
+sun/awt/AppContext$3
+sun/awt/AppContext$6
+sun/awt/AppContext$State
+sun/awt/CGraphicsConfig
+sun/awt/CGraphicsDevice
+sun/awt/CGraphicsEnvironment
+sun/awt/CGraphicsEnvironment$1
+sun/awt/CGraphicsEnvironment$2
+sun/awt/CausedFocusEvent
+sun/awt/CausedFocusEvent$Cause
+sun/awt/ComponentFactory
+sun/awt/ConstrainableGraphics
+sun/awt/DisplayChangedListener
+sun/awt/EmbeddedFrame
+sun/awt/EventQueueDelegate
+sun/awt/EventQueueItem
+sun/awt/FontConfiguration
+sun/awt/FontDescriptor
+sun/awt/FullScreenCapable
+sun/awt/HeadlessToolkit
+sun/awt/InputMethodSupport
+sun/awt/KeyboardFocusManagerPeerImpl
+sun/awt/KeyboardFocusManagerPeerProvider
+sun/awt/LightweightFrame
+sun/awt/ModalExclude
+sun/awt/ModalityEvent
+sun/awt/ModalityListener
+sun/awt/MostRecentKeyValue
+sun/awt/Mutex
+sun/awt/NullComponentPeer
+sun/awt/OSInfo
+sun/awt/OSInfo$1
+sun/awt/OSInfo$OSType
+sun/awt/OSInfo$WindowsVersion
+sun/awt/PaintEventDispatcher
+sun/awt/PeerEvent
+sun/awt/PostEventQueue
+sun/awt/RepaintArea
+sun/awt/RequestFocusController
+sun/awt/SunDisplayChanger
+sun/awt/SunGraphicsCallback
+sun/awt/SunHints
+sun/awt/SunHints$Key
+sun/awt/SunHints$LCDContrastKey
+sun/awt/SunHints$Value
+sun/awt/SunToolkit
+sun/awt/SunToolkit$1
+sun/awt/SunToolkit$ModalityListenerList
+sun/awt/TimedWindowEvent
+sun/awt/WindowClosingListener
+sun/awt/WindowClosingSupport
+sun/awt/datatransfer/DataTransferer
+sun/awt/datatransfer/DataTransferer$1
+sun/awt/datatransfer/DataTransferer$CharsetComparator
+sun/awt/datatransfer/DataTransferer$IndexOrderComparator
+sun/awt/datatransfer/DataTransferer$IndexedComparator
+sun/awt/datatransfer/DataTransferer$RMI
+sun/awt/datatransfer/DataTransferer$StandardEncodingsHolder
+sun/awt/datatransfer/SunClipboard
+sun/awt/datatransfer/ToolkitThreadBlockedHandler
+sun/awt/datatransfer/TransferableProxy
+sun/awt/dnd/SunDragSourceContextPeer
+sun/awt/dnd/SunDropTargetEvent
+sun/awt/event/IgnorePaintEvent
+sun/awt/im/CompositionAreaHandler
+sun/awt/im/ExecutableInputMethodManager
+sun/awt/im/ExecutableInputMethodManager$3
+sun/awt/im/InputContext
+sun/awt/im/InputMethodAdapter
+sun/awt/im/InputMethodContext
+sun/awt/im/InputMethodLocator
+sun/awt/im/InputMethodManager
+sun/awt/im/InputMethodWindow
+sun/awt/image/BufImgSurfaceData
+sun/awt/image/BufImgSurfaceData$ICMColorData
+sun/awt/image/BufImgSurfaceManager
+sun/awt/image/BufferedImageGraphicsConfig
+sun/awt/image/ByteComponentRaster
+sun/awt/image/ByteInterleavedRaster
+sun/awt/image/BytePackedRaster
+sun/awt/image/FetcherInfo
+sun/awt/image/GifFrame
+sun/awt/image/GifImageDecoder
+sun/awt/image/ImageConsumerQueue
+sun/awt/image/ImageDecoder
+sun/awt/image/ImageFetchable
+sun/awt/image/ImageFetcher
+sun/awt/image/ImageFetcher$1
+sun/awt/image/ImageRepresentation
+sun/awt/image/ImageWatched
+sun/awt/image/ImageWatched$Link
+sun/awt/image/ImageWatched$WeakLink
+sun/awt/image/InputStreamImageSource
+sun/awt/image/IntegerComponentRaster
+sun/awt/image/IntegerInterleavedRaster
+sun/awt/image/NativeLibLoader
+sun/awt/image/NativeLibLoader$1
+sun/awt/image/OffScreenImage
+sun/awt/image/OffScreenImageSource
+sun/awt/image/PNGFilterInputStream
+sun/awt/image/PNGImageDecoder
+sun/awt/image/PixelConverter
+sun/awt/image/PixelConverter$Argb
+sun/awt/image/PixelConverter$ArgbBm
+sun/awt/image/PixelConverter$ArgbPre
+sun/awt/image/PixelConverter$Bgrx
+sun/awt/image/PixelConverter$ByteGray
+sun/awt/image/PixelConverter$Rgba
+sun/awt/image/PixelConverter$RgbaPre
+sun/awt/image/PixelConverter$Rgbx
+sun/awt/image/PixelConverter$Ushort4444Argb
+sun/awt/image/PixelConverter$Ushort555Rgb
+sun/awt/image/PixelConverter$Ushort555Rgbx
+sun/awt/image/PixelConverter$Ushort565Rgb
+sun/awt/image/PixelConverter$UshortGray
+sun/awt/image/PixelConverter$Xbgr
+sun/awt/image/PixelConverter$Xrgb
+sun/awt/image/SunVolatileImage
+sun/awt/image/SunWritableRaster
+sun/awt/image/SunWritableRaster$DataStealer
+sun/awt/image/SurfaceManager
+sun/awt/image/SurfaceManager$FlushableCacheData
+sun/awt/image/SurfaceManager$ImageAccessor
+sun/awt/image/SurfaceManager$ProxiedGraphicsConfig
+sun/awt/image/ToolkitImage
+sun/awt/image/URLImageSource
+sun/awt/image/VolatileSurfaceManager
+sun/awt/resources/awt
+sun/awt/resources/awtosx
+sun/awt/util/IdentityArrayList
+sun/awt/util/IdentityLinkedList
+sun/awt/util/IdentityLinkedList$Entry
+sun/awt/util/IdentityLinkedList$ListItr
+sun/dc/DuctusRenderingEngine
+sun/font/AttributeValues
+sun/font/CCharToGlyphMapper
+sun/font/CCharToGlyphMapper$Cache
+sun/font/CFont
+sun/font/CFontConfiguration
+sun/font/CFontManager
+sun/font/CFontManager$4
+sun/font/CStrike
+sun/font/CStrike$GlyphAdvanceCache
+sun/font/CStrike$GlyphInfoCache
+sun/font/CStrikeDisposer
+sun/font/CharToGlyphMapper
+sun/font/CompositeFont
+sun/font/CompositeFontDescriptor
+sun/font/CoreMetrics
+sun/font/EAttribute
+sun/font/FileFont
+sun/font/Font2D
+sun/font/Font2DHandle
+sun/font/FontAccess
+sun/font/FontDesignMetrics
+sun/font/FontDesignMetrics$KeyReference
+sun/font/FontDesignMetrics$MetricsKey
+sun/font/FontFamily
+sun/font/FontLineMetrics
+sun/font/FontManager
+sun/font/FontManagerFactory
+sun/font/FontManagerFactory$1
+sun/font/FontManagerForSGE
+sun/font/FontManagerNativeLibrary
+sun/font/FontManagerNativeLibrary$1
+sun/font/FontStrike
+sun/font/FontStrikeDesc
+sun/font/FontStrikeDisposer
+sun/font/FontUtilities
+sun/font/FontUtilities$1
+sun/font/GlyphList
+sun/font/PhysicalFont
+sun/font/PhysicalStrike
+sun/font/StandardGlyphVector
+sun/font/StandardGlyphVector$GlyphStrike
+sun/font/StrikeCache
+sun/font/StrikeCache$1
+sun/font/StrikeCache$DisposableStrike
+sun/font/StrikeCache$SoftDisposerRef
+sun/font/StrikeMetrics
+sun/font/SunFontManager
+sun/font/SunFontManager$1
+sun/font/SunFontManager$11
+sun/font/SunFontManager$2
+sun/font/SunFontManager$3
+sun/font/SunFontManager$FontRegistrationInfo
+sun/font/SunFontManager$T1Filter
+sun/font/SunFontManager$TTFilter
+sun/font/TrueTypeFont
+sun/font/TrueTypeFont$1
+sun/font/TrueTypeFont$DirectoryEntry
+sun/font/TrueTypeFont$TTDisposerRecord
+sun/font/Type1Font
+sun/java2d/DefaultDisposerRecord
+sun/java2d/DestSurfaceProvider
+sun/java2d/Disposer
+sun/java2d/Disposer$1
+sun/java2d/Disposer$2
+sun/java2d/Disposer$PollDisposable
+sun/java2d/DisposerRecord
+sun/java2d/DisposerTarget
+sun/java2d/FontSupport
+sun/java2d/InvalidPipeException
+sun/java2d/MacosxSurfaceManagerFactory
+sun/java2d/NullSurfaceData
+sun/java2d/StateTrackable
+sun/java2d/StateTrackable$State
+sun/java2d/StateTrackableDelegate
+sun/java2d/StateTrackableDelegate$1
+sun/java2d/StateTrackableDelegate$2
+sun/java2d/StateTracker
+sun/java2d/StateTracker$1
+sun/java2d/StateTracker$2
+sun/java2d/SunGraphics2D
+sun/java2d/SunGraphicsEnvironment
+sun/java2d/SunGraphicsEnvironment$1
+sun/java2d/Surface
+sun/java2d/SurfaceData
+sun/java2d/SurfaceData$PixelToPgramLoopConverter
+sun/java2d/SurfaceData$PixelToShapeLoopConverter
+sun/java2d/SurfaceDataProxy
+sun/java2d/SurfaceDataProxy$1
+sun/java2d/SurfaceManagerFactory
+sun/java2d/cmm/CMSManager
+sun/java2d/cmm/ProfileActivator
+sun/java2d/cmm/ProfileDeferralInfo
+sun/java2d/cmm/ProfileDeferralMgr
+sun/java2d/loops/Blit
+sun/java2d/loops/BlitBg
+sun/java2d/loops/CompositeType
+sun/java2d/loops/CustomComponent
+sun/java2d/loops/DrawGlyphList
+sun/java2d/loops/DrawGlyphListAA
+sun/java2d/loops/DrawGlyphListLCD
+sun/java2d/loops/DrawLine
+sun/java2d/loops/DrawParallelogram
+sun/java2d/loops/DrawPath
+sun/java2d/loops/DrawPolygons
+sun/java2d/loops/DrawRect
+sun/java2d/loops/FillParallelogram
+sun/java2d/loops/FillPath
+sun/java2d/loops/FillRect
+sun/java2d/loops/FillSpans
+sun/java2d/loops/FontInfo
+sun/java2d/loops/GeneralRenderer
+sun/java2d/loops/GraphicsPrimitive
+sun/java2d/loops/GraphicsPrimitiveMgr
+sun/java2d/loops/GraphicsPrimitiveMgr$1
+sun/java2d/loops/GraphicsPrimitiveMgr$2
+sun/java2d/loops/GraphicsPrimitiveMgr$PrimitiveSpec
+sun/java2d/loops/GraphicsPrimitiveProxy
+sun/java2d/loops/MaskBlit
+sun/java2d/loops/MaskFill
+sun/java2d/loops/ProcessPath$DrawHandler
+sun/java2d/loops/RenderCache
+sun/java2d/loops/RenderCache$Entry
+sun/java2d/loops/RenderLoops
+sun/java2d/loops/ScaledBlit
+sun/java2d/loops/SurfaceType
+sun/java2d/loops/TransformBlit
+sun/java2d/loops/TransformHelper
+sun/java2d/loops/XORComposite
+sun/java2d/opengl/CGLGraphicsConfig
+sun/java2d/opengl/CGLGraphicsConfig$1
+sun/java2d/opengl/CGLGraphicsConfig$CGLGCDisposerRecord
+sun/java2d/opengl/CGLGraphicsConfig$CGLImageCaps
+sun/java2d/opengl/CGLLayer
+sun/java2d/opengl/CGLSurfaceData
+sun/java2d/opengl/CGLSurfaceData$CGLLayerSurfaceData
+sun/java2d/opengl/CGLSurfaceData$CGLOffScreenSurfaceData
+sun/java2d/opengl/CGLVolatileSurfaceManager
+sun/java2d/opengl/OGLAnyCompositeBlit
+sun/java2d/opengl/OGLBlitLoops
+sun/java2d/opengl/OGLContext
+sun/java2d/opengl/OGLContext$OGLContextCaps
+sun/java2d/opengl/OGLDrawImage
+sun/java2d/opengl/OGLGeneralBlit
+sun/java2d/opengl/OGLGraphicsConfig
+sun/java2d/opengl/OGLMaskBlit
+sun/java2d/opengl/OGLMaskFill
+sun/java2d/opengl/OGLRTTSurfaceToSurfaceBlit
+sun/java2d/opengl/OGLRTTSurfaceToSurfaceScale
+sun/java2d/opengl/OGLRTTSurfaceToSurfaceTransform
+sun/java2d/opengl/OGLRenderQueue
+sun/java2d/opengl/OGLRenderQueue$1
+sun/java2d/opengl/OGLRenderQueue$QueueFlusher
+sun/java2d/opengl/OGLRenderer
+sun/java2d/opengl/OGLSurfaceData
+sun/java2d/opengl/OGLSurfaceData$1
+sun/java2d/opengl/OGLSurfaceDataProxy
+sun/java2d/opengl/OGLSurfaceToSurfaceBlit
+sun/java2d/opengl/OGLSurfaceToSurfaceScale
+sun/java2d/opengl/OGLSurfaceToSurfaceTransform
+sun/java2d/opengl/OGLSurfaceToSwBlit
+sun/java2d/opengl/OGLSwToSurfaceBlit
+sun/java2d/opengl/OGLSwToSurfaceScale
+sun/java2d/opengl/OGLSwToSurfaceTransform
+sun/java2d/opengl/OGLSwToTextureBlit
+sun/java2d/opengl/OGLTextRenderer
+sun/java2d/opengl/OGLTextureToSurfaceBlit
+sun/java2d/opengl/OGLTextureToSurfaceScale
+sun/java2d/opengl/OGLTextureToSurfaceTransform
+sun/java2d/pipe/AAShapePipe
+sun/java2d/pipe/AATextRenderer
+sun/java2d/pipe/AlphaColorPipe
+sun/java2d/pipe/AlphaPaintPipe
+sun/java2d/pipe/BufferedContext
+sun/java2d/pipe/BufferedMaskBlit
+sun/java2d/pipe/BufferedMaskFill
+sun/java2d/pipe/BufferedPaints
+sun/java2d/pipe/BufferedRenderPipe
+sun/java2d/pipe/BufferedRenderPipe$AAParallelogramPipe
+sun/java2d/pipe/BufferedRenderPipe$BufferedDrawHandler
+sun/java2d/pipe/BufferedTextPipe
+sun/java2d/pipe/CompositePipe
+sun/java2d/pipe/DrawImage
+sun/java2d/pipe/DrawImagePipe
+sun/java2d/pipe/GeneralCompositePipe
+sun/java2d/pipe/GlyphListLoopPipe
+sun/java2d/pipe/GlyphListPipe
+sun/java2d/pipe/LCDTextRenderer
+sun/java2d/pipe/LoopBasedPipe
+sun/java2d/pipe/LoopPipe
+sun/java2d/pipe/NullPipe
+sun/java2d/pipe/OutlineTextRenderer
+sun/java2d/pipe/ParallelogramPipe
+sun/java2d/pipe/PixelDrawPipe
+sun/java2d/pipe/PixelFillPipe
+sun/java2d/pipe/PixelToParallelogramConverter
+sun/java2d/pipe/PixelToShapeConverter
+sun/java2d/pipe/Region
+sun/java2d/pipe/Region$ImmutableRegion
+sun/java2d/pipe/RegionIterator
+sun/java2d/pipe/RenderBuffer
+sun/java2d/pipe/RenderQueue
+sun/java2d/pipe/RenderingEngine
+sun/java2d/pipe/RenderingEngine$1
+sun/java2d/pipe/ShapeDrawPipe
+sun/java2d/pipe/SolidTextRenderer
+sun/java2d/pipe/SpanClipRenderer
+sun/java2d/pipe/SpanShapeRenderer
+sun/java2d/pipe/SpanShapeRenderer$Composite
+sun/java2d/pipe/TextPipe
+sun/java2d/pipe/TextRenderer
+sun/java2d/pipe/ValidatePipe
+sun/java2d/pipe/hw/AccelGraphicsConfig
+sun/java2d/pipe/hw/AccelSurface
+sun/java2d/pipe/hw/BufferedContextProvider
+sun/java2d/pipe/hw/ContextCapabilities
+sun/launcher/LauncherHelper
+sun/launcher/LauncherHelper$FXHelper
+sun/lwawt/LWCanvasPeer
+sun/lwawt/LWComponentPeer
+sun/lwawt/LWComponentPeer$1
+sun/lwawt/LWComponentPeer$2
+sun/lwawt/LWComponentPeer$3
+sun/lwawt/LWComponentPeer$DelegateContainer
+sun/lwawt/LWContainerPeer
+sun/lwawt/LWCursorManager
+sun/lwawt/LWCursorManager$1
+sun/lwawt/LWGraphicsConfig
+sun/lwawt/LWKeyboardFocusManagerPeer
+sun/lwawt/LWLabelPeer
+sun/lwawt/LWRepaintArea
+sun/lwawt/LWToolkit
+sun/lwawt/LWWindowPeer
+sun/lwawt/LWWindowPeer$PeerType
+sun/lwawt/PlatformComponent
+sun/lwawt/PlatformEventNotifier
+sun/lwawt/PlatformWindow
+sun/lwawt/macosx/CClipboard
+sun/lwawt/macosx/CCursorManager
+sun/lwawt/macosx/CCustomCursor
+sun/lwawt/macosx/CDataTransferer
+sun/lwawt/macosx/CDropTarget
+sun/lwawt/macosx/CFRetainedResource
+sun/lwawt/macosx/CImage
+sun/lwawt/macosx/CImage$Creator
+sun/lwawt/macosx/CInputMethod
+sun/lwawt/macosx/CInputMethodDescriptor
+sun/lwawt/macosx/CPlatformComponent
+sun/lwawt/macosx/CPlatformResponder
+sun/lwawt/macosx/CPlatformView
+sun/lwawt/macosx/CPlatformWindow
+sun/lwawt/macosx/CPlatformWindow$1
+sun/lwawt/macosx/CPlatformWindow$10
+sun/lwawt/macosx/CPlatformWindow$11
+sun/lwawt/macosx/CPlatformWindow$12
+sun/lwawt/macosx/CPlatformWindow$14
+sun/lwawt/macosx/CPlatformWindow$2
+sun/lwawt/macosx/CPlatformWindow$3
+sun/lwawt/macosx/CPlatformWindow$4
+sun/lwawt/macosx/CPlatformWindow$5
+sun/lwawt/macosx/CPlatformWindow$6
+sun/lwawt/macosx/CPlatformWindow$7
+sun/lwawt/macosx/CPlatformWindow$8
+sun/lwawt/macosx/CPlatformWindow$9
+sun/lwawt/macosx/CPrinterDialog
+sun/lwawt/macosx/CThreading
+sun/lwawt/macosx/CToolkitThreadBlockedHandler
+sun/lwawt/macosx/CWrapper$NSWindow
+sun/lwawt/macosx/LWCToolkit
+sun/lwawt/macosx/LWCToolkit$1
+sun/lwawt/macosx/LWCToolkit$2
+sun/lwawt/macosx/LWCToolkit$5
+sun/lwawt/macosx/LWCToolkit$AppleSpecificColor
+sun/lwawt/macosx/NamedCursor
+sun/lwawt/macosx/event/NSEvent
+sun/misc/ASCIICaseInsensitiveComparator
+sun/misc/Cleaner
+sun/misc/CompoundEnumeration
+sun/misc/ExtensionDependency
+sun/misc/FileURLMapper
+sun/misc/FloatingDecimal
+sun/misc/FloatingDecimal$1
+sun/misc/FloatingDecimal$ASCIIToBinaryConverter
+sun/misc/FloatingDecimal$BinaryToASCIIBuffer
+sun/misc/FloatingDecimal$BinaryToASCIIConverter
+sun/misc/FloatingDecimal$ExceptionalBinaryToASCIIBuffer
+sun/misc/FloatingDecimal$PreparedASCIIToBinaryBuffer
+sun/misc/IOUtils
+sun/misc/JarIndex
+sun/misc/JavaAWTAccess
+sun/misc/JavaIOFileDescriptorAccess
+sun/misc/JavaLangAccess
+sun/misc/JavaNetAccess
+sun/misc/JavaNioAccess
+sun/misc/JavaSecurityAccess
+sun/misc/JavaSecurityProtectionDomainAccess
+sun/misc/JavaUtilJarAccess
+sun/misc/JavaUtilZipFileAccess
+sun/misc/Launcher
+sun/misc/Launcher$AppClassLoader
+sun/misc/Launcher$AppClassLoader$1
+sun/misc/Launcher$BootClassPathHolder
+sun/misc/Launcher$BootClassPathHolder$1
+sun/misc/Launcher$ExtClassLoader
+sun/misc/Launcher$ExtClassLoader$1
+sun/misc/Launcher$Factory
+sun/misc/MetaIndex
+sun/misc/NativeSignalHandler
+sun/misc/OSEnvironment
+sun/misc/Perf
+sun/misc/Perf$GetPerfAction
+sun/misc/PerfCounter
+sun/misc/PerfCounter$CoreCounters
+sun/misc/PerformanceLogger
+sun/misc/PerformanceLogger$TimeData
+sun/misc/PostVMInitHook
+sun/misc/Resource
+sun/misc/SharedSecrets
+sun/misc/Signal
+sun/misc/SignalHandler
+sun/misc/SoftCache
+sun/misc/SoftCache$ValueCell
+sun/misc/URLClassPath
+sun/misc/URLClassPath$1
+sun/misc/URLClassPath$2
+sun/misc/URLClassPath$3
+sun/misc/URLClassPath$FileLoader
+sun/misc/URLClassPath$JarLoader
+sun/misc/URLClassPath$JarLoader$1
+sun/misc/URLClassPath$JarLoader$2
+sun/misc/URLClassPath$Loader
+sun/misc/Unsafe
+sun/misc/VM
+sun/misc/Version
+sun/net/DefaultProgressMeteringPolicy
+sun/net/NetHooks
+sun/net/NetHooks$Provider
+sun/net/NetProperties
+sun/net/NetProperties$1
+sun/net/ProgressMeteringPolicy
+sun/net/ProgressMonitor
+sun/net/sdp/SdpProvider
+sun/net/spi/DefaultProxySelector
+sun/net/spi/DefaultProxySelector$1
+sun/net/spi/DefaultProxySelector$3
+sun/net/spi/DefaultProxySelector$NonProxyInfo
+sun/net/spi/nameservice/NameService
+sun/net/util/IPAddressUtil
+sun/net/util/URLUtil
+sun/net/www/MessageHeader
+sun/net/www/ParseUtil
+sun/net/www/URLConnection
+sun/net/www/protocol/file/FileURLConnection
+sun/net/www/protocol/file/Handler
+sun/net/www/protocol/jar/Handler
+sun/net/www/protocol/jar/JarFileFactory
+sun/net/www/protocol/jar/JarURLConnection
+sun/net/www/protocol/jar/JarURLConnection$JarURLInputStream
+sun/net/www/protocol/jar/URLJarFile
+sun/net/www/protocol/jar/URLJarFile$URLJarFileCloseController
+sun/net/www/protocol/jar/URLJarFile$URLJarFileEntry
+sun/nio/ByteBuffered
+sun/nio/ch/DirectBuffer
+sun/nio/ch/FileChannelImpl
+sun/nio/ch/FileDispatcher
+sun/nio/ch/FileDispatcherImpl
+sun/nio/ch/IOStatus
+sun/nio/ch/IOUtil
+sun/nio/ch/IOUtil$1
+sun/nio/ch/Interruptible
+sun/nio/ch/NativeDispatcher
+sun/nio/ch/NativeThread
+sun/nio/ch/NativeThreadSet
+sun/nio/ch/Util
+sun/nio/ch/Util$1
+sun/nio/ch/Util$BufferCache
+sun/nio/cs/ArrayDecoder
+sun/nio/cs/ArrayEncoder
+sun/nio/cs/FastCharsetProvider
+sun/nio/cs/HistoricallyNamedCharset
+sun/nio/cs/ISO_8859_1
+sun/nio/cs/ISO_8859_1$Decoder
+sun/nio/cs/StandardCharsets
+sun/nio/cs/StandardCharsets$Aliases
+sun/nio/cs/StandardCharsets$Cache
+sun/nio/cs/StandardCharsets$Classes
+sun/nio/cs/StreamDecoder
+sun/nio/cs/StreamEncoder
+sun/nio/cs/US_ASCII
+sun/nio/cs/UTF_16
+sun/nio/cs/UTF_16$Decoder
+sun/nio/cs/UTF_16BE
+sun/nio/cs/UTF_16LE
+sun/nio/cs/UTF_8
+sun/nio/cs/UTF_8$Decoder
+sun/nio/cs/UTF_8$Encoder
+sun/nio/cs/Unicode
+sun/nio/cs/UnicodeDecoder
+sun/print/PrinterGraphicsConfig
+sun/reflect/AccessorGenerator
+sun/reflect/BootstrapConstructorAccessorImpl
+sun/reflect/ByteVector
+sun/reflect/ByteVectorFactory
+sun/reflect/ByteVectorImpl
+sun/reflect/CallerSensitive
+sun/reflect/ClassDefiner
+sun/reflect/ClassDefiner$1
+sun/reflect/ClassFileAssembler
+sun/reflect/ClassFileConstants
+sun/reflect/ConstantPool
+sun/reflect/ConstructorAccessor
+sun/reflect/ConstructorAccessorImpl
+sun/reflect/DelegatingClassLoader
+sun/reflect/DelegatingConstructorAccessorImpl
+sun/reflect/DelegatingMethodAccessorImpl
+sun/reflect/FieldAccessor
+sun/reflect/FieldAccessorImpl
+sun/reflect/Label
+sun/reflect/Label$PatchInfo
+sun/reflect/LangReflectAccess
+sun/reflect/MagicAccessorImpl
+sun/reflect/MethodAccessor
+sun/reflect/MethodAccessorGenerator
+sun/reflect/MethodAccessorGenerator$1
+sun/reflect/MethodAccessorImpl
+sun/reflect/NativeConstructorAccessorImpl
+sun/reflect/NativeMethodAccessorImpl
+sun/reflect/Reflection
+sun/reflect/ReflectionFactory
+sun/reflect/ReflectionFactory$1
+sun/reflect/ReflectionFactory$GetReflectionFactoryAction
+sun/reflect/SerializationConstructorAccessorImpl
+sun/reflect/UTF8
+sun/reflect/UnsafeBooleanFieldAccessorImpl
+sun/reflect/UnsafeFieldAccessorFactory
+sun/reflect/UnsafeFieldAccessorImpl
+sun/reflect/UnsafeObjectFieldAccessorImpl
+sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl
+sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl
+sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl
+sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl
+sun/reflect/UnsafeStaticFieldAccessorImpl
+sun/reflect/annotation/AnnotationType
+sun/reflect/generics/repository/AbstractRepository
+sun/reflect/generics/repository/ClassRepository
+sun/reflect/generics/repository/GenericDeclRepository
+sun/reflect/misc/MethodUtil
+sun/reflect/misc/MethodUtil$1
+sun/reflect/misc/ReflectUtil
+sun/security/action/GetBooleanAction
+sun/security/action/GetPropertyAction
+sun/security/util/Debug
+sun/security/util/ManifestEntryVerifier
+sun/swing/DefaultLookup
+sun/swing/JLightweightFrame
+sun/swing/MenuItemLayoutHelper
+sun/swing/StringUIClientPropertyKey
+sun/swing/SwingAccessor
+sun/swing/SwingAccessor$JTextComponentAccessor
+sun/swing/SwingLazyValue
+sun/swing/SwingLazyValue$1
+sun/swing/SwingUtilities2
+sun/swing/SwingUtilities2$2
+sun/swing/SwingUtilities2$AATextInfo
+sun/swing/SwingUtilities2$LSBCacheEntry
+sun/swing/UIAction
+sun/swing/UIClientPropertyKey
+sun/util/CoreResourceBundleControl
+sun/util/PreHashedMap
+sun/util/ResourceBundleEnumeration
+sun/util/calendar/AbstractCalendar
+sun/util/calendar/BaseCalendar
+sun/util/calendar/BaseCalendar$Date
+sun/util/calendar/CalendarDate
+sun/util/calendar/CalendarSystem
+sun/util/calendar/CalendarUtils
+sun/util/calendar/Gregorian
+sun/util/calendar/Gregorian$Date
+sun/util/calendar/ZoneInfo
+sun/util/calendar/ZoneInfoFile
+sun/util/calendar/ZoneInfoFile$1
+sun/util/calendar/ZoneInfoFile$Checksum
+sun/util/calendar/ZoneInfoFile$ZoneOffsetTransitionRule
+sun/util/locale/BaseLocale
+sun/util/locale/BaseLocale$Cache
+sun/util/locale/BaseLocale$Key
+sun/util/locale/LocaleObjectCache
+sun/util/locale/LocaleObjectCache$CacheEntry
+sun/util/locale/LocaleUtils
+sun/util/locale/provider/AuxLocaleProviderAdapter
+sun/util/locale/provider/AuxLocaleProviderAdapter$NullProvider
+sun/util/locale/provider/JRELocaleProviderAdapter
+sun/util/locale/provider/JRELocaleProviderAdapter$1
+sun/util/locale/provider/LocaleDataMetaInfo
+sun/util/locale/provider/LocaleProviderAdapter
+sun/util/locale/provider/LocaleProviderAdapter$1
+sun/util/locale/provider/LocaleProviderAdapter$Type
+sun/util/locale/provider/LocaleResources
+sun/util/locale/provider/LocaleResources$ResourceReference
+sun/util/locale/provider/LocaleServiceProviderPool
+sun/util/locale/provider/LocaleServiceProviderPool$LocalizedObjectGetter
+sun/util/locale/provider/ResourceBundleBasedAdapter
+sun/util/locale/provider/SPILocaleProviderAdapter
+sun/util/locale/provider/SPILocaleProviderAdapter$1
+sun/util/locale/provider/TimeZoneNameProviderImpl
+sun/util/locale/provider/TimeZoneNameUtility$TimeZoneNameGetter
+sun/util/logging/LoggingProxy
+sun/util/logging/LoggingSupport
+sun/util/logging/LoggingSupport$1
+sun/util/logging/LoggingSupport$2
+sun/util/logging/PlatformLogger
+sun/util/logging/PlatformLogger$1
+sun/util/logging/PlatformLogger$DefaultLoggerProxy
+sun/util/logging/PlatformLogger$JavaLoggerProxy
+sun/util/logging/PlatformLogger$Level
+sun/util/logging/PlatformLogger$LoggerProxy
+sun/util/logging/resources/logging
+sun/util/resources/LocaleData
+sun/util/resources/LocaleData$1
+sun/util/resources/LocaleData$LocaleDataResourceBundleControl
+sun/util/resources/OpenListResourceBundle
+sun/util/resources/TimeZoneNames
+sun/util/resources/TimeZoneNamesBundle
+sun/util/resources/en/TimeZoneNames_en
+# 32aa76348b93579f
diff --git a/staging/darwin-x86/jre/lib/cmm/CIEXYZ.pf b/staging/darwin-x86/jre/lib/cmm/CIEXYZ.pf
new file mode 100644
index 0000000..48c9dd8
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/cmm/CIEXYZ.pf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/cmm/GRAY.pf b/staging/darwin-x86/jre/lib/cmm/GRAY.pf
new file mode 100644
index 0000000..8af309c
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/cmm/GRAY.pf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/cmm/LINEAR_RGB.pf b/staging/darwin-x86/jre/lib/cmm/LINEAR_RGB.pf
new file mode 100644
index 0000000..3e0b177
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/cmm/LINEAR_RGB.pf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/cmm/PYCC.pf b/staging/darwin-x86/jre/lib/cmm/PYCC.pf
new file mode 100644
index 0000000..0cee015
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/cmm/PYCC.pf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/cmm/sRGB.pf b/staging/darwin-x86/jre/lib/cmm/sRGB.pf
new file mode 100644
index 0000000..7b552ad
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/cmm/sRGB.pf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/content-types.properties b/staging/darwin-x86/jre/lib/content-types.properties
new file mode 100644
index 0000000..559de96
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/content-types.properties
@@ -0,0 +1,280 @@
+#sun.net.www MIME content-types table
+#
+# Property fields:
+#
+# <description> ::= 'description' '=' <descriptive string>
+# <extensions> ::= 'file_extensions' '=' <comma-delimited list, include '.'>
+# <image> ::= 'icon' '=' <filename of icon image>
+# <action> ::= 'browser' | 'application' | 'save' | 'unknown'
+# <application> ::= 'application' '=' <command line template>
+#
+
+#
+# The "we don't know anything about this data" type(s).
+# Used internally to mark unrecognized types.
+#
+content/unknown: description=Unknown Content
+unknown/unknown: description=Unknown Data Type
+
+#
+# The template we should use for temporary files when launching an application
+# to view a document of given type.
+#
+temp.file.template: /tmp/%s
+
+#
+# The "real" types.
+#
+application/octet-stream: \
+ description=Generic Binary Stream;\
+ file_extensions=.saveme,.dump,.hqx,.arc,.o,.a,.bin,.exe,.z,.gz
+
+application/oda: \
+ description=ODA Document;\
+ file_extensions=.oda
+
+application/pdf: \
+ description=Adobe PDF Format;\
+ file_extensions=.pdf
+
+application/postscript: \
+ description=Postscript File;\
+ file_extensions=.eps,.ai,.ps;\
+ icon=ps;\
+ action=application;\
+ application=imagetool %s
+
+application/x-dvi: \
+ description=TeX DVI File;\
+ file_extensions=.dvi;\
+ action=application;\
+ application=xdvi %s
+
+application/x-hdf: \
+ description=Hierarchical Data Format;\
+ file_extensions=.hdf;\
+ action=save
+
+application/x-latex: \
+ description=LaTeX Source;\
+ file_extensions=.latex
+
+application/x-netcdf: \
+ description=Unidata netCDF Data Format;\
+ file_extensions=.nc,.cdf;\
+ action=save
+
+application/x-tex: \
+ description=TeX Source;\
+ file_extensions=.tex
+
+application/x-texinfo: \
+ description=Gnu Texinfo;\
+ file_extensions=.texinfo,.texi
+
+application/x-troff: \
+ description=Troff Source;\
+ file_extensions=.t,.tr,.roff;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff %s | col | more -w\"
+
+application/x-troff-man: \
+ description=Troff Manpage Source;\
+ file_extensions=.man;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff -man %s | col | more -w\"
+
+application/x-troff-me: \
+ description=Troff ME Macros;\
+ file_extensions=.me;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff -me %s | col | more -w\"
+
+application/x-troff-ms: \
+ description=Troff MS Macros;\
+ file_extensions=.ms;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff -ms %s | col | more -w\"
+
+application/x-wais-source: \
+ description=Wais Source;\
+ file_extensions=.src,.wsrc
+
+application/zip: \
+ description=Zip File;\
+ file_extensions=.zip;\
+ icon=zip;\
+ action=save
+
+application/x-bcpio: \
+ description=Old Binary CPIO Archive;\
+ file_extensions=.bcpio; action=save
+
+application/x-cpio: \
+ description=Unix CPIO Archive;\
+ file_extensions=.cpio; action=save
+
+application/x-gtar: \
+ description=Gnu Tar Archive;\
+ file_extensions=.gtar;\
+ icon=tar;\
+ action=save
+
+application/x-shar: \
+ description=Shell Archive;\
+ file_extensions=.sh,.shar;\
+ action=save
+
+application/x-sv4cpio: \
+ description=SVR4 CPIO Archive;\
+ file_extensions=.sv4cpio; action=save
+
+application/x-sv4crc: \
+ description=SVR4 CPIO with CRC;\
+ file_extensions=.sv4crc; action=save
+
+application/x-tar: \
+ description=Tar Archive;\
+ file_extensions=.tar;\
+ icon=tar;\
+ action=save
+
+application/x-ustar: \
+ description=US Tar Archive;\
+ file_extensions=.ustar;\
+ action=save
+
+audio/basic: \
+ description=Basic Audio;\
+ file_extensions=.snd,.au;\
+ icon=audio;\
+ action=application;\
+ application=audiotool %s
+
+audio/x-aiff: \
+ description=Audio Interchange Format File;\
+ file_extensions=.aifc,.aif,.aiff;\
+ icon=aiff
+
+audio/x-wav: \
+ description=Wav Audio;\
+ file_extensions=.wav;\
+ icon=wav
+
+image/gif: \
+ description=GIF Image;\
+ file_extensions=.gif;\
+ icon=gif;\
+ action=browser
+
+image/ief: \
+ description=Image Exchange Format;\
+ file_extensions=.ief
+
+image/jpeg: \
+ description=JPEG Image;\
+ file_extensions=.jfif,.jfif-tbnl,.jpe,.jpg,.jpeg;\
+ icon=jpeg;\
+ action=browser;\
+ application=imagetool %s
+
+image/tiff: \
+ description=TIFF Image;\
+ file_extensions=.tif,.tiff;\
+ icon=tiff
+
+image/vnd.fpx: \
+ description=FlashPix Image;\
+ file_extensions=.fpx,.fpix
+
+image/x-cmu-rast: \
+ description=CMU Raster Image;\
+ file_extensions=.ras
+
+image/x-portable-anymap: \
+ description=PBM Anymap Format;\
+ file_extensions=.pnm
+
+image/x-portable-bitmap: \
+ description=PBM Bitmap Format;\
+ file_extensions=.pbm
+
+image/x-portable-graymap: \
+ description=PBM Graymap Format;\
+ file_extensions=.pgm
+
+image/x-portable-pixmap: \
+ description=PBM Pixmap Format;\
+ file_extensions=.ppm
+
+image/x-rgb: \
+ description=RGB Image;\
+ file_extensions=.rgb
+
+image/x-xbitmap: \
+ description=X Bitmap Image;\
+ file_extensions=.xbm,.xpm
+
+image/x-xwindowdump: \
+ description=X Window Dump Image;\
+ file_extensions=.xwd
+
+image/png: \
+ description=PNG Image;\
+ file_extensions=.png;\
+ icon=png;\
+ action=browser
+
+image/bmp: \
+ description=Bitmap Image;\
+ file_extensions=.bmp;
+
+text/html: \
+ description=HTML Document;\
+ file_extensions=.htm,.html;\
+ icon=html
+
+text/plain: \
+ description=Plain Text;\
+ file_extensions=.text,.c,.cc,.c++,.h,.pl,.txt,.java,.el;\
+ icon=text;\
+ action=browser
+
+text/tab-separated-values: \
+ description=Tab Separated Values Text;\
+ file_extensions=.tsv
+
+text/x-setext: \
+ description=Structure Enhanced Text;\
+ file_extensions=.etx
+
+video/mpeg: \
+ description=MPEG Video Clip;\
+ file_extensions=.mpg,.mpe,.mpeg;\
+ icon=mpeg;\
+ action=application;\
+ application=mpeg_play %s
+
+video/quicktime: \
+ description=QuickTime Video Clip;\
+ file_extensions=.mov,.qt
+
+application/x-troff-msvideo: \
+ description=AVI Video;\
+ file_extensions=.avi;\
+ icon=avi
+
+video/x-sgi-movie: \
+ description=SGI Movie;\
+ file_extensions=.movie,.mv
+
+message/rfc822: \
+ description=Internet Email Message;\
+ file_extensions=.mime
+
+application/xml: \
+ description=XML document;\
+ file_extensions=.xml
+
+
+
diff --git a/staging/darwin-x86/jre/lib/currency.data b/staging/darwin-x86/jre/lib/currency.data
new file mode 100644
index 0000000..fbe5e9d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/currency.data
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/cldrdata.jar b/staging/darwin-x86/jre/lib/ext/cldrdata.jar
new file mode 100644
index 0000000..636ef5d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/cldrdata.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/dnsns.jar b/staging/darwin-x86/jre/lib/ext/dnsns.jar
new file mode 100644
index 0000000..8b8a98e
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/dnsns.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/jaccess.jar b/staging/darwin-x86/jre/lib/ext/jaccess.jar
new file mode 100644
index 0000000..38003fd
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/jaccess.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/localedata.jar b/staging/darwin-x86/jre/lib/ext/localedata.jar
new file mode 100644
index 0000000..7389785
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/localedata.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/meta-index b/staging/darwin-x86/jre/lib/ext/meta-index
new file mode 100644
index 0000000..b58c2bc
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/meta-index
@@ -0,0 +1,28 @@
+% VERSION 2
+% WARNING: this file is auto-generated; do not edit
+% UNSUPPORTED: this file and its format may change and/or
+% may be removed in a future release
+! cldrdata.jar
+sun/text
+sun/util
+# dnsns.jar
+sun/net
+META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
+! jaccess.jar
+com/sun/java/accessibility/
+# localedata.jar
+sun/text
+sun/util
+# nashorn.jar
+META-INF/services/javax.script.ScriptEngineFactory
+jdk/nashorn
+jdk/internal
+! sunec.jar
+sun/security
+! sunjce_provider.jar
+com/sun/crypto/
+! sunpkcs11.jar
+sun/security
+# zipfs.jar
+META-INF/services/java.nio.file.spi.FileSystemProvider
+com/sun/nio/
diff --git a/staging/darwin-x86/jre/lib/ext/nashorn.jar b/staging/darwin-x86/jre/lib/ext/nashorn.jar
new file mode 100644
index 0000000..ed912c4
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/nashorn.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/sunec.jar b/staging/darwin-x86/jre/lib/ext/sunec.jar
new file mode 100644
index 0000000..e149042
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/sunec.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/sunjce_provider.jar b/staging/darwin-x86/jre/lib/ext/sunjce_provider.jar
new file mode 100644
index 0000000..5aa4bc4
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/sunjce_provider.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/sunpkcs11.jar b/staging/darwin-x86/jre/lib/ext/sunpkcs11.jar
new file mode 100644
index 0000000..73e5395
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/sunpkcs11.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/ext/zipfs.jar b/staging/darwin-x86/jre/lib/ext/zipfs.jar
new file mode 100644
index 0000000..553e62f
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/ext/zipfs.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/flavormap.properties b/staging/darwin-x86/jre/lib/flavormap.properties
new file mode 100644
index 0000000..dc04804
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/flavormap.properties
@@ -0,0 +1,85 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the Mac OS X platform-specific,
+# default mappings between common Mac OS X selection atoms and platform-independent
+# MIME type strings, which will be converted into
+# java.awt.datatransfer.DataFlavors.
+#
+# These default mappings may be augmented by specifying the
+#
+# AWT.DnD.flavorMapFileURL
+#
+# property in the appropriate awt.properties file. The specified properties URL
+# will be loaded into the SystemFlavorMap.
+#
+# The standard format is:
+#
+# <native>=<MIME type>
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate both native keys and DataFlavor values. If a mapping contains a
+# duplicate key or value, earlier mappings which included this key or value
+# will be preferred.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+
+# The COMPOUND_TEXT support for inter-client text transfer is disabled by
+# default. The reason is that many native applications prefer this format over
+# other native text formats, but are unable to decode the textual data in this
+# format properly. This results in java-to-native text transfer failures.
+# To enable the COMPOUND_TEXT support for this JRE installation uncomment
+# the line below.
+
+# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
+
+TEXT=text/plain;eoln="\n";terminators=0
+STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+FILE_NAME=application/x-java-file-list;class=java.util.List
+text/uri-list=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
+TIFF=image/x-java-image;class=java.awt.Image
+RICH_TEXT=text/rtf
+HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
+URL=application/x-java-url;class=java.net.URL
+FILE_NAME=text/uri-list;eoln="\r\n";terminators=1
+URL=text/uri-list;eoln="\r\n";terminators=1
+XPICT=image/x-pict;class=java.io.InputStream
diff --git a/staging/darwin-x86/jre/lib/fontconfig.bfc b/staging/darwin-x86/jre/lib/fontconfig.bfc
new file mode 100644
index 0000000..ba83d2d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fontconfig.bfc
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fontconfig.properties.src b/staging/darwin-x86/jre/lib/fontconfig.properties.src
new file mode 100644
index 0000000..7e3c2fd
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fontconfig.properties.src
@@ -0,0 +1,262 @@
+#
+# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Version
+
+version=1
+
+# Component Font Mappings
+
+allfonts.chinese-ms936=SimSun
+allfonts.chinese-gb18030=SimSun-18030
+allfonts.chinese-hkscs=MingLiU_HKSCS
+allfonts.devanagari=Mangal
+allfonts.dingbats=Wingdings
+allfonts.lucida=Lucida Sans Regular
+allfonts.symbol=Symbol
+allfonts.thai=Lucida Sans Regular
+
+serif.plain.alphabetic=Times New Roman
+serif.plain.chinese-ms950=MingLiU
+serif.plain.hebrew=David
+serif.plain.japanese=MS Mincho
+serif.plain.korean=Batang
+
+serif.bold.alphabetic=Times New Roman Bold
+serif.bold.chinese-ms950=PMingLiU
+serif.bold.hebrew=David Bold
+serif.bold.japanese=MS Mincho
+serif.bold.korean=Batang
+
+serif.italic.alphabetic=Times New Roman Italic
+serif.italic.chinese-ms950=PMingLiU
+serif.italic.hebrew=David
+serif.italic.japanese=MS Mincho
+serif.italic.korean=Batang
+
+serif.bolditalic.alphabetic=Times New Roman Bold Italic
+serif.bolditalic.chinese-ms950=PMingLiU
+serif.bolditalic.hebrew=David Bold
+serif.bolditalic.japanese=MS Mincho
+serif.bolditalic.korean=Batang
+
+sansserif.plain.alphabetic=Arial
+sansserif.plain.chinese-ms950=MingLiU
+sansserif.plain.hebrew=David
+sansserif.plain.japanese=MS Gothic
+sansserif.plain.korean=Gulim
+
+sansserif.bold.alphabetic=Arial Bold
+sansserif.bold.chinese-ms950=PMingLiU
+sansserif.bold.hebrew=David Bold
+sansserif.bold.japanese=MS Gothic
+sansserif.bold.korean=Gulim
+
+sansserif.italic.alphabetic=Arial Italic
+sansserif.italic.chinese-ms950=PMingLiU
+sansserif.italic.hebrew=David
+sansserif.italic.japanese=MS Gothic
+sansserif.italic.korean=Gulim
+
+sansserif.bolditalic.alphabetic=Arial Bold Italic
+sansserif.bolditalic.chinese-ms950=PMingLiU
+sansserif.bolditalic.hebrew=David Bold
+sansserif.bolditalic.japanese=MS Gothic
+sansserif.bolditalic.korean=Gulim
+
+monospaced.plain.alphabetic=Courier New
+monospaced.plain.chinese-ms950=MingLiU
+monospaced.plain.hebrew=David
+monospaced.plain.japanese=MS Gothic
+monospaced.plain.korean=GulimChe
+
+monospaced.bold.alphabetic=Courier New Bold
+monospaced.bold.chinese-ms950=PMingLiU
+monospaced.bold.hebrew=David Bold
+monospaced.bold.japanese=MS Gothic
+monospaced.bold.korean=GulimChe
+
+monospaced.italic.alphabetic=Courier New Italic
+monospaced.italic.chinese-ms950=PMingLiU
+monospaced.italic.hebrew=David
+monospaced.italic.japanese=MS Gothic
+monospaced.italic.korean=GulimChe
+
+monospaced.bolditalic.alphabetic=Courier New Bold Italic
+monospaced.bolditalic.chinese-ms950=PMingLiU
+monospaced.bolditalic.hebrew=David Bold
+monospaced.bolditalic.japanese=MS Gothic
+monospaced.bolditalic.korean=GulimChe
+
+dialog.plain.alphabetic=Arial
+dialog.plain.chinese-ms950=MingLiU
+dialog.plain.hebrew=David
+dialog.plain.japanese=MS Gothic
+dialog.plain.korean=Gulim
+
+dialog.bold.alphabetic=Arial Bold
+dialog.bold.chinese-ms950=PMingLiU
+dialog.bold.hebrew=David Bold
+dialog.bold.japanese=MS Gothic
+dialog.bold.korean=Gulim
+
+dialog.italic.alphabetic=Arial Italic
+dialog.italic.chinese-ms950=PMingLiU
+dialog.italic.hebrew=David
+dialog.italic.japanese=MS Gothic
+dialog.italic.korean=Gulim
+
+dialog.bolditalic.alphabetic=Arial Bold Italic
+dialog.bolditalic.chinese-ms950=PMingLiU
+dialog.bolditalic.hebrew=David Bold
+dialog.bolditalic.japanese=MS Gothic
+dialog.bolditalic.korean=Gulim
+
+dialoginput.plain.alphabetic=Courier New
+dialoginput.plain.chinese-ms950=MingLiU
+dialoginput.plain.hebrew=David
+dialoginput.plain.japanese=MS Gothic
+dialoginput.plain.korean=Gulim
+
+dialoginput.bold.alphabetic=Courier New Bold
+dialoginput.bold.chinese-ms950=PMingLiU
+dialoginput.bold.hebrew=David Bold
+dialoginput.bold.japanese=MS Gothic
+dialoginput.bold.korean=Gulim
+
+dialoginput.italic.alphabetic=Courier New Italic
+dialoginput.italic.chinese-ms950=PMingLiU
+dialoginput.italic.hebrew=David
+dialoginput.italic.japanese=MS Gothic
+dialoginput.italic.korean=Gulim
+
+dialoginput.bolditalic.alphabetic=Courier New Bold Italic
+dialoginput.bolditalic.chinese-ms950=PMingLiU
+dialoginput.bolditalic.hebrew=David Bold
+dialoginput.bolditalic.japanese=MS Gothic
+dialoginput.bolditalic.korean=Gulim
+
+# Search Sequences
+
+sequence.allfonts=alphabetic/default,dingbats,symbol
+
+sequence.serif.GBK=alphabetic,chinese-ms936,dingbats,symbol
+sequence.sansserif.GBK=alphabetic,chinese-ms936,dingbats,symbol
+sequence.monospaced.GBK=chinese-ms936,alphabetic,dingbats,symbol
+sequence.dialog.GBK=alphabetic,chinese-ms936,dingbats,symbol
+sequence.dialoginput.GBK=alphabetic,chinese-ms936,dingbats,symbol
+
+sequence.serif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol
+sequence.sansserif.GB18030=alphabetic,chinese-gb18030,dingbats,symbol
+sequence.monospaced.GB18030=chinese-gb18030,alphabetic,dingbats,symbol
+sequence.dialog.GB18030=alphabetic,chinese-gb18030,dingbats,symbol
+sequence.dialoginput.GB18030=alphabetic,chinese-gb18030,dingbats,symbol
+
+sequence.serif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol
+sequence.sansserif.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol
+sequence.monospaced.x-windows-950=chinese-ms950,alphabetic,dingbats,symbol
+sequence.dialog.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol
+sequence.dialoginput.x-windows-950=alphabetic,chinese-ms950,dingbats,symbol
+
+sequence.serif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol
+sequence.sansserif.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol
+sequence.monospaced.x-MS950-HKSCS=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol
+sequence.dialog.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol
+sequence.dialoginput.x-MS950-HKSCS=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol
+
+sequence.allfonts.UTF-8.hi=alphabetic/1252,devanagari,dingbats,symbol
+
+sequence.allfonts.windows-1255=hebrew,alphabetic/1252,dingbats,symbol
+
+sequence.serif.windows-31j=alphabetic,japanese,dingbats,symbol
+sequence.sansserif.windows-31j=alphabetic,japanese,dingbats,symbol
+sequence.monospaced.windows-31j=japanese,alphabetic,dingbats,symbol
+sequence.dialog.windows-31j=alphabetic,japanese,dingbats,symbol
+sequence.dialoginput.windows-31j=alphabetic,japanese,dingbats,symbol
+
+sequence.serif.x-windows-949=alphabetic,korean,dingbats,symbol
+sequence.sansserif.x-windows-949=alphabetic,korean,dingbats,symbol
+sequence.monospaced.x-windows-949=korean,alphabetic,dingbats,symbol
+sequence.dialog.x-windows-949=alphabetic,korean,dingbats,symbol
+sequence.dialoginput.x-windows-949=alphabetic,korean,dingbats,symbol
+
+sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol
+
+sequence.fallback=lucida,\
+ chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
+ japanese,korean
+
+# Exclusion Ranges
+
+exclusion.alphabetic=0700-1e9f,1f00-20ab,20ad-f8ff
+exclusion.chinese-gb18030=0390-03d6,2200-22ef,2701-27be
+exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac
+
+# Monospaced to Proportional width variant mapping
+# (Experimental private syntax)
+proportional.MS_Gothic=MS PGothic
+proportional.MS_Mincho=MS PMincho
+proportional.MingLiU=PMingLiU
+
+# Font File Names
+
+filename.Arial=ARIAL.TTF
+filename.Arial_Bold=ARIALBD.TTF
+filename.Arial_Italic=ARIALI.TTF
+filename.Arial_Bold_Italic=ARIALBI.TTF
+
+filename.Courier_New=COUR.TTF
+filename.Courier_New_Bold=COURBD.TTF
+filename.Courier_New_Italic=COURI.TTF
+filename.Courier_New_Bold_Italic=COURBI.TTF
+
+filename.Times_New_Roman=TIMES.TTF
+filename.Times_New_Roman_Bold=TIMESBD.TTF
+filename.Times_New_Roman_Italic=TIMESI.TTF
+filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF
+
+filename.SimSun=SIMSUN.TTC
+filename.SimSun-18030=SIMSUN18030.TTC
+
+filename.MingLiU=MINGLIU.TTC
+filename.PMingLiU=MINGLIU.TTC
+filename.MingLiU_HKSCS=hkscsm3u.ttf
+
+filename.David=DAVID.TTF
+filename.David_Bold=DAVIDBD.TTF
+
+filename.MS_Mincho=MSMINCHO.TTC
+filename.MS_PMincho=MSMINCHO.TTC
+filename.MS_Gothic=MSGOTHIC.TTC
+filename.MS_PGothic=MSGOTHIC.TTC
+
+filename.Gulim=gulim.TTC
+filename.Batang=batang.TTC
+filename.GulimChe=gulim.TTC
+
+filename.Lucida_Sans_Regular=LucidaSansRegular.ttf
+filename.Mangal=MANGAL.TTF
+filename.Symbol=SYMBOL.TTF
+filename.Wingdings=WINGDING.TTF
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSans-Bold.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSans-Bold.ttf
new file mode 100644
index 0000000..d065b64
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSans-Bold.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSans.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSans.ttf
new file mode 100644
index 0000000..ad1efca
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSans.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSansMono.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSansMono.ttf
new file mode 100644
index 0000000..a007071
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSansMono.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSansMonoDotted.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSansMonoDotted.ttf
new file mode 100644
index 0000000..e56a5ca
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSansMonoDotted.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSansMonoSlashed.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSansMonoSlashed.ttf
new file mode 100644
index 0000000..8c44b47
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSansMonoSlashed.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSerif-Bold.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSerif-Bold.ttf
new file mode 100644
index 0000000..838d255
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSerif-Bold.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttf
new file mode 100644
index 0000000..0b1601f
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSerif-Italic.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSerif-Italic.ttf
new file mode 100644
index 0000000..2972809
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSerif-Italic.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/DroidSerif-Regular.ttf b/staging/darwin-x86/jre/lib/fonts/DroidSerif-Regular.ttf
new file mode 100644
index 0000000..5b4fe81
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/DroidSerif-Regular.ttf
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/fonts/LICENSE.txt b/staging/darwin-x86/jre/lib/fonts/LICENSE.txt
new file mode 100644
index 0000000..a4a4b17
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/LICENSE.txt
@@ -0,0 +1,13 @@
+Copyright 2000-2016 JetBrains s.r.o.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/staging/darwin-x86/jre/lib/fonts/font.conf b/staging/darwin-x86/jre/lib/fonts/font.conf
new file mode 100644
index 0000000..adbc1ca
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/font.conf
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+ <match target="font">
+ <test name="family" qual="all" compare="not_eq">
+ <string>Consolas</string>
+ </test>
+ <test name="family" qual="all" compare="not_eq">
+ <string>Noto Sans Mono CJK JP</string>
+ </test>
+ <test name="size" qual="any" compare="less">
+ <double>12</double>
+ </test>
+ <test name="weight" compare="less">
+ <const>medium</const>
+ </test>
+ <edit mode="assign" name="hintstyle">
+ <const>hintfull</const>
+ </edit>
+ </match>
+</fontconfig>
+
diff --git a/staging/darwin-x86/jre/lib/fonts/fonts.dir b/staging/darwin-x86/jre/lib/fonts/fonts.dir
new file mode 100644
index 0000000..1344314
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/fonts/fonts.dir
@@ -0,0 +1,170 @@
+169
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-ascii-0
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-e
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-r
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-u
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-ascii-0
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-e
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-r
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-u
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-adobe-standard
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-ascii-0
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso10646-1
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-1
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-10
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-13
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-15
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-16
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-2
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-3
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-4
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-5
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-9
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-e
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-r
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-ru
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-u
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-uni
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-adobe-standard
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-ascii-0
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso10646-1
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-1
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-10
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-13
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-15
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-2
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-3
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-4
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-5
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-9
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-e
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-r
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-ru
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-u
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-uni
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-adobe-standard
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-ascii-0
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso10646-1
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-1
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-10
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-13
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-15
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-2
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-3
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-4
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-5
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-9
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-e
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-r
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-ru
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-u
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-uni
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
diff --git a/staging/darwin-x86/jre/lib/hijrah-config-umalqura.properties b/staging/darwin-x86/jre/lib/hijrah-config-umalqura.properties
new file mode 100644
index 0000000..1786c14
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/hijrah-config-umalqura.properties
@@ -0,0 +1,369 @@
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+# This properties file defines a Hijrah calendar variant.
+#
+# Fields:
+#
+# <version> ::= 'version' '=' <version string>
+# <id> ::= 'id' '=' <id string>
+# <type> ::= 'type' '=' <type string>
+# <iso-start> ::= 'iso-start' '=' <start date in the ISO calendar>
+# <year> ::= <yyyy> '=' <nn nn nn nn nn nn nn nn nn nn nn nn>
+#
+# version ... (Required)
+#
+# id ... (Required)
+# Identifies the Java Chronology
+#
+# type ... (Required)
+# Identifies the type of calendar in the standard calendar ID scheme
+# iso-start ... (Required)
+# Specifies the corresponding ISO date to the first Hijrah day
+# in the defined range of dates
+#
+# year ... (Required)
+# Number of days for each month of a Hijrah year
+# * Each line defines a year. The years must be in chronological
+# order and no gap is allowed.
+# * Each line is in the form indicated above. <yyyy> is a Hijrah year and
+# nn is the number of days for a month listed in the order of the months.
+# * Each year must have 12 months.
+# * Each month should be 29 or 30 days long.
+# * There must be one or more space characters between the months.
+#
+
+# Version of this definition
+version=1.8.0_1
+
+# Java chronology ID
+id=Hijrah-umalqura
+
+# Standard calendar type specification
+type=islamic-umalqura
+
+# defines the corresponding ISO date to the earliest Hijrah date
+iso-start=1882-11-12
+
+# 1 2 3 4 5 6 7 8 9 10 11 12
+1300=30 29 30 29 30 29 30 29 30 29 30 29
+1301=30 30 29 30 29 30 29 30 29 30 29 29
+1302=30 30 30 29 30 30 29 29 30 29 29 30
+1303=29 30 30 29 30 30 29 30 29 30 29 29
+1304=29 30 30 29 30 30 30 29 30 29 30 29
+1305=29 29 30 30 29 30 30 29 30 30 29 29
+1306=30 29 30 29 30 29 30 29 30 30 29 30
+1307=29 30 29 30 29 30 29 30 29 30 29 30
+1308=29 30 30 29 30 29 30 29 30 29 29 30
+1309=29 30 30 30 30 29 29 30 29 29 30 29
+1310=30 29 30 30 30 29 30 29 30 29 29 30
+1311=29 30 29 30 30 30 29 30 29 30 29 29
+1312=30 29 30 29 30 30 29 30 30 29 30 29
+1313=29 30 29 30 29 30 29 30 30 30 29 29
+1314=30 30 29 30 29 29 30 29 30 30 29 30
+1315=29 30 30 29 30 29 29 30 29 30 29 30
+1316=29 30 30 30 29 30 29 29 30 29 30 29
+1317=30 29 30 30 29 30 29 30 29 30 29 29
+1318=30 29 30 30 29 30 30 29 30 29 30 29
+1319=29 30 29 30 30 29 30 29 30 30 29 30
+1320=29 30 29 29 30 29 30 29 30 30 30 29
+1321=30 29 30 29 29 30 29 29 30 30 30 30
+1322=29 30 29 30 29 29 29 30 29 30 30 30
+1323=29 30 30 29 30 29 29 29 30 29 30 30
+1324=29 30 30 29 30 29 30 29 29 30 29 30
+1325=30 29 30 29 30 30 29 30 29 30 29 30
+1326=29 29 30 29 30 30 29 30 29 30 30 29
+1327=30 29 29 30 29 30 29 30 30 29 30 30
+1328=29 30 29 29 30 29 29 30 30 30 29 30
+1329=30 29 30 29 29 30 29 29 30 30 29 30
+1330=30 30 29 30 29 29 30 29 29 30 30 29
+1331=30 30 29 30 30 29 29 30 29 30 29 30
+1332=29 30 29 30 30 29 30 29 30 30 29 29
+1333=30 29 29 30 30 29 30 30 29 30 30 29
+1334=29 29 30 29 30 29 30 30 30 29 30 29
+1335=30 29 30 29 29 30 29 30 30 29 30 30
+1336=29 30 29 30 29 29 30 29 30 29 30 30
+1337=30 29 30 29 30 29 29 30 29 30 29 30
+1338=29 30 30 29 30 30 29 29 30 29 30 29
+1339=30 29 30 29 30 30 30 29 30 29 29 30
+1340=29 29 30 29 30 30 30 30 29 30 29 29
+1341=30 29 29 30 29 30 30 30 29 30 30 29
+1342=29 29 30 29 30 29 30 30 29 30 30 29
+1343=30 29 29 30 29 30 29 30 29 30 30 29
+1344=30 29 30 29 30 30 29 29 30 29 30 29
+1345=30 29 30 30 30 29 30 29 29 30 29 29
+1346=30 29 30 30 30 30 29 30 29 29 30 29
+1347=29 30 29 30 30 30 29 30 30 29 29 30
+1348=29 29 30 29 30 30 29 30 30 30 29 29
+1349=30 29 29 30 29 30 30 29 30 30 29 30
+1350=29 30 29 30 29 30 29 29 30 30 29 30
+1351=30 29 30 29 30 29 30 29 29 30 29 30
+1352=30 29 30 30 29 30 29 30 29 29 30 29
+1353=30 29 30 30 30 29 30 29 29 30 29 30
+1354=29 30 29 30 30 29 30 30 29 30 29 29
+1355=30 29 29 30 30 29 30 30 29 30 30 29
+1356=29 30 29 30 29 30 29 30 29 30 30 30
+1357=29 29 30 29 30 29 29 30 29 30 30 30
+1358=29 30 29 30 29 30 29 29 30 29 30 30
+1359=29 30 30 29 30 29 30 29 29 29 30 30
+1360=29 30 30 30 29 30 29 30 29 29 30 29
+1361=30 29 30 30 29 30 30 29 29 30 29 30
+1362=29 30 29 30 29 30 30 29 30 29 30 29
+1363=30 29 30 29 30 29 30 29 30 29 30 30
+1364=29 30 29 30 29 29 30 29 30 29 30 30
+1365=30 30 29 29 30 29 29 30 29 30 29 30
+1366=30 30 29 30 29 30 29 29 30 29 30 29
+1367=30 30 29 30 30 29 30 29 29 30 29 30
+1368=29 30 29 30 30 30 29 29 30 29 30 29
+1369=30 29 30 29 30 30 29 30 29 30 30 29
+1370=30 29 29 30 29 30 29 30 29 30 30 30
+1371=29 30 29 29 30 29 30 29 30 29 30 30
+1372=30 29 29 30 29 30 29 29 30 29 30 30
+1373=30 29 30 29 30 29 30 29 29 30 29 30
+1374=30 29 30 30 29 30 29 30 29 29 30 29
+1375=30 29 30 30 29 30 30 29 30 29 30 29
+1376=29 30 29 30 29 30 30 30 29 30 29 30
+1377=29 29 30 29 29 30 30 30 29 30 30 29
+1378=30 29 29 29 30 29 30 30 29 30 30 30
+1379=29 30 29 29 29 30 29 30 30 29 30 30
+1380=29 30 29 30 29 30 29 30 29 30 29 30
+1381=29 30 29 30 30 29 30 29 30 29 29 30
+1382=29 30 29 30 30 29 30 30 29 30 29 29
+1383=30 29 29 30 30 30 29 30 30 29 30 29
+1384=29 30 29 29 30 30 29 30 30 30 29 30
+1385=29 29 30 29 29 30 30 29 30 30 30 29
+1386=30 29 29 30 29 29 30 30 29 30 30 29
+1387=30 29 30 29 30 29 30 29 30 29 30 29
+1388=30 30 29 30 29 30 29 30 29 30 29 29
+1389=30 30 29 30 30 29 30 30 29 29 30 29
+1390=29 30 29 30 30 30 29 30 29 30 29 30
+1391=29 29 30 29 30 30 29 30 30 29 30 29
+1392=30 29 29 30 29 30 29 30 30 29 30 30
+1393=29 30 29 29 30 29 30 29 30 29 30 30
+1394=30 29 30 29 29 30 29 30 29 30 29 30
+1395=30 29 30 30 29 30 29 29 30 29 29 30
+1396=30 29 30 30 29 30 30 29 29 30 29 29
+1397=30 29 30 30 29 30 30 30 29 29 29 30
+1398=29 30 29 30 30 29 30 30 29 30 29 29
+1399=30 29 30 29 30 29 30 30 29 30 29 30
+1400=30 29 30 29 29 30 29 30 29 30 29 30
+1401=30 30 29 30 29 29 30 29 29 30 29 30
+1402=30 30 30 29 30 29 29 30 29 29 30 29
+1403=30 30 30 29 30 30 29 29 30 29 29 30
+1404=29 30 30 29 30 30 29 30 29 30 29 29
+1405=30 29 30 29 30 30 30 29 30 29 29 30
+1406=30 29 29 30 29 30 30 29 30 29 30 30
+1407=29 30 29 29 30 29 30 29 30 29 30 30
+1408=30 29 30 29 30 29 29 30 29 29 30 30
+1409=30 30 29 30 29 30 29 29 30 29 29 30
+1410=30 30 29 30 30 29 30 29 29 30 29 29
+1411=30 30 29 30 30 29 30 30 29 29 30 29
+1412=30 29 30 29 30 29 30 30 30 29 29 30
+1413=29 30 29 29 30 29 30 30 30 29 30 29
+1414=30 29 30 29 29 30 29 30 30 29 30 30
+1415=29 30 29 30 29 29 30 29 30 29 30 30
+1416=30 29 30 29 30 29 29 30 29 30 29 30
+1417=30 29 30 30 29 29 30 29 30 29 30 29
+1418=30 29 30 30 29 30 29 30 29 30 29 30
+1419=29 30 29 30 29 30 29 30 30 30 29 29
+1420=29 30 29 29 30 29 30 30 30 30 29 30
+1421=29 29 30 29 29 29 30 30 30 30 29 30
+1422=30 29 29 30 29 29 29 30 30 30 29 30
+1423=30 29 30 29 30 29 29 30 29 30 29 30
+1424=30 29 30 30 29 30 29 29 30 29 30 29
+1425=30 29 30 30 29 30 29 30 30 29 30 29
+1426=29 30 29 30 29 30 30 29 30 30 29 30
+1427=29 29 30 29 30 29 30 30 29 30 30 29
+1428=30 29 29 30 29 29 30 30 30 29 30 30
+1429=29 30 29 29 30 29 29 30 30 29 30 30
+1430=29 30 30 29 29 30 29 30 29 30 29 30
+1431=29 30 30 29 30 29 30 29 30 29 29 30
+1432=29 30 30 30 29 30 29 30 29 30 29 29
+1433=30 29 30 30 29 30 30 29 30 29 30 29
+1434=29 30 29 30 29 30 30 29 30 30 29 29
+1435=30 29 30 29 30 29 30 29 30 30 29 30
+1436=29 30 29 30 29 30 29 30 29 30 29 30
+1437=30 29 30 30 29 29 30 29 30 29 29 30
+1438=30 29 30 30 30 29 29 30 29 29 30 29
+1439=30 29 30 30 30 29 30 29 30 29 29 30
+1440=29 30 29 30 30 30 29 30 29 30 29 29
+1441=30 29 30 29 30 30 29 30 30 29 30 29
+1442=29 30 29 30 29 30 29 30 30 29 30 29
+1443=30 29 30 29 30 29 30 29 30 29 30 30
+1444=29 30 29 30 30 29 29 30 29 30 29 30
+1445=29 30 30 30 29 30 29 29 30 29 29 30
+1446=29 30 30 30 29 30 30 29 29 30 29 29
+1447=30 29 30 30 30 29 30 29 30 29 30 29
+1448=29 30 29 30 30 29 30 30 29 30 29 30
+1449=29 29 30 29 30 29 30 30 29 30 30 29
+1450=30 29 30 29 29 30 29 30 29 30 30 29
+1451=30 30 30 29 29 30 29 29 30 30 29 30
+1452=30 29 30 30 29 29 30 29 29 30 29 30
+1453=30 29 30 30 29 30 29 30 29 29 30 29
+1454=30 29 30 30 29 30 30 29 30 29 30 29
+1455=29 30 29 30 30 29 30 29 30 30 29 30
+1456=29 29 30 29 30 29 30 29 30 30 30 29
+1457=30 29 29 30 29 29 30 29 30 30 30 30
+1458=29 30 29 29 30 29 29 30 29 30 30 30
+1459=29 30 30 29 29 30 29 29 30 29 30 30
+1460=29 30 30 29 30 29 30 29 29 30 29 30
+1461=29 30 30 29 30 29 30 29 30 30 29 29
+1462=30 29 30 29 30 30 29 30 29 30 30 29
+1463=29 30 29 30 29 30 29 30 30 30 29 30
+1464=29 30 29 29 30 29 29 30 30 30 29 30
+1465=30 29 30 29 29 30 29 29 30 30 29 30
+1466=30 30 29 30 29 29 29 30 29 30 30 29
+1467=30 30 29 30 30 29 29 30 29 30 29 30
+1468=29 30 29 30 30 29 30 29 30 29 30 29
+1469=29 30 29 30 30 29 30 30 29 30 29 30
+1470=29 29 30 29 30 30 29 30 30 29 30 29
+1471=30 29 29 30 29 30 29 30 30 29 30 30
+1472=29 30 29 29 30 29 30 29 30 30 29 30
+1473=29 30 29 30 30 29 29 30 29 30 29 30
+1474=29 30 30 29 30 30 29 29 30 29 30 29
+1475=29 30 30 29 30 30 30 29 29 30 29 29
+1476=30 29 30 29 30 30 30 29 30 29 30 29
+1477=29 30 29 29 30 30 30 30 29 30 29 30
+1478=29 29 30 29 30 29 30 30 29 30 30 29
+1479=30 29 29 30 29 30 29 30 29 30 30 29
+1480=30 29 30 29 30 29 30 29 30 29 30 29
+1481=30 29 30 30 29 30 29 30 29 30 29 29
+1482=30 29 30 30 30 30 29 30 29 29 30 29
+1483=29 30 29 30 30 30 29 30 30 29 29 30
+1484=29 29 30 29 30 30 30 29 30 29 30 29
+1485=30 29 29 30 29 30 30 29 30 30 29 30
+1486=29 30 29 29 30 29 30 29 30 30 29 30
+1487=30 29 30 29 30 29 29 30 29 30 29 30
+1488=30 29 30 30 29 30 29 29 30 29 30 29
+1489=30 29 30 30 30 29 30 29 29 30 29 30
+1490=29 30 29 30 30 29 30 30 29 29 30 29
+1491=30 29 29 30 30 29 30 30 29 30 29 30
+1492=29 30 29 29 30 30 29 30 29 30 30 29
+1493=30 29 30 29 30 29 29 30 29 30 30 30
+1494=29 30 29 30 29 30 29 29 29 30 30 30
+1495=29 30 30 29 30 29 29 30 29 29 30 30
+1496=29 30 30 30 29 30 29 29 30 29 29 30
+1497=30 29 30 30 29 30 29 30 29 30 29 30
+1498=29 30 29 30 29 30 30 29 30 29 30 29
+1499=30 29 30 29 29 30 30 29 30 29 30 30
+1500=29 30 29 30 29 29 30 29 30 29 30 30
+1501=30 29 30 29 30 29 29 29 30 29 30 30
+1502=30 30 29 30 29 30 29 29 29 30 30 29
+1503=30 30 29 30 30 29 30 29 29 29 30 30
+1504=29 30 29 30 30 30 29 29 30 29 30 29
+1505=30 29 30 29 30 30 29 30 29 30 30 29
+1506=29 30 29 29 30 30 29 30 30 29 30 30
+1507=29 29 30 29 29 30 30 29 30 29 30 30
+1508=30 29 29 30 29 30 29 29 30 29 30 30
+1509=30 29 30 29 30 29 30 29 29 30 29 30
+1510=30 29 30 30 29 30 29 30 29 29 30 29
+1511=30 29 30 30 29 30 30 29 30 29 29 30
+1512=29 30 29 30 29 30 30 30 29 30 29 30
+1513=29 29 29 30 29 30 30 30 29 30 30 29
+1514=30 29 29 29 30 29 30 30 29 30 30 30
+1515=29 29 30 29 29 30 29 30 30 29 30 30
+1516=29 30 29 30 29 29 30 29 30 29 30 30
+1517=29 30 29 30 29 30 30 29 29 30 29 30
+1518=29 30 29 30 30 29 30 30 29 30 29 29
+1519=30 29 29 30 30 30 29 30 30 29 30 29
+1520=29 30 29 29 30 30 30 29 30 30 29 30
+1521=29 29 29 30 29 30 30 29 30 30 29 30
+1522=30 29 29 29 30 29 30 30 29 30 30 29
+1523=30 29 30 29 30 29 30 29 29 30 30 29
+1524=30 30 29 30 29 30 29 30 29 29 30 29
+1525=30 30 29 30 30 29 30 29 30 29 29 30
+1526=29 30 29 30 30 30 29 30 29 30 29 29
+1527=30 29 30 29 30 30 29 30 30 29 30 29
+1528=30 29 29 30 29 30 29 30 30 29 30 30
+1529=29 30 29 29 30 29 30 29 30 29 30 30
+1530=29 30 30 29 29 30 29 30 29 29 30 30
+1531=29 30 30 30 29 29 30 29 30 29 29 30
+1532=29 30 30 30 29 30 30 29 29 29 30 29
+1533=30 29 30 30 30 29 30 29 30 29 29 30
+1534=29 30 29 30 30 29 30 30 29 29 30 29
+1535=30 29 30 29 30 29 30 30 29 30 29 30
+1536=29 30 29 30 29 30 29 30 29 30 29 30
+1537=30 29 30 30 29 29 30 29 29 30 29 30
+1538=30 30 29 30 30 29 29 30 29 29 30 29
+1539=30 30 30 29 30 30 29 29 30 29 29 30
+1540=29 30 30 29 30 30 29 30 29 29 30 29
+1541=30 29 30 29 30 30 30 29 30 29 29 30
+1542=29 30 29 30 29 30 30 29 30 29 30 30
+1543=29 30 29 29 30 29 30 29 30 29 30 30
+1544=30 29 30 29 29 30 29 30 29 30 29 30
+1545=30 30 29 30 29 29 30 29 30 29 29 30
+1546=30 30 29 30 29 30 29 30 29 30 29 29
+1547=30 30 29 30 30 29 30 29 30 29 30 29
+1548=30 29 29 30 30 29 30 30 29 30 29 30
+1549=29 30 29 29 30 29 30 30 30 29 30 29
+1550=30 29 30 29 29 29 30 30 30 29 30 30
+1551=29 30 29 29 30 29 29 30 30 29 30 30
+1552=30 29 30 29 29 30 29 29 30 30 29 30
+1553=30 29 30 29 30 29 30 29 30 29 30 29
+1554=30 29 30 29 30 30 29 30 29 30 29 30
+1555=29 29 30 29 30 30 29 30 30 29 30 29
+1556=30 29 29 30 29 30 29 30 30 30 29 30
+1557=29 30 29 29 29 30 29 30 30 30 30 29
+1558=30 29 30 29 29 29 30 29 30 30 30 29
+1559=30 30 29 29 30 29 29 30 30 29 30 29
+1560=30 30 29 30 29 30 29 30 29 30 29 30
+1561=29 30 30 29 30 29 30 30 29 29 30 29
+1562=29 30 30 29 30 29 30 30 30 29 29 30
+1563=29 30 29 29 30 29 30 30 30 29 30 29
+1564=30 29 30 29 29 30 29 30 30 30 29 30
+1565=29 30 29 30 29 29 30 29 30 30 29 30
+1566=30 29 30 29 30 29 29 30 29 30 29 30
+1567=30 29 30 30 29 30 29 30 29 29 30 29
+1568=30 29 30 30 30 29 30 29 30 29 29 29
+1569=30 29 30 30 30 29 30 30 29 30 29 29
+1570=29 30 29 30 30 29 30 30 30 29 29 30
+1571=29 29 30 29 30 30 29 30 30 29 30 29
+1572=30 29 29 30 29 30 29 30 30 29 30 29
+1573=30 29 30 30 29 30 29 29 30 29 30 29
+1574=30 30 29 30 30 29 30 29 29 30 29 29
+1575=30 30 30 29 30 30 29 30 29 29 29 30
+1576=29 30 30 29 30 30 30 29 30 29 29 29
+1577=30 29 30 30 29 30 30 29 30 29 30 29
+1578=29 30 29 30 29 30 30 29 30 30 29 30
+1579=29 30 29 30 29 29 30 30 29 30 29 30
+1580=29 30 30 29 30 29 29 30 29 30 29 30
+1581=30 30 29 30 29 30 29 29 30 29 30 29
+1582=30 30 29 30 30 29 30 29 30 29 29 29
+1583=30 30 29 30 30 30 29 30 29 30 29 29
+1584=29 30 30 29 30 30 29 30 30 29 30 29
+1585=29 30 29 30 29 30 29 30 30 29 30 30
+1586=29 29 30 29 30 29 29 30 30 30 29 30
+1587=29 30 30 29 29 29 30 29 30 29 30 30
+1588=30 29 30 30 29 29 29 30 29 30 29 30
+1589=30 29 30 30 29 30 29 29 30 29 30 29
+1590=30 29 30 30 30 29 29 30 29 30 29 30
+1591=29 30 29 30 30 29 30 29 30 29 30 29
+1592=30 29 30 29 30 29 30 29 30 30 30 29
+1593=30 29 29 30 29 29 30 29 30 30 30 29
+1594=30 30 29 29 30 29 29 29 30 30 30 30
+1595=29 30 29 30 29 29 30 29 29 30 30 30
+1596=29 30 30 29 30 29 29 30 29 30 29 30
+1597=29 30 30 29 30 29 30 29 30 29 30 29
+1598=30 29 30 29 30 30 29 30 29 30 30 29
+1599=29 30 29 30 29 30 29 30 30 30 29 30
+1600=29 29 30 29 30 29 29 30 30 30 29 30
diff --git a/staging/darwin-x86/jre/lib/images/cursors/cursors.properties b/staging/darwin-x86/jre/lib/images/cursors/cursors.properties
new file mode 100644
index 0000000..30e9f90
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/cursors.properties
@@ -0,0 +1,40 @@
+#
+#
+# Cursors Properties file
+#
+# Names GIF89 sources for Custom Cursors and their associated HotSpots
+#
+# Note: the syntax of the property name is significant and is parsed
+# by java.awt.Cursor
+#
+# The syntax is: Cursor.<name>.<geom>.File=<filename>
+# Cursor.<name>.<geom>.HotSpot=<x>,<y>
+# Cursor.<name>.<geom>.Name=<localized name>
+#
+Cursor.CopyDrop.32x32.File=motif_CopyDrop32x32.gif
+Cursor.CopyDrop.32x32.HotSpot=0,0
+Cursor.CopyDrop.32x32.Name=CopyDrop32x32
+#
+Cursor.MoveDrop.32x32.File=motif_MoveDrop32x32.gif
+Cursor.MoveDrop.32x32.HotSpot=0,0
+Cursor.MoveDrop.32x32.Name=MoveDrop32x32
+#
+Cursor.LinkDrop.32x32.File=motif_LinkDrop32x32.gif
+Cursor.LinkDrop.32x32.HotSpot=0,0
+Cursor.LinkDrop.32x32.Name=LinkDrop32x32
+#
+Cursor.CopyNoDrop.32x32.File=motif_CopyNoDrop32x32.gif
+Cursor.CopyNoDrop.32x32.HotSpot=6,2
+Cursor.CopyNoDrop.32x32.Name=CopyNoDrop32x32
+#
+Cursor.MoveNoDrop.32x32.File=motif_MoveNoDrop32x32.gif
+Cursor.MoveNoDrop.32x32.HotSpot=6,2
+Cursor.MoveNoDrop.32x32.Name=MoveNoDrop32x32
+#
+Cursor.LinkNoDrop.32x32.File=motif_LinkNoDrop32x32.gif
+Cursor.LinkNoDrop.32x32.HotSpot=6,2
+Cursor.LinkNoDrop.32x32.Name=LinkNoDrop32x32
+#
+Cursor.Invalid.32x32.File=invalid32x32.gif
+Cursor.Invalid.32x32.HotSpot=6,2
+Cursor.Invalid.32x32.Name=Invalid32x32
diff --git a/staging/darwin-x86/jre/lib/images/cursors/invalid32x32.gif b/staging/darwin-x86/jre/lib/images/cursors/invalid32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/invalid32x32.gif
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gif b/staging/darwin-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gif
new file mode 100644
index 0000000..a9ec247
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gif
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gif b/staging/darwin-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gif
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gif b/staging/darwin-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gif
new file mode 100644
index 0000000..10c84c1
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gif
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gif b/staging/darwin-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gif
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gif b/staging/darwin-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gif
new file mode 100644
index 0000000..8304aa0
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gif
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gif b/staging/darwin-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gif
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/jce.jar b/staging/darwin-x86/jre/lib/jce.jar
new file mode 100644
index 0000000..16eb259
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/jce.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/jli/libjli.dylib b/staging/darwin-x86/jre/lib/jli/libjli.dylib
new file mode 100755
index 0000000..9c4e007
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/jli/libjli.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/jspawnhelper b/staging/darwin-x86/jre/lib/jspawnhelper
new file mode 100755
index 0000000..bc53767
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/jspawnhelper
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/jsse.jar b/staging/darwin-x86/jre/lib/jsse.jar
new file mode 100644
index 0000000..eb0a1b8
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/jsse.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/jvm.cfg b/staging/darwin-x86/jre/lib/jvm.cfg
new file mode 100644
index 0000000..2502d2b
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/jvm.cfg
@@ -0,0 +1,34 @@
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-server KNOWN
+-client IGNORE
diff --git a/staging/darwin-x86/jre/lib/jvm.hprof.txt b/staging/darwin-x86/jre/lib/jvm.hprof.txt
new file mode 100644
index 0000000..3c8e5fc
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/jvm.hprof.txt
@@ -0,0 +1,86 @@
+Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS 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.
+
+
+Header for -agentlib:hprof (or -Xrunhprof) ASCII Output (JDK 5.0 JVMTI based)
+
+WARNING! This file format is under development, and is subject to
+change without notice.
+
+This file contains the following types of records:
+
+THREAD START
+THREAD END mark the lifetime of Java threads
+
+TRACE represents a Java stack trace. Each trace consists
+ of a series of stack frames. Other records refer to
+ TRACEs to identify (1) where object allocations have
+ taken place, (2) the frames in which GC roots were
+ found, and (3) frequently executed methods.
+
+HEAP DUMP is a complete snapshot of all live objects in the Java
+ heap. Following distinctions are made:
+
+ ROOT root set as determined by GC
+ CLS classes
+ OBJ instances
+ ARR arrays
+
+SITES is a sorted list of allocation sites. This identifies
+ the most heavily allocated object types, and the TRACE
+ at which those allocations occurred.
+
+CPU SAMPLES is a statistical profile of program execution. The VM
+ periodically samples all running threads, and assigns
+ a quantum to active TRACEs in those threads. Entries
+ in this record are TRACEs ranked by the percentage of
+ total quanta they consumed; top-ranked TRACEs are
+ typically hot spots in the program.
+
+CPU TIME is a profile of program execution obtained by measuring
+ the time spent in individual methods (excluding the time
+ spent in callees), as well as by counting the number of
+ times each method is called. Entries in this record are
+ TRACEs ranked by the percentage of total CPU time. The
+ "count" field indicates the number of times each TRACE
+ is invoked.
+
+MONITOR TIME is a profile of monitor contention obtained by measuring
+ the time spent by a thread waiting to enter a monitor.
+ Entries in this record are TRACEs ranked by the percentage
+ of total monitor contention time and a brief description
+ of the monitor. The "count" field indicates the number of
+ times the monitor was contended at that TRACE.
+
+MONITOR DUMP is a complete snapshot of all the monitors and threads in
+ the System.
+
+HEAP DUMP, SITES, CPU SAMPLES|TIME and MONITOR DUMP|TIME records are generated
+at program exit. They can also be obtained during program execution by typing
+Ctrl-\ (on Solaris) or by typing Ctrl-Break (on Win32).
diff --git a/staging/darwin-x86/jre/lib/libAppleScriptEngine.dylib b/staging/darwin-x86/jre/lib/libAppleScriptEngine.dylib
new file mode 100755
index 0000000..600c948
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libAppleScriptEngine.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libattach.dylib b/staging/darwin-x86/jre/lib/libattach.dylib
new file mode 100755
index 0000000..45fa97a
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libattach.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libawt.dylib b/staging/darwin-x86/jre/lib/libawt.dylib
new file mode 100755
index 0000000..2b28a0d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libawt.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libawt_lwawt.dylib b/staging/darwin-x86/jre/lib/libawt_lwawt.dylib
new file mode 100755
index 0000000..a56c6e6
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libawt_lwawt.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libdt_socket.dylib b/staging/darwin-x86/jre/lib/libdt_socket.dylib
new file mode 100755
index 0000000..9c01176
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libdt_socket.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libfontmanager.dylib b/staging/darwin-x86/jre/lib/libfontmanager.dylib
new file mode 100755
index 0000000..707aacf
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libfontmanager.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libfreetype.dylib.6 b/staging/darwin-x86/jre/lib/libfreetype.dylib.6
new file mode 100755
index 0000000..990c2ba
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libfreetype.dylib.6
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libhprof.dylib b/staging/darwin-x86/jre/lib/libhprof.dylib
new file mode 100755
index 0000000..ccee50a
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libhprof.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libinstrument.dylib b/staging/darwin-x86/jre/lib/libinstrument.dylib
new file mode 100755
index 0000000..87e5eda
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libinstrument.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libj2gss.dylib b/staging/darwin-x86/jre/lib/libj2gss.dylib
new file mode 100755
index 0000000..fcffdde
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libj2gss.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libj2pcsc.dylib b/staging/darwin-x86/jre/lib/libj2pcsc.dylib
new file mode 100755
index 0000000..856ecfc
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libj2pcsc.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libj2pkcs11.dylib b/staging/darwin-x86/jre/lib/libj2pkcs11.dylib
new file mode 100755
index 0000000..f7d5251
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libj2pkcs11.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjaas_unix.dylib b/staging/darwin-x86/jre/lib/libjaas_unix.dylib
new file mode 100755
index 0000000..d17f676
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjaas_unix.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjava.dylib b/staging/darwin-x86/jre/lib/libjava.dylib
new file mode 100755
index 0000000..b32cdff
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjava.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjava_crw_demo.dylib b/staging/darwin-x86/jre/lib/libjava_crw_demo.dylib
new file mode 100755
index 0000000..ac4ea80
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjava_crw_demo.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjawt.dylib b/staging/darwin-x86/jre/lib/libjawt.dylib
new file mode 100755
index 0000000..6aeb3fe
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjawt.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjdwp.dylib b/staging/darwin-x86/jre/lib/libjdwp.dylib
new file mode 100755
index 0000000..24ccd78
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjdwp.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjpeg.dylib b/staging/darwin-x86/jre/lib/libjpeg.dylib
new file mode 100755
index 0000000..fb53c86
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjpeg.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjsdt.dylib b/staging/darwin-x86/jre/lib/libjsdt.dylib
new file mode 100755
index 0000000..6db259c
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjsdt.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjsig.dylib b/staging/darwin-x86/jre/lib/libjsig.dylib
new file mode 100755
index 0000000..4e3633c
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjsig.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libjsound.dylib b/staging/darwin-x86/jre/lib/libjsound.dylib
new file mode 100755
index 0000000..2bdae90
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libjsound.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/liblcms.dylib b/staging/darwin-x86/jre/lib/liblcms.dylib
new file mode 100755
index 0000000..31fcea0
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/liblcms.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libmanagement.dylib b/staging/darwin-x86/jre/lib/libmanagement.dylib
new file mode 100755
index 0000000..6516eb7
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libmanagement.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libmlib_image.dylib b/staging/darwin-x86/jre/lib/libmlib_image.dylib
new file mode 100755
index 0000000..1a3e352
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libmlib_image.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libnet.dylib b/staging/darwin-x86/jre/lib/libnet.dylib
new file mode 100755
index 0000000..6649bdb
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libnet.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libnio.dylib b/staging/darwin-x86/jre/lib/libnio.dylib
new file mode 100755
index 0000000..9dd100a
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libnio.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libnpt.dylib b/staging/darwin-x86/jre/lib/libnpt.dylib
new file mode 100755
index 0000000..5b05a4a
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libnpt.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libosx.dylib b/staging/darwin-x86/jre/lib/libosx.dylib
new file mode 100755
index 0000000..1662548
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libosx.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libosxapp.dylib b/staging/darwin-x86/jre/lib/libosxapp.dylib
new file mode 100755
index 0000000..d177f70
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libosxapp.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libosxkrb5.dylib b/staging/darwin-x86/jre/lib/libosxkrb5.dylib
new file mode 100755
index 0000000..04f22fb
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libosxkrb5.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libosxui.dylib b/staging/darwin-x86/jre/lib/libosxui.dylib
new file mode 100755
index 0000000..332a3d2
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libosxui.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libsaproc.dylib b/staging/darwin-x86/jre/lib/libsaproc.dylib
new file mode 100755
index 0000000..d86203e
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libsaproc.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libsplashscreen.dylib b/staging/darwin-x86/jre/lib/libsplashscreen.dylib
new file mode 100755
index 0000000..3994d09
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libsplashscreen.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libsunec.dylib b/staging/darwin-x86/jre/lib/libsunec.dylib
new file mode 100755
index 0000000..16a9a6e
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libsunec.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libunpack.dylib b/staging/darwin-x86/jre/lib/libunpack.dylib
new file mode 100755
index 0000000..06d4523
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libunpack.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libverify.dylib b/staging/darwin-x86/jre/lib/libverify.dylib
new file mode 100755
index 0000000..ddc4e10
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libverify.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/libzip.dylib b/staging/darwin-x86/jre/lib/libzip.dylib
new file mode 100755
index 0000000..1b0e053
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/libzip.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/logging.properties b/staging/darwin-x86/jre/lib/logging.properties
new file mode 100644
index 0000000..65cf1b1
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/logging.properties
@@ -0,0 +1,59 @@
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to INFO and above.
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# Example to customize the SimpleFormatter output format
+# to print one-line log message like this:
+# <level>: <log message> [<date/time>]
+#
+# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+com.xyz.foo.level = SEVERE
diff --git a/staging/darwin-x86/jre/lib/management-agent.jar b/staging/darwin-x86/jre/lib/management-agent.jar
new file mode 100644
index 0000000..a7ed334
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/management-agent.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/management/jmxremote.access b/staging/darwin-x86/jre/lib/management/jmxremote.access
new file mode 100644
index 0000000..ce80b47
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/management/jmxremote.access
@@ -0,0 +1,79 @@
+######################################################################
+# Default Access Control File for Remote JMX(TM) Monitoring
+######################################################################
+#
+# Access control file for Remote JMX API access to monitoring.
+# This file defines the allowed access for different roles. The
+# password file (jmxremote.password by default) defines the roles and their
+# passwords. To be functional, a role must have an entry in
+# both the password and the access files.
+#
+# The default location of this file is $JRE/lib/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# (See that file for details)
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# A typical access file has multiple lines, where each line is blank,
+# a comment (like this one), or an access control entry.
+#
+# An access control entry consists of a role name, and an
+# associated access level. The role name is any string that does not
+# itself contain spaces or tabs. It corresponds to an entry in the
+# password file (jmxremote.password). The access level is one of the
+# following:
+# "readonly" grants access to read attributes of MBeans.
+# For monitoring, this means that a remote client in this
+# role can read measurements but cannot perform any action
+# that changes the environment of the running program.
+# "readwrite" grants access to read and write attributes of MBeans,
+# to invoke operations on them, and optionally
+# to create or remove them. This access should be granted
+# only to trusted clients, since they can potentially
+# interfere with the smooth operation of a running program.
+#
+# The "readwrite" access level can optionally be followed by the "create" and/or
+# "unregister" keywords. The "unregister" keyword grants access to unregister
+# (delete) MBeans. The "create" keyword grants access to create MBeans of a
+# particular class or of any class matching a particular pattern. Access
+# should only be granted to create MBeans of known and trusted classes.
+#
+# For example, the following entry would grant readwrite access
+# to "controlRole", as well as access to create MBeans of the class
+# javax.management.monitor.CounterMonitor and to unregister any MBean:
+# controlRole readwrite \
+# create javax.management.monitor.CounterMonitorMBean \
+# unregister
+# or equivalently:
+# controlRole readwrite unregister create javax.management.monitor.CounterMBean
+#
+# The following entry would grant readwrite access as well as access to create
+# MBeans of any class in the packages javax.management.monitor and
+# javax.management.timer:
+# controlRole readwrite \
+# create javax.management.monitor.*,javax.management.timer.* \
+# unregister
+#
+# The \ character is defined in the Properties file syntax to allow continuation
+# lines as shown here. A * in a class pattern matches a sequence of characters
+# other than dot (.), so javax.management.monitor.* matches
+# javax.management.monitor.CounterMonitor but not
+# javax.management.monitor.foo.Bar.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last
+# access entry is used.
+#
+#
+# Default access control entries:
+# o The "monitorRole" role has readonly access.
+# o The "controlRole" role has readwrite access and can create the standard
+# Timer and Monitor MBeans defined by the JMX API.
+
+monitorRole readonly
+controlRole readwrite \
+ create javax.management.monitor.*,javax.management.timer.* \
+ unregister
diff --git a/staging/darwin-x86/jre/lib/management/jmxremote.password.template b/staging/darwin-x86/jre/lib/management/jmxremote.password.template
new file mode 100644
index 0000000..a7e7daa
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/management/jmxremote.password.template
@@ -0,0 +1,64 @@
+# ----------------------------------------------------------------------
+# Template for jmxremote.password
+#
+# o Copy this template to jmxremote.password
+# o Set the user/password entries in jmxremote.password
+# o Change the permission of jmxremote.password to read-only
+# by the owner.
+#
+# See below for the location of jmxremote.password file.
+# ----------------------------------------------------------------------
+
+##############################################################
+# Password File for Remote JMX Monitoring
+##############################################################
+#
+# Password file for Remote JMX API access to monitoring. This
+# file defines the different roles and their passwords. The access
+# control file (jmxremote.access by default) defines the allowed
+# access for each role. To be functional, a role must have an entry
+# in both the password and the access files.
+#
+# Default location of this file is $JRE/lib/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# or by specifying a system property (See that file for details).
+
+
+##############################################################
+# File permissions of the jmxremote.password file
+##############################################################
+# Since there are cleartext passwords stored in this file,
+# this file must be readable by ONLY the owner,
+# otherwise the program will exit with an error.
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# Typical password file has multiple lines, where each line is blank,
+# a comment (like this one), or a password entry.
+#
+#
+# A password entry consists of a role name and an associated
+# password. The role name is any string that does not itself contain
+# spaces or tabs. The password is again any string that does not
+# contain spaces or tabs. Note that passwords appear in the clear in
+# this file, so it is a good idea not to use valuable passwords.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last one
+# is used.
+#
+# In a typical installation, this file can be read by anybody on the
+# local machine, and possibly by people on other machines.
+# For # security, you should either restrict the access to this file,
+# or specify another, less accessible file in the management config file
+# as described above.
+#
+# Following are two commented-out entries. The "measureRole" role has
+# password "QED". The "controlRole" role has password "R&D".
+#
+# monitorRole QED
+# controlRole R&D
+
diff --git a/staging/darwin-x86/jre/lib/management/management.properties b/staging/darwin-x86/jre/lib/management/management.properties
new file mode 100644
index 0000000..70efa2e
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/management/management.properties
@@ -0,0 +1,331 @@
+#####################################################################
+# Default Configuration File for Java Platform Management
+#####################################################################
+#
+# The Management Configuration file (in java.util.Properties format)
+# will be read if one of the following system properties is set:
+# -Dcom.sun.management.jmxremote.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.config.file=<this-file>
+#
+# The default Management Configuration file is:
+#
+# $JRE/lib/management/management.properties
+#
+# Another location for the Management Configuration File can be specified
+# by the following property on the Java command line:
+#
+# -Dcom.sun.management.config.file=<this-file>
+#
+# If -Dcom.sun.management.config.file=<this-file> is set, the port
+# number for the management agent can be specified in the config file
+# using the following lines:
+#
+# ################ Management Agent Port #########################
+#
+# For setting the JMX RMI agent port use the following line
+# com.sun.management.jmxremote.port=<port-number>
+#
+# For setting the SNMP agent port use the following line
+# com.sun.management.snmp.port=<port-number>
+
+#####################################################################
+# Optional Instrumentation
+#####################################################################
+#
+# By default only the basic instrumentation with low overhead is on.
+# The following properties allow to selectively turn on optional
+# instrumentation which are off by default and may have some
+# additional overhead.
+#
+# com.sun.management.enableThreadContentionMonitoring
+#
+# This option enables thread contention monitoring if the
+# Java virtual machine supports such instrumentation.
+# Refer to the specification for the java.lang.management.ThreadMBean
+# interface - see isThreadContentionMonitoringSupported() method.
+#
+
+# To enable thread contention monitoring, uncomment the following line
+# com.sun.management.enableThreadContentionMonitoring
+
+#####################################################################
+# SNMP Management Properties
+#####################################################################
+#
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# is set then
+# - The SNMP agent (with the Java virtual machine MIB) is started
+# that listens on the specified port for incoming SNMP requests.
+# - the following properties for read for SNMP management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to the above system property (e.g. via setProperty method), this
+# config file, or the ACL file has no effect to the running SNMP agent.
+#
+
+#
+# ##################### SNMP Trap Port #########################
+#
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+# Specifies the remote port number at which managers are expected
+# to listen for trap. For each host defined in the ACL file,
+# the SNMP agent will send traps at <host>:<trap-destination-port-number>
+# Default for this property is 162.
+#
+
+# To set port for sending traps to a different port use the following line
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+
+#
+# ################ SNMP listen interface #########################
+#
+# com.sun.management.snmp.interface=<InetAddress>
+# Specifies the local interface on which the SNMP agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+# Default for this property is "localhost".
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
+
+# For restricting the port on which SNMP agent listens use the following line
+# com.sun.management.snmp.interface=<InetAddress>
+
+#
+# #################### SNMP ACL file #########################
+#
+# com.sun.management.snmp.acl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then the ACL file
+# is not checked: all manager hosts are allowed all access.
+#
+
+# For SNMP without checking ACL file uncomment the following line
+# com.sun.management.snmp.acl=false
+
+#
+# com.sun.management.snmp.acl.file=filepath
+# Specifies location for ACL file
+# This is optional - default location is
+# $JRE/lib/management/snmp.acl
+#
+# If the property "com.sun.management.snmp.acl" is set to false,
+# then this property and the ACL file are ignored.
+# Otherwise the ACL file must exist and be in the valid format.
+# If the ACL file is empty or non existent then no access is allowed.
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
+# agents which read that ACL file at startup.
+#
+
+# For a non-default acl file location use the following line
+# com.sun.management.snmp.acl.file=filepath
+
+#####################################################################
+# RMI Management Properties
+#####################################################################
+#
+# If system property -Dcom.sun.management.jmxremote.port=<port-number>
+# is set then
+# - A MBean server is started
+# - JRE Platform MBeans are registered in the MBean server
+# - RMI connector is published in a private readonly registry at
+# specified port using a well known name, "jmxrmi"
+# - the following properties are read for JMX remote management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to above system property (e.g. via setProperty method),
+# this config file, the password file, or the access file have no effect to the
+# running MBean server, the connector, or the registry.
+#
+
+#
+# ########## RMI connector settings for local management ##########
+#
+# com.sun.management.jmxremote.local.only=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as true then the local JMX RMI connector
+# server will only accept connection requests from clients running on
+# the host where the out-of-the-box JMX management agent is running.
+# In order to ensure backwards compatibility this property could be
+# set to false. However, deploying the local management agent in this
+# way is discouraged because the local JMX RMI connector server will
+# accept connection requests from any client either local or remote.
+# For remote management the remote JMX RMI connector server should
+# be used instead with authentication and SSL/TLS encryption enabled.
+#
+
+# For allowing the local management agent accept local
+# and remote connection requests use the following line
+# com.sun.management.jmxremote.local.only=false
+
+#
+# ###################### RMI SSL #############################
+#
+# com.sun.management.jmxremote.ssl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then SSL is not used.
+#
+
+# For RMI monitoring without SSL use the following line
+# com.sun.management.jmxremote.ssl=false
+
+# com.sun.management.jmxremote.ssl.config.file=filepath
+# Specifies the location of the SSL configuration file. A properties
+# file can be used to supply the keystore and truststore location and
+# password settings thus avoiding to pass them as cleartext in the
+# command-line.
+#
+# The current implementation of the out-of-the-box management agent will
+# look up and use the properties specified below to configure the SSL
+# keystore and truststore, if present:
+# javax.net.ssl.keyStore=<keystore-location>
+# javax.net.ssl.keyStorePassword=<keystore-password>
+# javax.net.ssl.trustStore=<truststore-location>
+# javax.net.ssl.trustStorePassword=<truststore-password>
+# Any other properties in the file will be ignored. This will allow us
+# to extend the property set in the future if required by the default
+# SSL implementation.
+#
+# If the property "com.sun.management.jmxremote.ssl" is set to false,
+# then this property is ignored.
+#
+
+# For supplying the keystore settings in a file use the following line
+# com.sun.management.jmxremote.ssl.config.file=filepath
+
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites=<cipher-suites>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS cipher suites to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS cipher suites are enabled
+# for use by accepted connections. If this property is not specified then
+# the SSL/TLS RMI Server Socket Factory uses the SSL/TLS cipher suites that
+# are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.enabled.protocols=<protocol-versions>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS protocol versions to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS protocol versions are
+# enabled for use by accepted connections. If this property is not
+# specified then the SSL/TLS RMI Server Socket Factory uses the SSL/TLS
+# protocol versions that are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.need.client.auth=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true in conjunction with the previous
+# property "com.sun.management.jmxremote.ssl" then the SSL/TLS RMI Server
+# Socket Factory will require client authentication.
+#
+
+# For RMI monitoring with SSL client authentication use the following line
+# com.sun.management.jmxremote.ssl.need.client.auth=true
+
+# com.sun.management.jmxremote.registry.ssl=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true then the RMI registry used
+# to bind the RMIServer remote object is protected with SSL/TLS
+# RMI Socket Factories that can be configured with the properties:
+# com.sun.management.jmxremote.ssl.config.file
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites
+# com.sun.management.jmxremote.ssl.enabled.protocols
+# com.sun.management.jmxremote.ssl.need.client.auth
+# If the two properties below are true at the same time, i.e.
+# com.sun.management.jmxremote.ssl=true
+# com.sun.management.jmxremote.registry.ssl=true
+# then the RMIServer remote object and the RMI registry are
+# both exported with the same SSL/TLS RMI Socket Factories.
+#
+
+# For using an SSL/TLS protected RMI registry use the following line
+# com.sun.management.jmxremote.registry.ssl=true
+
+#
+# ################ RMI User authentication ################
+#
+# com.sun.management.jmxremote.authenticate=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then no authentication is
+# performed and all users are allowed all access.
+#
+
+# For RMI monitoring without any checking use the following line
+# com.sun.management.jmxremote.authenticate=false
+
+#
+# ################ RMI Login configuration ###################
+#
+# com.sun.management.jmxremote.login.config=<config-name>
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
+#
+# Setting this property is optional - the default login configuration
+# specifies a file-based authentication that uses the password file.
+#
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
+# by JAAS. In addition, the login module(s) specified in the configuration
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
+# javax.security.auth.callback package for more details.
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+#
+
+# For a non-default login configuration use the following line
+# com.sun.management.jmxremote.login.config=<config-name>
+
+#
+# ################ RMI Password file location ##################
+#
+# com.sun.management.jmxremote.password.file=filepath
+# Specifies location for password file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise the password file must exist and be in the valid format.
+# If the password file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+# com.sun.management.jmxremote.password.file=filepath
+
+#
+# ################ RMI Access file location #####################
+#
+# com.sun.management.jmxremote.access.file=filepath
+# Specifies location for access file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise, the access file must exist and be in the valid format.
+# If the access file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+# com.sun.management.jmxremote.access.file=filepath
+#
+
+# ################ Management agent listen interface #########################
+#
+# com.sun.management.jmxremote.host=<host-or-interface-name>
+# Specifies the local interface on which the JMX RMI agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
diff --git a/staging/darwin-x86/jre/lib/management/snmp.acl.template b/staging/darwin-x86/jre/lib/management/snmp.acl.template
new file mode 100644
index 0000000..0e76676
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/management/snmp.acl.template
@@ -0,0 +1,110 @@
+# ----------------------------------------------------------------------
+# Template for SNMP Access Control List File
+#
+# o Copy this template to snmp.acl
+# o Set access control for SNMP support
+# o Change the permission of snmp.acl to be read-only
+# by the owner.
+#
+# See below for the location of snmp.acl file.
+# ----------------------------------------------------------------------
+
+############################################################
+# SNMP Access Control List File
+############################################################
+#
+# Default location of this file is $JRE/lib/management/snmp.acl.
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# or by specifying a system property (See that file for details).
+#
+
+
+##############################################################
+# File permissions of the snmp.acl file
+##############################################################
+#
+# Since there are cleartext community strings stored in this file,
+# this ACL file must be readable by ONLY the owner,
+# otherwise the program will exit with an error.
+#
+##############################################################
+# Format of the acl group
+##############################################################
+#
+# communities: a list of SNMP community strings to which the
+# access control applies separated by commas.
+#
+# access: either "read-only" or "read-write".
+#
+# managers: a list of hosts to be granted the access rights.
+# Each can be expressed as any one of the following:
+# - hostname: hubble
+# - ip v4 and v6 addresses: 123.456.789.12 , fe80::a00:20ff:fe9b:ea82
+# - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
+# fe80::a00:20ff:fe9b:ea82/64
+# see RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt)
+#
+# An example of two community groups for multiple hosts:
+# acl = {
+# {
+# communities = public, private
+# access = read-only
+# managers = hubble, snowbell, nanak
+# }
+# {
+# communities = jerry
+# access = read-write
+# managers = hubble, telescope
+# }
+# }
+#
+##############################################################
+# Format of the trap group
+##############################################################
+#
+# trap-community: a single SNMP community string that will be included
+# in the traps sent to the hosts.
+#
+# hosts: a list of hosts to which the SNMP agent will send traps.
+#
+# An example of two trap community definitions for multiple hosts:
+# trap = {
+# {
+# trap-community = public
+# hosts = hubble, snowbell
+# }
+# {
+# trap-community = private
+# hosts = telescope
+# }
+# }
+#
+############################################################
+#
+# Update the community strings (public and private) below
+# before copying this template file
+#
+# Common SNMP ACL Example
+# ------------------------
+#
+# o Only localhost can connect, and access rights
+# are limited to read-only
+# o Traps are sent to localhost only
+#
+#
+# acl = {
+# {
+# communities = public, private
+# access = read-only
+# managers = localhost
+# }
+# }
+#
+#
+# trap = {
+# {
+# trap-community = public
+# hosts = localhost
+# }
+# }
diff --git a/staging/darwin-x86/jre/lib/meta-index b/staging/darwin-x86/jre/lib/meta-index
new file mode 100644
index 0000000..b06bf38
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/meta-index
@@ -0,0 +1,90 @@
+% VERSION 2
+% WARNING: this file is auto-generated; do not edit
+% UNSUPPORTED: this file and its format may change and/or
+% may be removed in a future release
+# charsets.jar
+sun/awt
+sun/nio
+! jce.jar
+javax/crypto
+sun/security
+! jsse.jar
+com/sun/net/
+sun/security
+! management-agent.jar
+@ resources.jar
+META-INF/services/javax.sound.sampled.spi.AudioFileWriter
+com/sun/imageio/
+sun/print
+META-INF/mimetypes.default
+META-INF/services/javax.sound.midi.spi.MidiDeviceProvider
+com/sun/java/util/jar/pack/
+javax/swing
+META-INF/services/sun.java2d.cmm.CMMServiceProvider
+META-INF/services/javax.sound.midi.spi.SoundbankReader
+META-INF/mailcap.default
+META-INF/services/javax.print.PrintServiceLookup
+com/sun/java/swing/
+META-INF/services/javax.sound.sampled.spi.MixerProvider
+META-INF/services/javax.sound.midi.spi.MidiFileWriter
+META-INF/services/sun.util.spi.XmlPropertiesProvider
+javax/xml
+sun/net
+META-INF/services/javax.sound.sampled.spi.FormatConversionProvider
+META-INF/services/sun.java2d.pipe.RenderingEngine
+com/sun/jndi/
+javax/sql
+com/sun/org/
+java/lang
+sun/text
+META-INF/services/com.sun.tools.internal.xjc.Plugin
+sun/rmi
+META-INF/services/javax.sound.midi.spi.MidiFileReader
+META-INF/services/javax.sound.sampled.spi.AudioFileReader
+META-INF/services/javax.print.StreamPrintServiceFactory
+com/sun/corba/
+com/sun/rowset/
+com/sun/xml/
+META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin
+! rt.jar
+com/sun/imageio/
+com/sun/rmi/
+com/sun/media/
+com/sun/security/
+com/sun/java_cup/
+com/oracle/
+org/ietf/
+com/sun/beans/
+com/sun/java/util/jar/pack/
+com/sun/naming/
+com/sun/management/
+com/sun/istack/
+java/
+com/sun/accessibility/
+sun/
+com/sun/java/swing/
+apple/laf/
+apple/security/
+com/sun/swing/
+com/sun/demo/
+com/sun/nio/
+com/sun/jmx/
+com/sun/java/browser/
+org/omg/
+com/sun/awt/
+com/sun/jndi/
+com/sun/tracing/
+org/w3c/
+com/sun/org/
+apple/applescript/
+jdk/
+com/sun/net/
+apple/launcher/
+com/sun/activation/
+javax/
+org/jcp/
+org/xml/
+com/sun/corba/
+com/sun/rowset/
+com/sun/xml/
+com/apple/
diff --git a/staging/darwin-x86/jre/lib/net.properties b/staging/darwin-x86/jre/lib/net.properties
new file mode 100644
index 0000000..b490e17
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/net.properties
@@ -0,0 +1,101 @@
+############################################################
+# Default Networking Configuration File
+#
+# This file may contain default values for the networking system properties.
+# These values are only used when the system properties are not specified
+# on the command line or set programatically.
+# For now, only the various proxy settings can be configured here.
+############################################################
+
+# Whether or not the DefaultProxySelector will default to System Proxy
+# settings when they do exist.
+# Set it to 'true' to enable this feature and check for platform
+# specific proxy settings
+# Note that the system properties that do explicitely set proxies
+# (like http.proxyHost) do take precedence over the system settings
+# even if java.net.useSystemProxies is set to true.
+
+java.net.useSystemProxies=false
+
+#------------------------------------------------------------------------
+# Proxy configuration for the various protocol handlers.
+# DO NOT uncomment these lines if you have set java.net.useSystemProxies
+# to true as the protocol specific properties will take precedence over
+# system settings.
+#------------------------------------------------------------------------
+
+# HTTP Proxy settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 80) and nonProxyHosts is a '|' separated list of hostnames which
+# should be accessed directly, ignoring the proxy server (default value is
+# localhost & 127.0.0.1).
+#
+# http.proxyHost=
+# http.proxyPort=80
+http.nonProxyHosts=localhost|127.*|[::1]
+#
+# HTTPS Proxy Settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 443). The HTTPS protocol handlers uses the http nonProxyHosts list.
+#
+# https.proxyHost=
+# https.proxyPort=443
+#
+# FTP Proxy settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 80) and nonProxyHosts is a '|' separated list of hostnames which
+# should be accessed directly, ignoring the proxy server (default value is
+# localhost & 127.0.0.1).
+#
+# ftp.proxyHost=
+# ftp.proxyPort=80
+ftp.nonProxyHosts=localhost|127.*|[::1]
+#
+# Gopher Proxy settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 80)
+#
+# gopher.proxyHost=
+# gopher.proxyPort=80
+#
+# Socks proxy settings. socksProxyHost is the name of the proxy server
+# (e.g. socks.domain.com), socksProxyPort is the port number to use
+# (default value is 1080)
+#
+# socksProxyHost=
+# socksProxyPort=1080
+#
+# HTTP Keep Alive settings. remainingData is the maximum amount of data
+# in kilobytes that will be cleaned off the underlying socket so that it
+# can be reused (default value is 512K), queuedConnections is the maximum
+# number of Keep Alive connections to be on the queue for clean up (default
+# value is 10).
+# http.KeepAlive.remainingData=512
+# http.KeepAlive.queuedConnections=10
+
+# Authentication Scheme restrictions for HTTP and HTTPS.
+#
+# In some environments certain authentication schemes may be undesirable
+# when proxying HTTP or HTTPS. For example, "Basic" results in effectively the
+# cleartext transmission of the user's password over the physical network.
+# This section describes the mechanism for disabling authentication schemes
+# based on the scheme name. Disabled schemes will be treated as if they are not
+# supported by the implementation.
+#
+# The 'jdk.http.auth.tunneling.disabledSchemes' property lists the authentication
+# schemes that will be disabled when tunneling HTTPS over a proxy, HTTP CONNECT.
+# The 'jdk.http.auth.proxying.disabledSchemes' property lists the authentication
+# schemes that will be disabled when proxying HTTP.
+#
+# In both cases the property is a comma-separated list of, case-insensitive,
+# authentication scheme names, as defined by their relevant RFCs. An
+# implementation may, but is not required to, support common schemes whose names
+# include: 'Basic', 'Digest', 'NTLM', 'Kerberos', 'Negotiate'. A scheme that
+# is not known, or not supported, by the implementation is ignored.
+#
+# Note: This property is currently used by the JDK Reference implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+#jdk.http.auth.proxying.disabledSchemes=
+jdk.http.auth.tunneling.disabledSchemes=Basic
+
diff --git a/staging/darwin-x86/jre/lib/psfont.properties.ja b/staging/darwin-x86/jre/lib/psfont.properties.ja
new file mode 100644
index 0000000..d17cf40
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/psfont.properties.ja
@@ -0,0 +1,119 @@
+#
+#
+# Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Japanese PostScript printer property file
+#
+font.num=16
+#
+serif=serif
+timesroman=serif
+sansserif=sansserif
+helvetica=sansserif
+monospaced=monospaced
+courier=monospaced
+dialog=sansserif
+dialoginput=monospaced
+#
+serif.latin1.plain=Times-Roman
+serif.latin1.italic=Times-Italic
+serif.latin1.bolditalic=Times-BoldItalic
+serif.latin1.bold=Times-Bold
+#
+sansserif.latin1.plain=Helvetica
+sansserif.latin1.italic=Helvetica-Oblique
+sansserif.latin1.bolditalic=Helvetica-BoldOblique
+sansserif.latin1.bold=Helvetica-Bold
+#
+monospaced.latin1.plain=Courier
+monospaced.latin1.italic=Courier-Oblique
+monospaced.latin1.bolditalic=Courier-BoldOblique
+monospaced.latin1.bold=Courier-Bold
+#
+serif.x11jis0208.plain=Ryumin-Light-H
+serif.x11jis0208.italic=Ryumin-Light-H
+serif.x11jis0208.bolditalic=Ryumin-Light-H
+serif.x11jis0208.bold=Ryumin-Light-H
+#
+sansserif.x11jis0208.plain=GothicBBB-Medium-H
+sansserif.x11jis0208.italic=GothicBBB-Medium-H
+sansserif.x11jis0208.bolditalic=GothicBBB-Medium-H
+sansserif.x11jis0208.bold=GothicBBB-Medium-H
+#
+monospaced.x11jis0208.plain=GothicBBB-Medium-H
+monospaced.x11jis0208.italic=GothicBBB-Medium-H
+monospaced.x11jis0208.bolditalic=GothicBBB-Medium-H
+monospaced.x11jis0208.bold=GothicBBB-Medium-H
+#
+serif.x11jis0201.plain=Ryumin-Light.Hankaku
+serif.x11jis0201.italic=Ryumin-Light.Hankaku
+serif.x11jis0201.bolditalic=Ryumin-Light.Hankaku
+serif.x11jis0201.bold=Ryumin-Light.Hankaku
+#
+sansserif.x11jis0201.plain=GothicBBB-Medium.Hankaku
+sansserif.x11jis0201.italic=GothicBBB-Medium.Hankaku
+sansserif.x11jis0201.bolditalic=GothicBBB-Medium.Hankaku
+sansserif.x11jis0201.bold=GothicBBB-Medium.Hankaku
+#
+monospaced.x11jis0201.plain=GothicBBB-Medium.Hankaku
+monospaced.x11jis0201.italic=GothicBBB-Medium.Hankaku
+monospaced.x11jis0201.bolditalic=GothicBBB-Medium.Hankaku
+monospaced.x11jis0201.bold=GothicBBB-Medium.Hankaku
+#
+Helvetica=0
+Helvetica-Bold=1
+Helvetica-Oblique=2
+Helvetica-BoldOblique=3
+Times-Roman=4
+Times-Bold=5
+Times-Italic=6
+Times-BoldItalic=7
+Courier=8
+Courier-Bold=9
+Courier-Oblique=10
+Courier-BoldOblique=11
+GothicBBB-Medium-H=12
+Ryumin-Light-H=13
+GothicBBB-Medium.Hankaku=14
+Ryumin-Light.Hankaku=15
+#
+font.0=Helvetica ISOF
+font.1=Helvetica-Bold ISOF
+font.2=Helvetica-Oblique ISOF
+font.3=Helvetica-BoldOblique ISOF
+font.4=Times-Roman ISOF
+font.5=Times-Bold ISOF
+font.6=Times-Italic ISOF
+font.7=Times-BoldItalic ISOF
+font.8=Courier ISOF
+font.9=Courier-Bold ISOF
+font.10=Courier-Oblique ISOF
+font.11=Courier-BoldOblique ISOF
+font.12=GothicBBB-Medium-H findfont
+font.13=Ryumin-Light-H findfont
+font.14=GothicBBB-Medium.Hankaku findfont
+font.15=Ryumin-Light.Hankaku findfont
+#
diff --git a/staging/darwin-x86/jre/lib/psfontj2d.properties b/staging/darwin-x86/jre/lib/psfontj2d.properties
new file mode 100644
index 0000000..5eb2c4b
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/psfontj2d.properties
@@ -0,0 +1,323 @@
+#
+#
+# Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+
+#
+# PostScript printer property file for Java 2D printing.
+#
+# WARNING: This is an internal implementation file, not a public file.
+# Any customisation or reliance on the existence of this file and its
+# contents or syntax is discouraged and unsupported.
+# It may be incompatibly changed or removed without any notice.
+#
+#
+font.num=35
+#
+# Legacy logical font family names and logical font aliases should all
+# map to the primary logical font names.
+#
+serif=serif
+times=serif
+timesroman=serif
+sansserif=sansserif
+helvetica=sansserif
+dialog=sansserif
+dialoginput=monospaced
+monospaced=monospaced
+courier=monospaced
+#
+# Next, physical fonts which can be safely mapped to standard postscript fonts
+# These keys generally map to a value which is the same as the key, so
+# the key/value is just a way to say the font has a mapping.
+# Sometimes however we map more than one screen font to the same PS font.
+#
+avantgarde=avantgarde_book
+avantgarde_book=avantgarde_book
+avantgarde_demi=avantgarde_demi
+avantgarde_book_oblique=avantgarde_book_oblique
+avantgarde_demi_oblique=avantgarde_demi_oblique
+#
+itcavantgarde=avantgarde_book
+itcavantgarde=avantgarde_book
+itcavantgarde_demi=avantgarde_demi
+itcavantgarde_oblique=avantgarde_book_oblique
+itcavantgarde_demi_oblique=avantgarde_demi_oblique
+#
+bookman=bookman_light
+bookman_light=bookman_light
+bookman_demi=bookman_demi
+bookman_light_italic=bookman_light_italic
+bookman_demi_italic=bookman_demi_italic
+#
+# Exclude "helvetica" on its own as that's a legacy name for a logical font
+helvetica_bold=helvetica_bold
+helvetica_oblique=helvetica_oblique
+helvetica_bold_oblique=helvetica_bold_oblique
+#
+itcbookman_light=bookman_light
+itcbookman_demi=bookman_demi
+itcbookman_light_italic=bookman_light_italic
+itcbookman_demi_italic=bookman_demi_italic
+#
+# Exclude "courier" on its own as that's a legacy name for a logical font
+courier_bold=courier_bold
+courier_oblique=courier_oblique
+courier_bold_oblique=courier_bold_oblique
+#
+courier_new=courier
+courier_new_bold=courier_bold
+#
+monotype_century_schoolbook=newcenturyschoolbook
+monotype_century_schoolbook_bold=newcenturyschoolbook_bold
+monotype_century_schoolbook_italic=newcenturyschoolbook_italic
+monotype_century_schoolbook_bold_italic=newcenturyschoolbook_bold_italic
+#
+newcenturyschoolbook=newcenturyschoolbook
+newcenturyschoolbook_bold=newcenturyschoolbook_bold
+newcenturyschoolbook_italic=newcenturyschoolbook_italic
+newcenturyschoolbook_bold_italic=newcenturyschoolbook_bold_italic
+#
+palatino=palatino
+palatino_bold=palatino_bold
+palatino_italic=palatino_italic
+palatino_bold_italic=palatino_bold_italic
+#
+# Exclude "times" on its own as that's a legacy name for a logical font
+times_bold=times_roman_bold
+times_italic=times_roman_italic
+times_bold_italic=times_roman_bold_italic
+#
+times_roman=times_roman
+times_roman_bold=times_roman_bold
+times_roman_italic=times_roman_italic
+times_roman_bold_italic=times_roman_bold_italic
+#
+times_new_roman=times_roman
+times_new_roman_bold=times_roman_bold
+times_new_roman_italic=times_roman_italic
+times_new_roman_bold_italic=times_roman_bold_italic
+#
+zapfchancery_italic=zapfchancery_italic
+itczapfchancery_italic=zapfchancery_italic
+#
+# Next the mapping of the font name + charset + style to Postscript font name
+# for the logical fonts.
+#
+serif.latin1.plain=Times-Roman
+serif.latin1.bold=Times-Bold
+serif.latin1.italic=Times-Italic
+serif.latin1.bolditalic=Times-BoldItalic
+serif.symbol.plain=Symbol
+serif.dingbats.plain=ZapfDingbats
+serif.symbol.bold=Symbol
+serif.dingbats.bold=ZapfDingbats
+serif.symbol.italic=Symbol
+serif.dingbats.italic=ZapfDingbats
+serif.symbol.bolditalic=Symbol
+serif.dingbats.bolditalic=ZapfDingbats
+#
+sansserif.latin1.plain=Helvetica
+sansserif.latin1.bold=Helvetica-Bold
+sansserif.latin1.italic=Helvetica-Oblique
+sansserif.latin1.bolditalic=Helvetica-BoldOblique
+sansserif.symbol.plain=Symbol
+sansserif.dingbats.plain=ZapfDingbats
+sansserif.symbol.bold=Symbol
+sansserif.dingbats.bold=ZapfDingbats
+sansserif.symbol.italic=Symbol
+sansserif.dingbats.italic=ZapfDingbats
+sansserif.symbol.bolditalic=Symbol
+sansserif.dingbats.bolditalic=ZapfDingbats
+#
+monospaced.latin1.plain=Courier
+monospaced.latin1.bold=Courier-Bold
+monospaced.latin1.italic=Courier-Oblique
+monospaced.latin1.bolditalic=Courier-BoldOblique
+monospaced.symbol.plain=Symbol
+monospaced.dingbats.plain=ZapfDingbats
+monospaced.symbol.bold=Symbol
+monospaced.dingbats.bold=ZapfDingbats
+monospaced.symbol.italic=Symbol
+monospaced.dingbats.italic=ZapfDingbats
+monospaced.symbol.bolditalic=Symbol
+monospaced.dingbats.bolditalic=ZapfDingbats
+#
+# Next the mapping of the font name + charset + style to Postscript font name
+# for the physical fonts. Since these always report style as plain, the
+# style key is always plain. So we map using the face name to the correct
+# style for the postscript font. This is possible since the face names can
+# be replied upon to be different for each style.
+# However an application may try to create a Font applying a style to an
+# physical name. We want to map to the correct Postscript font there too
+# if possible but we do not map cases where the application tries to
+# augment a style (eg ask for a bold version of a bold font)
+# Defer to the 2D package to attempt create an artificially styled version
+#
+avantgarde_book.latin1.plain=AvantGarde-Book
+avantgarde_demi.latin1.plain=AvantGarde-Demi
+avantgarde_book_oblique.latin1.plain=AvantGarde-BookOblique
+avantgarde_demi_oblique.latin1.plain=AvantGarde-DemiOblique
+#
+avantgarde_book.latin1.bold=AvantGarde-Demi
+avantgarde_book.latin1.italic=AvantGarde-BookOblique
+avantgarde_book.latin1.bolditalic=AvantGarde-DemiOblique
+avantgarde_demi.latin1.italic=AvantGarde-DemiOblique
+avantgarde_book_oblique.latin1.bold=AvantGarde-DemiOblique
+#
+bookman_light.latin1.plain=Bookman-Light
+bookman_demi.latin1.plain=Bookman-Demi
+bookman_light_italic.latin1.plain=Bookman-LightItalic
+bookman_demi_italic.latin1.plain=Bookman-DemiItalic
+#
+bookman_light.latin1.bold=Bookman-Demi
+bookman_light.latin1.italic=Bookman-LightItalic
+bookman_light.latin1.bolditalic=Bookman-DemiItalic
+bookman_light_bold.latin1.italic=Bookman-DemiItalic
+bookman_light_italic.latin1.bold=Bookman-DemiItalic
+#
+courier.latin1.plain=Courier
+courier_bold.latin1.plain=Courier-Bold
+courier_oblique.latin1.plain=Courier-Oblique
+courier_bold_oblique.latin1.plain=Courier-BoldOblique
+courier.latin1.bold=Courier-Bold
+courier.latin1.italic=Courier-Oblique
+courier.latin1.bolditalic=Courier-BoldOblique
+courier_bold.latin1.italic=Courier-BoldOblique
+courier_italic.latin1.bold=Courier-BoldOblique
+#
+helvetica_bold.latin1.plain=Helvetica-Bold
+helvetica_oblique.latin1.plain=Helvetica-Oblique
+helvetica_bold_oblique.latin1.plain=Helvetica-BoldOblique
+helvetica.latin1.bold=Helvetica-Bold
+helvetica.latin1.italic=Helvetica-Oblique
+helvetica.latin1.bolditalic=Helvetica-BoldOblique
+helvetica_bold.latin1.italic=Helvetica-BoldOblique
+helvetica_italic.latin1.bold=Helvetica-BoldOblique
+#
+newcenturyschoolbook.latin1.plain=NewCenturySchlbk-Roman
+newcenturyschoolbook_bold.latin1.plain=NewCenturySchlbk-Bold
+newcenturyschoolbook_italic.latin1.plain=NewCenturySchlbk-Italic
+newcenturyschoolbook_bold_italic.latin1.plain=NewCenturySchlbk-BoldItalic
+newcenturyschoolbook.latin1.bold=NewCenturySchlbk-Bold
+newcenturyschoolbook.latin1.italic=NewCenturySchlbk-Italic
+newcenturyschoolbook.latin1.bolditalic=NewCenturySchlbk-BoldItalic
+newcenturyschoolbook_bold.latin1.italic=NewCenturySchlbk-BoldItalic
+newcenturyschoolbook_italic.latin1.bold=NewCenturySchlbk-BoldItalic
+#
+palatino.latin1.plain=Palatino-Roman
+palatino_bold.latin1.plain=Palatino-Bold
+palatino_italic.latin1.plain=Palatino-Italic
+palatino_bold_italic.latin1.plain=Palatino-BoldItalic
+palatino.latin1.bold=Palatino-Bold
+palatino.latin1.italic=Palatino-Italic
+palatino.latin1.bolditalic=Palatino-BoldItalic
+palatino_bold.latin1.italic=Palatino-BoldItalic
+palatino_italic.latin1.bold=Palatino-BoldItalic
+#
+times_roman.latin1.plain=Times-Roman
+times_roman_bold.latin1.plain=Times-Bold
+times_roman_italic.latin1.plain=Times-Italic
+times_roman_bold_italic.latin1.plain=Times-BoldItalic
+times_roman.latin1.bold=Times-Bold
+times_roman.latin1.italic=Times-Italic
+times_roman.latin1.bolditalic=Times-BoldItalic
+times_roman_bold.latin1.italic=Times-BoldItalic
+times_roman_italic.latin1.bold=Times-BoldItalic
+#
+zapfchancery_italic.latin1.plain=ZapfChancery-MediumItalic
+#
+# Finally the mappings of PS font names to indexes.
+#
+AvantGarde-Book=0
+AvantGarde-BookOblique=1
+AvantGarde-Demi=2
+AvantGarde-DemiOblique=3
+Bookman-Demi=4
+Bookman-DemiItalic=5
+Bookman-Light=6
+Bookman-LightItalic=7
+Courier=8
+Courier-Bold=9
+Courier-BoldOblique=10
+Courier-Oblique=11
+Helvetica=12
+Helvetica-Bold=13
+Helvetica-BoldOblique=14
+Helvetica-Narrow=15
+Helvetica-Narrow-Bold=16
+Helvetica-Narrow-BoldOblique=17
+Helvetica-Narrow-Oblique=18
+Helvetica-Oblique=19
+NewCenturySchlbk-Bold=20
+NewCenturySchlbk-BoldItalic=21
+NewCenturySchlbk-Italic=22
+NewCenturySchlbk-Roman=23
+Palatino-Bold=24
+Palatino-BoldItalic=25
+Palatino-Italic=26
+Palatino-Roman=27
+Symbol=28
+Times-Bold=29
+Times-BoldItalic=30
+Times-Italic=31
+Times-Roman=32
+ZapfDingbats=33
+ZapfChancery-MediumItalic=34
+#
+font.0=AvantGarde-Book ISOF
+font.1=AvantGarde-BookOblique ISOF
+font.2=AvantGarde-Demi ISOF
+font.3=AvantGarde-DemiOblique ISOF
+font.4=Bookman-Demi ISOF
+font.5=Bookman-DemiItalic ISOF
+font.6=Bookman-Light ISOF
+font.7=Bookman-LightItalic ISOF
+font.8=Courier ISOF
+font.9=Courier-Bold ISOF
+font.10=Courier-BoldOblique ISOF
+font.11=Courier-Oblique ISOF
+font.12=Helvetica ISOF
+font.13=Helvetica-Bold ISOF
+font.14=Helvetica-BoldOblique ISOF
+font.15=Helvetica-Narrow ISOF
+font.16=Helvetica-Narrow-Bold ISOF
+font.17=Helvetica-Narrow-BoldOblique ISOF
+font.18=Helvetica-Narrow-Oblique ISOF
+font.19=Helvetica-Oblique ISOF
+font.20=NewCenturySchlbk-Bold ISOF
+font.21=NewCenturySchlbk-BoldItalic ISOF
+font.22=NewCenturySchlbk-Italic ISOF
+font.23=NewCenturySchlbk-Roman ISOF
+font.24=Palatino-Bold ISOF
+font.25=Palatino-BoldItalic ISOF
+font.26=Palatino-Italic ISOF
+font.27=Palatino-Roman ISOF
+font.28=Symbol findfont
+font.29=Times-Bold ISOF
+font.30=Times-BoldItalic ISOF
+font.31=Times-Italic ISOF
+font.32=Times-Roman ISOF
+font.33=ZapfDingbats findfont
+font.34=ZapfChancery-MediumItalic ISOF
+#
diff --git a/staging/darwin-x86/jre/lib/resources.jar b/staging/darwin-x86/jre/lib/resources.jar
new file mode 100644
index 0000000..289cf9d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/resources.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/rt.jar b/staging/darwin-x86/jre/lib/rt.jar
new file mode 100644
index 0000000..d7f6474
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/rt.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/security/blacklisted.certs b/staging/darwin-x86/jre/lib/security/blacklisted.certs
new file mode 100644
index 0000000..00a1dcf
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/blacklisted.certs
@@ -0,0 +1,20 @@
+Algorithm=SHA-256
+14E6D2764A4B06701C6CBC376A253775F79C782FBCB6C0EE6F99DE4BA1024ADD
+31C8FD37DB9B56E708B03D1F01848B068C6DA66F36FB5D82C008C6040FA3E133
+3946901F46B0071E90D78279E82FABABCA177231A704BE72C5B0E8918566EA66
+450F1B421BB05C8609854884559C323319619E8B06B001EA2DCBB74A23AA3BE2
+4CBBF8256BC9888A8007B2F386940A2E394378B0D903CBB3863C5A6394B889CE
+4FEE0163686ECBD65DB968E7494F55D84B25486D438E9DE558D629D28CD4D176
+5E83124D68D24E8E177E306DF643D5EA99C5A94D6FC34B072F7544A1CABB7C7B
+76A45A496031E4DD2D7ED23E8F6FF97DBDEA980BAAC8B0BA94D7EDB551348645
+8A1BD21661C60015065212CC98B1ABB50DFD14C872A208E66BAE890F25C448AF
+9ED8F9B0E8E42A1656B8E1DD18F42BA42DC06FE52686173BA2FC70E756F207DC
+A686FEE577C88AB664D0787ECDFFF035F4806F3DE418DC9E4D516324FFF02083
+B8686723E415534BC0DBD16326F9486F85B0B0799BF6639334E61DAAE67F36CD
+D24566BF315F4E597D6E381C87119FB4198F5E9E2607F5F4AB362EF7E2E7672F
+D3A936E1A7775A45217C8296A1F22AC5631DCDEC45594099E78EEEBBEDCBA967
+DF21016B00FC54F9FE3BC8B039911BB216E9162FAD2FD14D990AB96E951B49BE
+EC30C9C3065A06BB07DC5B1C6B497F370C1CA65C0F30C08E042BA6BCECC78F2C
+F5B6F88F75D391A4B1EB336F9E201239FB6B1377DB8CFA7B84736216E5AFFFD7
+FC02FD48DB92D4DCE6F11679D38354CF750CFC7F584A520EB90BDE80E241F2BD
+FDEDB5BDFCB67411513A61AEE5CB5B5D7C52AF06028EFC996CC1B05B1D6CEA2B
diff --git a/staging/darwin-x86/jre/lib/security/cacerts b/staging/darwin-x86/jre/lib/security/cacerts
new file mode 100644
index 0000000..318a166
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/cacerts
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/security/java.policy b/staging/darwin-x86/jre/lib/security/java.policy
new file mode 100644
index 0000000..120694d
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/java.policy
@@ -0,0 +1,49 @@
+
+// Standard extensions get all permissions by default
+
+grant codeBase "file:${{java.ext.dirs}}/*" {
+ permission java.security.AllPermission;
+};
+
+// default permissions granted to all domains
+
+grant {
+ // Allows any thread to stop itself using the java.lang.Thread.stop()
+ // method that takes no argument.
+ // Note that this permission is granted by default only to remain
+ // backwards compatible.
+ // It is strongly recommended that you either remove this permission
+ // from this policy file or further restrict it to code sources
+ // that you specify, because Thread.stop() is potentially unsafe.
+ // See the API specification of java.lang.Thread.stop() for more
+ // information.
+ permission java.lang.RuntimePermission "stopThread";
+
+ // allows anyone to listen on dynamic ports
+ permission java.net.SocketPermission "localhost:0", "listen";
+
+ // "standard" properies that can be read by anyone
+
+ permission java.util.PropertyPermission "java.version", "read";
+ permission java.util.PropertyPermission "java.vendor", "read";
+ permission java.util.PropertyPermission "java.vendor.url", "read";
+ permission java.util.PropertyPermission "java.class.version", "read";
+ permission java.util.PropertyPermission "os.name", "read";
+ permission java.util.PropertyPermission "os.version", "read";
+ permission java.util.PropertyPermission "os.arch", "read";
+ permission java.util.PropertyPermission "file.separator", "read";
+ permission java.util.PropertyPermission "path.separator", "read";
+ permission java.util.PropertyPermission "line.separator", "read";
+
+ permission java.util.PropertyPermission "java.specification.version", "read";
+ permission java.util.PropertyPermission "java.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.specification.name", "read";
+
+ permission java.util.PropertyPermission "java.vm.specification.version", "read";
+ permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.specification.name", "read";
+ permission java.util.PropertyPermission "java.vm.version", "read";
+ permission java.util.PropertyPermission "java.vm.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.name", "read";
+};
+
diff --git a/staging/darwin-x86/jre/lib/security/java.security b/staging/darwin-x86/jre/lib/security/java.security
new file mode 100644
index 0000000..2a08b6f
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/java.security
@@ -0,0 +1,912 @@
+#
+# This is the "master security properties file".
+#
+# An alternate java.security properties file may be specified
+# from the command line via the system property
+#
+# -Djava.security.properties=<URL>
+#
+# This properties file appends to the master security properties file.
+# If both properties files specify values for the same key, the value
+# from the command-line properties file is selected, as it is the last
+# one loaded.
+#
+# Also, if you specify
+#
+# -Djava.security.properties==<URL> (2 equals),
+#
+# then that properties file completely overrides the master security
+# properties file.
+#
+# To disable the ability to specify an additional properties file from
+# the command line, set the key security.overridePropertiesFile
+# to false in the master security properties file. It is set to true
+# by default.
+
+# In this file, various security properties are set for use by
+# java.security classes. This is where users can statically register
+# Cryptography Package Providers ("providers" for short). The term
+# "provider" refers to a package or set of packages that supply a
+# concrete implementation of a subset of the cryptography aspects of
+# the Java Security API. A provider may, for example, implement one or
+# more digital signature algorithms or message digest algorithms.
+#
+# Each provider must implement a subclass of the Provider class.
+# To register a provider in this master security properties file,
+# specify the Provider subclass name and priority in the format
+#
+# security.provider.<n>=<className>
+#
+# This declares a provider, and specifies its preference
+# order n. The preference order is the order in which providers are
+# searched for requested algorithms (when no specific provider is
+# requested). The order is 1-based; 1 is the most preferred, followed
+# by 2, and so on.
+#
+# <className> must specify the subclass of the Provider class whose
+# constructor sets the values of various properties that are required
+# for the Java Security API to look up the algorithms or other
+# facilities implemented by the provider.
+#
+# There must be at least one provider specification in java.security.
+# There is a default provider that comes standard with the JDK. It
+# is called the "SUN" provider, and its Provider subclass
+# named Sun appears in the sun.security.provider package. Thus, the
+# "SUN" provider is registered via the following:
+#
+# security.provider.1=sun.security.provider.Sun
+#
+# (The number 1 is used for the default provider.)
+#
+# Note: Providers can be dynamically registered instead by calls to
+# either the addProvider or insertProviderAt method in the Security
+# class.
+
+#
+# List of providers and their preference orders (see above):
+#
+security.provider.1=sun.security.provider.Sun
+security.provider.2=sun.security.rsa.SunRsaSign
+security.provider.3=sun.security.ec.SunEC
+security.provider.4=com.sun.net.ssl.internal.ssl.Provider
+security.provider.5=com.sun.crypto.provider.SunJCE
+security.provider.6=sun.security.jgss.SunProvider
+security.provider.7=com.sun.security.sasl.Provider
+security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
+security.provider.9=sun.security.smartcardio.SunPCSC
+security.provider.10=apple.security.AppleProvider
+
+#
+# Sun Provider SecureRandom seed source.
+#
+# Select the primary source of seed data for the "SHA1PRNG" and
+# "NativePRNG" SecureRandom implementations in the "Sun" provider.
+# (Other SecureRandom implementations might also use this property.)
+#
+# On Unix-like systems (for example, Solaris/Linux/MacOS), the
+# "NativePRNG" and "SHA1PRNG" implementations obtains seed data from
+# special device files such as file:/dev/random.
+#
+# On Windows systems, specifying the URLs "file:/dev/random" or
+# "file:/dev/urandom" will enable the native Microsoft CryptoAPI seeding
+# mechanism for SHA1PRNG.
+#
+# By default, an attempt is made to use the entropy gathering device
+# specified by the "securerandom.source" Security property. If an
+# exception occurs while accessing the specified URL:
+#
+# SHA1PRNG:
+# the traditional system/thread activity algorithm will be used.
+#
+# NativePRNG:
+# a default value of /dev/random will be used. If neither
+# are available, the implementation will be disabled.
+# "file" is the only currently supported protocol type.
+#
+# The entropy gathering device can also be specified with the System
+# property "java.security.egd". For example:
+#
+# % java -Djava.security.egd=file:/dev/random MainClass
+#
+# Specifying this System property will override the
+# "securerandom.source" Security property.
+#
+# In addition, if "file:/dev/random" or "file:/dev/urandom" is
+# specified, the "NativePRNG" implementation will be more preferred than
+# SHA1PRNG in the Sun provider.
+#
+securerandom.source=file:/dev/random
+
+#
+# A list of known strong SecureRandom implementations.
+#
+# To help guide applications in selecting a suitable strong
+# java.security.SecureRandom implementation, Java distributions should
+# indicate a list of known strong implementations using the property.
+#
+# This is a comma-separated list of algorithm and/or algorithm:provider
+# entries.
+#
+securerandom.strongAlgorithms=NativePRNGBlocking:SUN
+
+#
+# Class to instantiate as the javax.security.auth.login.Configuration
+# provider.
+#
+login.configuration.provider=sun.security.provider.ConfigFile
+
+#
+# Default login configuration file
+#
+#login.config.url.1=file:${user.home}/.java.login.config
+
+#
+# Class to instantiate as the system Policy. This is the name of the class
+# that will be used as the Policy object.
+#
+policy.provider=sun.security.provider.PolicyFile
+
+# The default is to have a single system-wide policy file,
+# and a policy file in the user's home directory.
+policy.url.1=file:${java.home}/lib/security/java.policy
+policy.url.2=file:${user.home}/.java.policy
+
+# whether or not we expand properties in the policy file
+# if this is set to false, properties (${...}) will not be expanded in policy
+# files.
+policy.expandProperties=true
+
+# whether or not we allow an extra policy to be passed on the command line
+# with -Djava.security.policy=somefile. Comment out this line to disable
+# this feature.
+policy.allowSystemProperty=true
+
+# whether or not we look into the IdentityScope for trusted Identities
+# when encountering a 1.1 signed JAR file. If the identity is found
+# and is trusted, we grant it AllPermission.
+policy.ignoreIdentityScope=false
+
+#
+# Default keystore type.
+#
+keystore.type=jks
+
+#
+# Controls compatibility mode for the JKS keystore type.
+#
+# When set to 'true', the JKS keystore type supports loading
+# keystore files in either JKS or PKCS12 format. When set to 'false'
+# it supports loading only JKS keystore files.
+#
+keystore.type.compat=true
+
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageAccess unless the
+# corresponding RuntimePermission ("accessClassInPackage."+package) has
+# been granted.
+package.access=sun.,\
+ com.sun.xml.internal.,\
+ com.sun.imageio.,\
+ com.sun.istack.internal.,\
+ com.sun.jmx.,\
+ com.sun.media.sound.,\
+ com.sun.naming.internal.,\
+ com.sun.proxy.,\
+ com.sun.corba.se.,\
+ com.sun.org.apache.bcel.internal.,\
+ com.sun.org.apache.regexp.internal.,\
+ com.sun.org.apache.xerces.internal.,\
+ com.sun.org.apache.xpath.internal.,\
+ com.sun.org.apache.xalan.internal.extensions.,\
+ com.sun.org.apache.xalan.internal.lib.,\
+ com.sun.org.apache.xalan.internal.res.,\
+ com.sun.org.apache.xalan.internal.templates.,\
+ com.sun.org.apache.xalan.internal.utils.,\
+ com.sun.org.apache.xalan.internal.xslt.,\
+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\
+ com.sun.org.apache.xalan.internal.xsltc.trax.,\
+ com.sun.org.apache.xalan.internal.xsltc.util.,\
+ com.sun.org.apache.xml.internal.res.,\
+ com.sun.org.apache.xml.internal.security.,\
+ com.sun.org.apache.xml.internal.serializer.utils.,\
+ com.sun.org.apache.xml.internal.utils.,\
+ com.sun.org.glassfish.,\
+ com.oracle.xmlns.internal.,\
+ com.oracle.webservices.internal.,\
+ oracle.jrockit.jfr.,\
+ org.jcp.xml.dsig.internal.,\
+ jdk.internal.,\
+ jdk.nashorn.internal.,\
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.,\
+ apple.
+
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageDefinition unless the
+# corresponding RuntimePermission ("defineClassInPackage."+package) has
+# been granted.
+#
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
+#
+package.definition=sun.,\
+ com.sun.xml.internal.,\
+ com.sun.imageio.,\
+ com.sun.istack.internal.,\
+ com.sun.jmx.,\
+ com.sun.media.sound.,\
+ com.sun.naming.internal.,\
+ com.sun.proxy.,\
+ com.sun.corba.se.,\
+ com.sun.org.apache.bcel.internal.,\
+ com.sun.org.apache.regexp.internal.,\
+ com.sun.org.apache.xerces.internal.,\
+ com.sun.org.apache.xpath.internal.,\
+ com.sun.org.apache.xalan.internal.extensions.,\
+ com.sun.org.apache.xalan.internal.lib.,\
+ com.sun.org.apache.xalan.internal.res.,\
+ com.sun.org.apache.xalan.internal.templates.,\
+ com.sun.org.apache.xalan.internal.utils.,\
+ com.sun.org.apache.xalan.internal.xslt.,\
+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\
+ com.sun.org.apache.xalan.internal.xsltc.trax.,\
+ com.sun.org.apache.xalan.internal.xsltc.util.,\
+ com.sun.org.apache.xml.internal.res.,\
+ com.sun.org.apache.xml.internal.security.,\
+ com.sun.org.apache.xml.internal.serializer.utils.,\
+ com.sun.org.apache.xml.internal.utils.,\
+ com.sun.org.glassfish.,\
+ com.oracle.xmlns.internal.,\
+ com.oracle.webservices.internal.,\
+ oracle.jrockit.jfr.,\
+ org.jcp.xml.dsig.internal.,\
+ jdk.internal.,\
+ jdk.nashorn.internal.,\
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.,\
+ apple.
+
+#
+# Determines whether this properties file can be appended to
+# or overridden on the command line via -Djava.security.properties
+#
+security.overridePropertiesFile=true
+
+#
+# Determines the default key and trust manager factory algorithms for
+# the javax.net.ssl package.
+#
+ssl.KeyManagerFactory.algorithm=SunX509
+ssl.TrustManagerFactory.algorithm=PKIX
+
+#
+# The Java-level namelookup cache policy for successful lookups:
+#
+# any negative value: caching forever
+# any positive value: the number of seconds to cache an address for
+# zero: do not cache
+#
+# default value is forever (FOREVER). For security reasons, this
+# caching is made forever when a security manager is set. When a security
+# manager is not set, the default behavior in this implementation
+# is to cache for 30 seconds.
+#
+# NOTE: setting this to anything other than the default value can have
+# serious security implications. Do not set it unless
+# you are sure you are not exposed to DNS spoofing attack.
+#
+#networkaddress.cache.ttl=-1
+
+# The Java-level namelookup cache policy for failed lookups:
+#
+# any negative value: cache forever
+# any positive value: the number of seconds to cache negative lookup results
+# zero: do not cache
+#
+# In some Microsoft Windows networking environments that employ
+# the WINS name service in addition to DNS, name service lookups
+# that fail may take a noticeably long time to return (approx. 5 seconds).
+# For this reason the default caching policy is to maintain these
+# results for 10 seconds.
+#
+#
+networkaddress.cache.negative.ttl=10
+
+#
+# Properties to configure OCSP for certificate revocation checking
+#
+
+# Enable OCSP
+#
+# By default, OCSP is not used for certificate revocation checking.
+# This property enables the use of OCSP when set to the value "true".
+#
+# NOTE: SocketPermission is required to connect to an OCSP responder.
+#
+# Example,
+# ocsp.enable=true
+
+#
+# Location of the OCSP responder
+#
+# By default, the location of the OCSP responder is determined implicitly
+# from the certificate being validated. This property explicitly specifies
+# the location of the OCSP responder. The property is used when the
+# Authority Information Access extension (defined in RFC 3280) is absent
+# from the certificate or when it requires overriding.
+#
+# Example,
+# ocsp.responderURL=http://ocsp.example.net:80
+
+#
+# Subject name of the OCSP responder's certificate
+#
+# By default, the certificate of the OCSP responder is that of the issuer
+# of the certificate being validated. This property identifies the certificate
+# of the OCSP responder when the default does not apply. Its value is a string
+# distinguished name (defined in RFC 2253) which identifies a certificate in
+# the set of certificates supplied during cert path validation. In cases where
+# the subject name alone is not sufficient to uniquely identify the certificate
+# then both the "ocsp.responderCertIssuerName" and
+# "ocsp.responderCertSerialNumber" properties must be used instead. When this
+# property is set then those two properties are ignored.
+#
+# Example,
+# ocsp.responderCertSubjectName="CN=OCSP Responder, O=XYZ Corp"
+
+#
+# Issuer name of the OCSP responder's certificate
+#
+# By default, the certificate of the OCSP responder is that of the issuer
+# of the certificate being validated. This property identifies the certificate
+# of the OCSP responder when the default does not apply. Its value is a string
+# distinguished name (defined in RFC 2253) which identifies a certificate in
+# the set of certificates supplied during cert path validation. When this
+# property is set then the "ocsp.responderCertSerialNumber" property must also
+# be set. When the "ocsp.responderCertSubjectName" property is set then this
+# property is ignored.
+#
+# Example,
+# ocsp.responderCertIssuerName="CN=Enterprise CA, O=XYZ Corp"
+
+#
+# Serial number of the OCSP responder's certificate
+#
+# By default, the certificate of the OCSP responder is that of the issuer
+# of the certificate being validated. This property identifies the certificate
+# of the OCSP responder when the default does not apply. Its value is a string
+# of hexadecimal digits (colon or space separators may be present) which
+# identifies a certificate in the set of certificates supplied during cert path
+# validation. When this property is set then the "ocsp.responderCertIssuerName"
+# property must also be set. When the "ocsp.responderCertSubjectName" property
+# is set then this property is ignored.
+#
+# Example,
+# ocsp.responderCertSerialNumber=2A:FF:00
+
+#
+# Policy for failed Kerberos KDC lookups:
+#
+# When a KDC is unavailable (network error, service failure, etc), it is
+# put inside a blacklist and accessed less often for future requests. The
+# value (case-insensitive) for this policy can be:
+#
+# tryLast
+# KDCs in the blacklist are always tried after those not on the list.
+#
+# tryLess[:max_retries,timeout]
+# KDCs in the blacklist are still tried by their order in the configuration,
+# but with smaller max_retries and timeout values. max_retries and timeout
+# are optional numerical parameters (default 1 and 5000, which means once
+# and 5 seconds). Please notes that if any of the values defined here is
+# more than what is defined in krb5.conf, it will be ignored.
+#
+# Whenever a KDC is detected as available, it is removed from the blacklist.
+# The blacklist is reset when krb5.conf is reloaded. You can add
+# refreshKrb5Config=true to a JAAS configuration file so that krb5.conf is
+# reloaded whenever a JAAS authentication is attempted.
+#
+# Example,
+# krb5.kdc.bad.policy = tryLast
+# krb5.kdc.bad.policy = tryLess:2,2000
+krb5.kdc.bad.policy = tryLast
+
+# Algorithm restrictions for certification path (CertPath) processing
+#
+# In some environments, certain algorithms or key lengths may be undesirable
+# for certification path building and validation. For example, "MD2" is
+# generally no longer considered to be a secure hash algorithm. This section
+# describes the mechanism for disabling algorithms based on algorithm name
+# and/or key length. This includes algorithms used in certificates, as well
+# as revocation information such as CRLs and signed OCSP Responses.
+# The syntax of the disabled algorithm string is described as follows:
+# DisabledAlgorithms:
+# " DisabledAlgorithm { , DisabledAlgorithm } "
+#
+# DisabledAlgorithm:
+# AlgorithmName [Constraint] { '&' Constraint }
+#
+# AlgorithmName:
+# (see below)
+#
+# Constraint:
+# KeySizeConstraint | CAConstraint | DenyAfterConstraint |
+# UsageConstraint
+#
+# KeySizeConstraint:
+# keySize Operator KeyLength
+#
+# Operator:
+# <= | < | == | != | >= | >
+#
+# KeyLength:
+# Integer value of the algorithm's key length in bits
+#
+# CAConstraint:
+# jdkCA
+#
+# DenyAfterConstraint:
+# denyAfter YYYY-MM-DD
+#
+# UsageConstraint:
+# usage [TLSServer] [TLSClient] [SignedJAR]
+#
+# The "AlgorithmName" is the standard algorithm name of the disabled
+# algorithm. See "Java Cryptography Architecture Standard Algorithm Name
+# Documentation" for information about Standard Algorithm Names. Matching
+# is performed using a case-insensitive sub-element matching rule. (For
+# example, in "SHA1withECDSA" the sub-elements are "SHA1" for hashing and
+# "ECDSA" for signatures.) If the assertion "AlgorithmName" is a
+# sub-element of the certificate algorithm name, the algorithm will be
+# rejected during certification path building and validation. For example,
+# the assertion algorithm name "DSA" will disable all certificate algorithms
+# that rely on DSA, such as NONEwithDSA, SHA1withDSA. However, the assertion
+# will not disable algorithms related to "ECDSA".
+#
+# A "Constraint" defines restrictions on the keys and/or certificates for
+# a specified AlgorithmName:
+#
+# KeySizeConstraint:
+# keySize Operator KeyLength
+# The constraint requires a key of a valid size range if the
+# "AlgorithmName" is of a key algorithm. The "KeyLength" indicates
+# the key size specified in number of bits. For example,
+# "RSA keySize <= 1024" indicates that any RSA key with key size less
+# than or equal to 1024 bits should be disabled, and
+# "RSA keySize < 1024, RSA keySize > 2048" indicates that any RSA key
+# with key size less than 1024 or greater than 2048 should be disabled.
+# This constraint is only used on algorithms that have a key size.
+#
+# CAConstraint:
+# jdkCA
+# This constraint prohibits the specified algorithm only if the
+# algorithm is used in a certificate chain that terminates at a marked
+# trust anchor in the lib/security/cacerts keystore. If the jdkCA
+# constraint is not set, then all chains using the specified algorithm
+# are restricted. jdkCA may only be used once in a DisabledAlgorithm
+# expression.
+# Example:  To apply this constraint to SHA-1 certificates, include
+# the following:  "SHA1 jdkCA"
+#
+# DenyAfterConstraint:
+# denyAfter YYYY-MM-DD
+# This constraint prohibits a certificate with the specified algorithm
+# from being used after the date regardless of the certificate's
+# validity.  JAR files that are signed and timestamped before the
+# constraint date with certificates containing the disabled algorithm
+# will not be restricted.  The date is processed in the UTC timezone.
+# This constraint can only be used once in a DisabledAlgorithm
+# expression.
+# Example: To deny usage of RSA 2048 bit certificates after Feb 3 2020,
+# use the following: "RSA keySize == 2048 & denyAfter 2020-02-03"
+#
+# UsageConstraint:
+# usage [TLSServer] [TLSClient] [SignedJAR]
+# This constraint prohibits the specified algorithm for
+# a specified usage. This should be used when disabling an algorithm
+# for all usages is not practical. 'TLSServer' restricts the algorithm
+# in TLS server certificate chains when server authentication is
+# performed. 'TLSClient' restricts the algorithm in TLS client
+# certificate chains when client authentication is performed.
+# 'SignedJAR' constrains use of certificates in signed jar files.
+# The usage type follows the keyword and more than one usage type can
+# be specified with a whitespace delimiter.
+# Example: "SHA1 usage TLSServer TLSClient"
+#
+# When an algorithm must satisfy more than one constraint, it must be
+# delimited by an ampersand '&'. For example, to restrict certificates in a
+# chain that terminate at a distribution provided trust anchor and contain
+# RSA keys that are less than or equal to 1024 bits, add the following
+# constraint: "RSA keySize <= 1024 & jdkCA".
+#
+# All DisabledAlgorithms expressions are processed in the order defined in the
+# property. This requires lower keysize constraints to be specified
+# before larger keysize constraints of the same algorithm. For example:
+# "RSA keySize < 1024 & jdkCA, RSA keySize < 2048".
+#
+# Note: The algorithm restrictions do not apply to trust anchors or
+# self-signed certificates.
+#
+# Note: This property is currently used by Oracle's PKIX implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+# Example:
+# jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048
+#
+#
+jdk.certpath.disabledAlgorithms=MD2, MD5, SHA1 jdkCA & usage TLSServer, \
+ RSA keySize < 1024, DSA keySize < 1024, EC keySize < 224
+
+#
+# Algorithm restrictions for signed JAR files
+#
+# In some environments, certain algorithms or key lengths may be undesirable
+# for signed JAR validation. For example, "MD2" is generally no longer
+# considered to be a secure hash algorithm. This section describes the
+# mechanism for disabling algorithms based on algorithm name and/or key length.
+# JARs signed with any of the disabled algorithms or key sizes will be treated
+# as unsigned.
+#
+# The syntax of the disabled algorithm string is described as follows:
+# DisabledAlgorithms:
+# " DisabledAlgorithm { , DisabledAlgorithm } "
+#
+# DisabledAlgorithm:
+# AlgorithmName [Constraint] { '&' Constraint }
+#
+# AlgorithmName:
+# (see below)
+#
+# Constraint:
+# KeySizeConstraint | DenyAfterConstraint
+#
+# KeySizeConstraint:
+# keySize Operator KeyLength
+#
+# DenyAfterConstraint:
+# denyAfter YYYY-MM-DD
+#
+# Operator:
+# <= | < | == | != | >= | >
+#
+# KeyLength:
+# Integer value of the algorithm's key length in bits
+#
+# Note: This property is currently used by the JDK Reference
+# implementation. It is not guaranteed to be examined and used by other
+# implementations.
+#
+# See "jdk.certpath.disabledAlgorithms" for syntax descriptions.
+#
+jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
+
+#
+# Algorithm restrictions for Secure Socket Layer/Transport Layer Security
+# (SSL/TLS) processing
+#
+# In some environments, certain algorithms or key lengths may be undesirable
+# when using SSL/TLS. This section describes the mechanism for disabling
+# algorithms during SSL/TLS security parameters negotiation, including
+# protocol version negotiation, cipher suites selection, peer authentication
+# and key exchange mechanisms.
+#
+# Disabled algorithms will not be negotiated for SSL/TLS connections, even
+# if they are enabled explicitly in an application.
+#
+# For PKI-based peer authentication and key exchange mechanisms, this list
+# of disabled algorithms will also be checked during certification path
+# building and validation, including algorithms used in certificates, as
+# well as revocation information such as CRLs and signed OCSP Responses.
+# This is in addition to the jdk.certpath.disabledAlgorithms property above.
+#
+# See the specification of "jdk.certpath.disabledAlgorithms" for the
+# syntax of the disabled algorithm string.
+#
+# Note: The algorithm restrictions do not apply to trust anchors or
+# self-signed certificates.
+#
+# Note: This property is currently used by the JDK Reference implementation.
+# It is not guaranteed to be examined and used by other implementations.
+#
+# Example:
+# jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
+jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768, \
+ EC keySize < 224
+
+# Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)
+# processing in JSSE implementation.
+#
+# In some environments, a certain algorithm may be undesirable but it
+# cannot be disabled because of its use in legacy applications. Legacy
+# algorithms may still be supported, but applications should not use them
+# as the security strength of legacy algorithms are usually not strong enough
+# in practice.
+#
+# During SSL/TLS security parameters negotiation, legacy algorithms will
+# not be negotiated unless there are no other candidates.
+#
+# The syntax of the legacy algorithms string is described as this Java
+# BNF-style:
+# LegacyAlgorithms:
+# " LegacyAlgorithm { , LegacyAlgorithm } "
+#
+# LegacyAlgorithm:
+# AlgorithmName (standard JSSE algorithm name)
+#
+# See the specification of security property "jdk.certpath.disabledAlgorithms"
+# for the syntax and description of the "AlgorithmName" notation.
+#
+# Per SSL/TLS specifications, cipher suites have the form:
+# SSL_KeyExchangeAlg_WITH_CipherAlg_MacAlg
+# or
+# TLS_KeyExchangeAlg_WITH_CipherAlg_MacAlg
+#
+# For example, the cipher suite TLS_RSA_WITH_AES_128_CBC_SHA uses RSA as the
+# key exchange algorithm, AES_128_CBC (128 bits AES cipher algorithm in CBC
+# mode) as the cipher (encryption) algorithm, and SHA-1 as the message digest
+# algorithm for HMAC.
+#
+# The LegacyAlgorithm can be one of the following standard algorithm names:
+# 1. JSSE cipher suite name, e.g., TLS_RSA_WITH_AES_128_CBC_SHA
+# 2. JSSE key exchange algorithm name, e.g., RSA
+# 3. JSSE cipher (encryption) algorithm name, e.g., AES_128_CBC
+# 4. JSSE message digest algorithm name, e.g., SHA
+#
+# See SSL/TLS specifications and "Java Cryptography Architecture Standard
+# Algorithm Name Documentation" for information about the algorithm names.
+#
+# Note: This property is currently used by the JDK Reference implementation.
+# It is not guaranteed to be examined and used by other implementations.
+# There is no guarantee the property will continue to exist or be of the
+# same syntax in future releases.
+#
+# Example:
+# jdk.tls.legacyAlgorithms=DH_anon, DES_CBC, SSL_RSA_WITH_RC4_128_MD5
+#
+jdk.tls.legacyAlgorithms= \
+ K_NULL, C_NULL, M_NULL, \
+ DHE_DSS_EXPORT, DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, \
+ DH_RSA_EXPORT, RSA_EXPORT, \
+ DH_anon, ECDH_anon, \
+ RC4_128, RC4_40, DES_CBC, DES40_CBC, \
+ 3DES_EDE_CBC
+
+# The pre-defined default finite field Diffie-Hellman ephemeral (DHE)
+# parameters for Transport Layer Security (SSL/TLS/DTLS) processing.
+#
+# In traditional SSL/TLS/DTLS connections where finite field DHE parameters
+# negotiation mechanism is not used, the server offers the client group
+# parameters, base generator g and prime modulus p, for DHE key exchange.
+# It is recommended to use dynamic group parameters. This property defines
+# a mechanism that allows you to specify custom group parameters.
+#
+# The syntax of this property string is described as this Java BNF-style:
+# DefaultDHEParameters:
+# DefinedDHEParameters { , DefinedDHEParameters }
+#
+# DefinedDHEParameters:
+# "{" DHEPrimeModulus , DHEBaseGenerator "}"
+#
+# DHEPrimeModulus:
+# HexadecimalDigits
+#
+# DHEBaseGenerator:
+# HexadecimalDigits
+#
+# HexadecimalDigits:
+# HexadecimalDigit { HexadecimalDigit }
+#
+# HexadecimalDigit: one of
+# 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
+#
+# Whitespace characters are ignored.
+#
+# The "DefinedDHEParameters" defines the custom group parameters, prime
+# modulus p and base generator g, for a particular size of prime modulus p.
+# The "DHEPrimeModulus" defines the hexadecimal prime modulus p, and the
+# "DHEBaseGenerator" defines the hexadecimal base generator g of a group
+# parameter. It is recommended to use safe primes for the custom group
+# parameters.
+#
+# If this property is not defined or the value is empty, the underlying JSSE
+# provider's default group parameter is used for each connection.
+#
+# If the property value does not follow the grammar, or a particular group
+# parameter is not valid, the connection will fall back and use the
+# underlying JSSE provider's default group parameter.
+#
+# Note: This property is currently used by OpenJDK's JSSE implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+# Example:
+# jdk.tls.server.defaultDHEParameters=
+# { \
+# FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 \
+# 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD \
+# EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 \
+# E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
+# EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
+# FFFFFFFF FFFFFFFF, 2}
+
+# Cryptographic Jurisdiction Policy defaults
+#
+# Import and export control rules on cryptographic software vary from
+# country to country. By default, the JDK provides two different sets of
+# cryptographic policy files:
+#
+# unlimited: These policy files contain no restrictions on cryptographic
+# strengths or algorithms.
+#
+# limited: These policy files contain more restricted cryptographic
+# strengths, and are still available if your country or
+# usage requires the traditional restrictive policy.
+#
+# The JDK JCE framework uses the unlimited policy files by default.
+# However the user may explicitly choose a set either by defining the
+# "crypto.policy" Security property or by installing valid JCE policy
+# jar files into the traditional JDK installation location. To better
+# support older JDK Update releases, the "crypto.policy" property is not
+# defined by default. See below for more information.
+#
+# The following logic determines which policy files are used:
+#
+# <java-home> refers to the directory where the JRE was
+# installed and may be determined using the "java.home"
+# System property.
+#
+# 1. If the Security property "crypto.policy" has been defined,
+# then the following mechanism is used:
+#
+# The policy files are stored as jar files in subdirectories of
+# <java-home>/lib/security/policy. Each directory contains a complete
+# set of policy files.
+#
+# The "crypto.policy" Security property controls the directory
+# selection, and thus the effective cryptographic policy.
+#
+# The default set of directories is:
+#
+# limited | unlimited
+#
+# 2. If the "crypto.policy" property is not set and the traditional
+# US_export_policy.jar and local_policy.jar files
+# (e.g. limited/unlimited) are found in the legacy
+# <java-home>/lib/security directory, then the rules embedded within
+# those jar files will be used. This helps preserve compatibility
+# for users upgrading from an older installation.
+#
+# 3. If the jar files are not present in the legacy location
+# and the "crypto.policy" Security property is not defined,
+# then the JDK will use the unlimited settings (equivalent to
+# crypto.policy=unlimited)
+#
+# Please see the JCA documentation for additional information on these
+# files and formats.
+#
+# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
+# TO DETERMINE THE EXACT REQUIREMENTS.
+#
+# Please note that the JCE for Java SE, including the JCE framework,
+# cryptographic policy files, and standard JCE providers provided with
+# the Java SE, have been reviewed and approved for export as mass market
+# encryption item by the US Bureau of Industry and Security.
+#
+# Note: This property is currently used by the JDK Reference implementation.
+# It is not guaranteed to be examined and used by other implementations.
+#
+#crypto.policy=unlimited
+
+#
+# The policy for the XML Signature secure validation mode. The mode is
+# enabled by setting the property "org.jcp.xml.dsig.secureValidation" to
+# true with the javax.xml.crypto.XMLCryptoContext.setProperty() method,
+# or by running the code with a SecurityManager.
+#
+# Policy:
+# Constraint {"," Constraint }
+# Constraint:
+# AlgConstraint | MaxTransformsConstraint | MaxReferencesConstraint |
+# ReferenceUriSchemeConstraint | KeySizeConstraint | OtherConstraint
+# AlgConstraint
+# "disallowAlg" Uri
+# MaxTransformsConstraint:
+# "maxTransforms" Integer
+# MaxReferencesConstraint:
+# "maxReferences" Integer
+# ReferenceUriSchemeConstraint:
+# "disallowReferenceUriSchemes" String { String }
+# KeySizeConstraint:
+# "minKeySize" KeyAlg Integer
+# OtherConstraint:
+# "noDuplicateIds" | "noRetrievalMethodLoops"
+#
+# For AlgConstraint, Uri is the algorithm URI String that is not allowed.
+# See the XML Signature Recommendation for more information on algorithm
+# URI Identifiers. For KeySizeConstraint, KeyAlg is the standard algorithm
+# name of the key type (ex: "RSA"). If the MaxTransformsConstraint,
+# MaxReferencesConstraint or KeySizeConstraint (for the same key type) is
+# specified more than once, only the last entry is enforced.
+#
+# Note: This property is currently used by the JDK Reference implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+jdk.xml.dsig.secureValidationPolicy=\
+ disallowAlg http://www.w3.org/TR/1999/REC-xslt-19991116,\
+ disallowAlg http://www.w3.org/2001/04/xmldsig-more#rsa-md5,\
+ disallowAlg http://www.w3.org/2001/04/xmldsig-more#hmac-md5,\
+ disallowAlg http://www.w3.org/2001/04/xmldsig-more#md5,\
+ maxTransforms 5,\
+ maxReferences 30,\
+ disallowReferenceUriSchemes file http https,\
+ minKeySize RSA 1024,\
+ minKeySize DSA 1024,\
+ noDuplicateIds,\
+ noRetrievalMethodLoops
+
+#
+# Serialization process-wide filter
+#
+# A filter, if configured, is used by java.io.ObjectInputStream during
+# deserialization to check the contents of the stream.
+# A filter is configured as a sequence of patterns, each pattern is either
+# matched against the name of a class in the stream or defines a limit.
+# Patterns are separated by ";" (semicolon).
+# Whitespace is significant and is considered part of the pattern.
+#
+# If a pattern includes a "=", it sets a limit.
+# If a limit appears more than once the last value is used.
+# Limits are checked before classes regardless of the order in the sequence of patterns.
+# If any of the limits are exceeded, the filter status is REJECTED.
+#
+# maxdepth=value - the maximum depth of a graph
+# maxrefs=value - the maximum number of internal references
+# maxbytes=value - the maximum number of bytes in the input stream
+# maxarray=value - the maximum array length allowed
+#
+# Other patterns, from left to right, match the class or package name as
+# returned from Class.getName.
+# If the class is an array type, the class or package to be matched is the element type.
+# Arrays of any number of dimensions are treated the same as the element type.
+# For example, a pattern of "!example.Foo", rejects creation of any instance or
+# array of example.Foo.
+#
+# If the pattern starts with "!", the status is REJECTED if the remaining pattern
+# is matched; otherwise the status is ALLOWED if the pattern matches.
+# If the pattern ends with ".**" it matches any class in the package and all subpackages.
+# If the pattern ends with ".*" it matches any class in the package.
+# If the pattern ends with "*", it matches any class with the pattern as a prefix.
+# If the pattern is equal to the class name, it matches.
+# Otherwise, the status is UNDECIDED.
+#
+#jdk.serialFilter=pattern;pattern
+
+#
+# RMI Registry Serial Filter
+#
+# The filter pattern uses the same format as jdk.serialFilter.
+# This filter can override the builtin filter if additional types need to be
+# allowed or rejected from the RMI Registry.
+#
+#sun.rmi.registry.registryFilter=pattern;pattern
+
+#
+# RMI Distributed Garbage Collector (DGC) Serial Filter
+#
+# The filter pattern uses the same format as jdk.serialFilter.
+# This filter can override the builtin filter if additional types need to be
+# allowed or rejected from the RMI DGC.
+#
+# The builtin DGC filter can approximately be represented as the filter pattern:
+#
+#sun.rmi.transport.dgcFilter=\
+# java.rmi.server.ObjID;\
+# java.rmi.server.UID;\
+# java.rmi.dgc.VMID;\
+# java.rmi.dgc.Lease;\
+# maxdepth=5;maxarray=10000
diff --git a/staging/darwin-x86/jre/lib/security/policy/limited/US_export_policy.jar b/staging/darwin-x86/jre/lib/security/policy/limited/US_export_policy.jar
new file mode 100644
index 0000000..dccc6ac
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/policy/limited/US_export_policy.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/security/policy/limited/local_policy.jar b/staging/darwin-x86/jre/lib/security/policy/limited/local_policy.jar
new file mode 100644
index 0000000..bf05a73
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/policy/limited/local_policy.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/security/policy/unlimited/US_export_policy.jar b/staging/darwin-x86/jre/lib/security/policy/unlimited/US_export_policy.jar
new file mode 100644
index 0000000..dccc6ac
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/policy/unlimited/US_export_policy.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/security/policy/unlimited/local_policy.jar b/staging/darwin-x86/jre/lib/security/policy/unlimited/local_policy.jar
new file mode 100644
index 0000000..e1358fd
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/security/policy/unlimited/local_policy.jar
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/server/Xusage.txt b/staging/darwin-x86/jre/lib/server/Xusage.txt
new file mode 100644
index 0000000..d24ada9
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/server/Xusage.txt
@@ -0,0 +1,24 @@
+ -Xmixed mixed mode execution (default)
+ -Xint interpreted mode execution only
+ -Xbootclasspath:<directories and zip/jar files separated by :>
+ set search path for bootstrap classes and resources
+ -Xbootclasspath/a:<directories and zip/jar files separated by :>
+ append to end of bootstrap class path
+ -Xbootclasspath/p:<directories and zip/jar files separated by :>
+ prepend in front of bootstrap class path
+ -Xnoclassgc disable class garbage collection
+ -Xincgc enable incremental garbage collection
+ -Xloggc:<file> log GC status to a file with time stamps
+ -Xbatch disable background compilation
+ -Xms<size> set initial Java heap size
+ -Xmx<size> set maximum Java heap size
+ -Xss<size> set java thread stack size
+ -Xprof output cpu profiling data
+ -Xfuture enable strictest checks, anticipating future default
+ -Xrs reduce use of OS signals by Java/VM (see documentation)
+ -Xcheck:jni perform additional checks for JNI functions
+ -Xshare:off do not attempt to use shared class data
+ -Xshare:auto use shared class data if possible (default)
+ -Xshare:on require using shared class data, otherwise fail.
+
+The -X options are non-standard and subject to change without notice.
diff --git a/staging/darwin-x86/jre/lib/server/libjsig.dylib b/staging/darwin-x86/jre/lib/server/libjsig.dylib
new file mode 100755
index 0000000..4e3633c
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/server/libjsig.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/server/libjvm.dylib b/staging/darwin-x86/jre/lib/server/libjvm.dylib
new file mode 100755
index 0000000..03fc9e4
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/server/libjvm.dylib
Binary files differ
diff --git a/staging/darwin-x86/jre/lib/sound.properties b/staging/darwin-x86/jre/lib/sound.properties
new file mode 100644
index 0000000..68309d1
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/sound.properties
@@ -0,0 +1,39 @@
+############################################################
+# Sound Configuration File
+############################################################
+#
+# This properties file is used to specify default service
+# providers for javax.sound.midi.MidiSystem and
+# javax.sound.sampled.AudioSystem.
+#
+# The following keys are recognized by MidiSystem methods:
+#
+# javax.sound.midi.Receiver
+# javax.sound.midi.Sequencer
+# javax.sound.midi.Synthesizer
+# javax.sound.midi.Transmitter
+#
+# The following keys are recognized by AudioSystem methods:
+#
+# javax.sound.sampled.Clip
+# javax.sound.sampled.Port
+# javax.sound.sampled.SourceDataLine
+# javax.sound.sampled.TargetDataLine
+#
+# The values specify the full class name of the service
+# provider, or the device name.
+#
+# See the class descriptions for details.
+#
+# Example 1:
+# Use MyDeviceProvider as default for SourceDataLines:
+# javax.sound.sampled.SourceDataLine=com.xyz.MyDeviceProvider
+#
+# Example 2:
+# Specify the default Synthesizer by its name "InternalSynth".
+# javax.sound.midi.Synthesizer=#InternalSynth
+#
+# Example 3:
+# Specify the default Receiver by provider and name:
+# javax.sound.midi.Receiver=com.sun.media.sound.MidiProvider#SunMIDI1
+#
diff --git a/staging/darwin-x86/jre/lib/tzdb.dat b/staging/darwin-x86/jre/lib/tzdb.dat
new file mode 100644
index 0000000..d3a8c65
--- /dev/null
+++ b/staging/darwin-x86/jre/lib/tzdb.dat
Binary files differ
diff --git a/staging/darwin-x86/lib/ct.sym b/staging/darwin-x86/lib/ct.sym
new file mode 100644
index 0000000..7791820
--- /dev/null
+++ b/staging/darwin-x86/lib/ct.sym
Binary files differ
diff --git a/staging/darwin-x86/lib/dt.jar b/staging/darwin-x86/lib/dt.jar
new file mode 100644
index 0000000..7cc89d4
--- /dev/null
+++ b/staging/darwin-x86/lib/dt.jar
Binary files differ
diff --git a/staging/darwin-x86/lib/ir.idl b/staging/darwin-x86/lib/ir.idl
new file mode 100644
index 0000000..921a7cf
--- /dev/null
+++ b/staging/darwin-x86/lib/ir.idl
@@ -0,0 +1,778 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file contains OMG IDL from CORBA V2.0, July 1995.
+ * It also contains the TypeCode creation APIs in CORBA::ORB
+ **/
+
+#pragma prefix "omg.org"
+
+module CORBA {
+ typedef string Identifier;
+ typedef string ScopedName;
+ typedef string RepositoryId;
+
+ enum DefinitionKind {
+ dk_none, dk_all,
+ dk_Attribute, dk_Constant, dk_Exception, dk_Interface,
+ dk_Module, dk_Operation, dk_Typedef,
+ dk_Alias, dk_Struct, dk_Union, dk_Enum,
+ dk_Primitive, dk_String, dk_Sequence, dk_Array,
+ dk_Repository,
+ dk_Wstring, dk_Fixed,
+ dk_Value, dk_ValueBox, dk_ValueMember, // orbos 98-01-18: Objects By Value
+ dk_Native
+ };
+
+
+ interface IRObject
+ /**
+ An IRObject IDL interface represents the most generic interface
+ from which all other Interface Repository interfaces are derived,
+ even the Repository itself.
+ */
+ {
+ // read interface
+ readonly attribute DefinitionKind def_kind;
+
+ // write interface
+ void destroy ();
+ };
+
+
+
+ typedef string VersionSpec;
+
+ interface Contained;
+ interface Repository;
+ interface Container;
+
+ interface Contained : IRObject
+ /**
+ The Contained Interface is inherited by all Interface Repository
+ interfaces that are contained by other objects.
+ */
+ {
+ // read/write interface
+
+ attribute RepositoryId id;
+ attribute Identifier name;
+ attribute VersionSpec version;
+
+ // read interface
+
+ readonly attribute Container defined_in;
+ readonly attribute ScopedName absolute_name;
+ readonly attribute Repository containing_repository;
+
+ struct Description {
+ DefinitionKind kind;
+ any value;
+ };
+
+ Description describe ();
+
+ // write interface
+
+ void move (
+ in Container new_container,
+ in Identifier new_name,
+ in VersionSpec new_version
+ );
+ };
+
+
+ interface ModuleDef;
+ interface ConstantDef;
+ interface IDLType;
+ interface StructDef;
+ interface UnionDef;
+ interface EnumDef;
+ interface AliasDef;
+ interface InterfaceDef;
+ interface ExceptionDef;
+ interface ValueDef; // orbos 98-01-18: Objects By Value
+ interface ValueMemberDef; // orbos 98-01-18: Objects By Value
+ interface ValueBoxDef; // orbos 98-01-18: Objects By Value
+ interface NativeDef;
+
+
+ typedef sequence <InterfaceDef> InterfaceDefSeq;
+
+
+ typedef sequence <Contained> ContainedSeq;
+
+ struct StructMember {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <StructMember> StructMemberSeq;
+
+ struct UnionMember {
+ Identifier name;
+ any label;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <UnionMember> UnionMemberSeq;
+
+
+ typedef sequence <Identifier> EnumMemberSeq;
+
+ // orbos 98-01-18: Objects By Value -- begin
+ typedef short Visibility;
+ const Visibility PRIVATE_MEMBER = 0;
+ const Visibility PUBLIC_MEMBER = 1;
+
+ struct ValueMember {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ IDLType type_def;
+ Visibility access;
+ };
+ typedef sequence <ValueMember> ValueMemberSeq;
+
+ struct Initializer {
+ StructMemberSeq members;
+ };
+ typedef sequence <Initializer> InitializerSeq;
+
+ typedef sequence <ValueDef> ValueDefSeq;
+
+ // orbos 98-01-18: Objects By Value -- end
+
+
+ interface Container : IRObject
+ /**
+ The Container interface is used to form a containment hierarchy
+ in the Interface Repository. A Container can contain any number
+ of objects derived from the Contained interface.
+ */
+ {
+ // read interface
+
+ Contained lookup ( in ScopedName search_name);
+
+ ContainedSeq contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ ContainedSeq lookup_name (
+ in Identifier search_name,
+ in long levels_to_search,
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ struct Description {
+ Contained contained_object;
+ DefinitionKind kind;
+ any value;
+ };
+
+ typedef sequence<Description> DescriptionSeq;
+
+ DescriptionSeq describe_contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited,
+ in long max_returned_objs
+ );
+
+ // write interface
+
+ ModuleDef create_module (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ ConstantDef create_constant (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in any value
+ );
+
+ StructDef create_struct (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+ UnionDef create_union (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType discriminator_type,
+ in UnionMemberSeq members
+ );
+
+ EnumDef create_enum (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EnumMemberSeq members
+ );
+
+ AliasDef create_alias (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type
+ );
+
+ ExceptionDef create_exception (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+
+ InterfaceDef create_interface (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_abstract,
+ in InterfaceDefSeq base_interfaces
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueDef create_value(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_custom,
+ in boolean is_abstract,
+ in octet flags, // must be 0
+ in ValueDef base_value,
+ in boolean has_safe_base,
+ in ValueDefSeq abstract_base_values,
+ in InterfaceDefSeq supported_interfaces,
+ in InitializerSeq initializers
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueBoxDef create_value_box(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type_def
+ );
+
+ NativeDef create_native(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ };
+
+
+
+ interface IDLType : IRObject
+ /**
+ The IDLType interface is an abstract interface inherited by all
+ IR objects that represent the OMG IDL types. It provides access
+ to the TypeCode describing the type, and is used in defining the
+ other interfaces wherever definitions of IDLType must be referenced.
+ */
+ {
+ readonly attribute TypeCode type;
+ };
+
+
+
+ interface PrimitiveDef;
+ interface StringDef;
+ interface SequenceDef;
+ interface ArrayDef;
+
+ enum PrimitiveKind {
+ pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong,
+ pk_float, pk_double, pk_boolean, pk_char, pk_octet,
+ pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref
+ };
+
+ interface Repository : Container
+ /**
+ Repository is an interface that provides global access to the
+ Interface Repository. Repository objects can contain constants,
+ typedefs, exceptions, interfaces, and modules.
+ */
+ {
+ // read interface
+
+ Contained lookup_id (in RepositoryId search_id);
+
+ PrimitiveDef get_primitive (in PrimitiveKind kind);
+
+ // write interface
+
+ StringDef create_string (in unsigned long bound);
+
+ SequenceDef create_sequence (
+ in unsigned long bound,
+ in IDLType element_type
+ );
+
+ ArrayDef create_array (
+ in unsigned long length,
+ in IDLType element_type
+ );
+ };
+
+
+ interface ModuleDef : Container, Contained
+ /**
+ A ModuleDef can contain constants, typedefs, exceptions, interfaces,
+ and other module objects.
+ */
+ {
+ };
+
+ struct ModuleDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ };
+
+
+ interface ConstantDef : Contained
+ /**
+ A ConstantDef object defines a named constant.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute any value;
+ };
+
+ struct ConstantDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ any value;
+ };
+
+
+ interface TypedefDef : Contained, IDLType
+ /**
+ TypedefDef is an abstract interface used as a base interface for
+ all named non-object types(structures, unions, enumerations,
+ aliases). The TypedefDef interface is not inherited by the definition
+ objects for the primitive or anonymous types.
+ */
+ {
+ };
+
+ struct TypeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+ interface StructDef : TypedefDef, Container
+ /**
+ A StructDef represents an OMG IDL structure definition.
+ */
+ {
+ attribute StructMemberSeq members;
+ };
+
+
+ interface UnionDef : TypedefDef, Container
+ /**
+ A UnionDef represents an OMG IDL union definition.
+ */
+ {
+ readonly attribute TypeCode discriminator_type;
+ attribute IDLType discriminator_type_def;
+ attribute UnionMemberSeq members;
+ };
+
+
+ interface EnumDef : TypedefDef
+ /**
+ A EnumDef represents an OMG IDL enum definition.
+ */
+ {
+ attribute EnumMemberSeq members;
+ };
+
+
+ interface AliasDef : TypedefDef
+ /**
+ An AliasDef represents an OMG IDL typedef that aliases other
+ definition.
+ */
+ {
+ attribute IDLType original_type_def;
+ };
+
+
+ interface PrimitiveDef: IDLType
+ /**
+ A PrimitiveDef represents one of the IDL primitive types. As
+ primitive types are unnamed, this interface is not derived from
+ TypedefDef or Contained.
+ */
+ {
+ readonly attribute PrimitiveKind kind;
+ };
+
+
+ interface StringDef : IDLType
+ /**
+ A StringDef represents an OMG IDL string type. As string
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ };
+
+
+ interface SequenceDef : IDLType
+ /**
+ A SequenceDef represents an OMG IDL sequence type. As sequence
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+ interface ArrayDef : IDLType
+ /**
+ An ArrayDef represents an OMG IDL array type. As array
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long length;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+
+ interface ExceptionDef : Contained, Container
+ /**
+ An ExceptionDef represents an exception definition.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute StructMemberSeq members;
+ };
+ struct ExceptionDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+
+ enum AttributeMode {ATTR_NORMAL, ATTR_READONLY};
+
+ interface AttributeDef : Contained
+ /**
+ An AttributeDef represents the information that defines an
+ attribute of an interface.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute AttributeMode mode;
+ };
+
+ struct AttributeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ AttributeMode mode;
+ };
+
+
+
+ enum OperationMode {OP_NORMAL, OP_ONEWAY};
+
+ enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT};
+ struct ParameterDescription {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ ParameterMode mode;
+ };
+ typedef sequence <ParameterDescription> ParDescriptionSeq;
+
+ typedef Identifier ContextIdentifier;
+ typedef sequence <ContextIdentifier> ContextIdSeq;
+
+ typedef sequence <ExceptionDef> ExceptionDefSeq;
+ typedef sequence <ExceptionDescription> ExcDescriptionSeq;
+
+ interface OperationDef : Contained
+ /**
+ An OperationDef represents the information that defines an
+ operation of an interface.
+ */
+ {
+ readonly attribute TypeCode result;
+ attribute IDLType result_def;
+ attribute ParDescriptionSeq params;
+ attribute OperationMode mode;
+ attribute ContextIdSeq contexts;
+ attribute ExceptionDefSeq exceptions;
+ };
+
+ struct OperationDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode result;
+ OperationMode mode;
+ ContextIdSeq contexts;
+ ParDescriptionSeq parameters;
+ ExcDescriptionSeq exceptions;
+ };
+
+
+
+ typedef sequence <RepositoryId> RepositoryIdSeq;
+ typedef sequence <OperationDescription> OpDescriptionSeq;
+ typedef sequence <AttributeDescription> AttrDescriptionSeq;
+
+ interface InterfaceDef : Container, Contained, IDLType
+ /**
+ An InterfaceDef object represents an interface definition. It can
+ contains constants, typedefs, exceptions, operations, and
+ attributes.
+ */
+ {
+ // read/write interface
+
+ attribute InterfaceDefSeq base_interfaces;
+ attribute boolean is_abstract;
+
+ // read interface
+
+ boolean is_a (in RepositoryId interface_id);
+
+ struct FullInterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ boolean is_abstract;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ RepositoryIdSeq base_interfaces;
+ TypeCode type;
+ };
+
+ FullInterfaceDescription describe_interface();
+
+ // write interface
+
+ AttributeDef create_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+
+ struct InterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq base_interfaces;
+ };
+
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+ interface ValueMemberDef : Contained
+
+ /** A <code>ValueMemberDef</code> object represents the public
+ and private data member definition of a <code>Value</code> type
+ */
+
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute Visibility access;
+ };
+
+ interface ValueDef : Container, Contained, IDLType
+ /**
+ A ValueDef object represents the definition of the
+ <code>Value</code> object used to pass the object state
+ between hosts
+ */
+
+ {
+ // read/write interface
+ attribute InterfaceDefSeq supported_interfaces;
+ attribute InitializerSeq initializers;
+ attribute ValueDef base_value;
+ attribute ValueDefSeq abstract_base_values;
+ attribute boolean is_abstract;
+ attribute boolean is_custom;
+ attribute octet flags; // always 0
+ attribute boolean has_safe_base;
+
+ // read interface
+ boolean is_a(in RepositoryId value_id);
+
+ struct FullValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ ValueMemberSeq members;
+ InitializerSeq initializers;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ TypeCode type;
+ };
+
+ FullValueDescription describe_value();
+
+ // write interface
+
+ ValueMemberDef create_value_member(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type_def,
+ in Visibility access
+ );
+
+ AttributeDef create_attribute(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+ struct ValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ };
+
+ interface ValueBoxDef : IDLType
+
+ /** ValueBoxDef is an interface that reresents a value type with
+ a single data member inside its state section and no
+ inheritance or methods. For example, when transmitting a
+ string or sequence as an actual parameter on an interface
+ operation or as a data member of a value type that is an
+ actual parameter, it may be important to preserve any sharing
+ of the string or sequence within the object graph being
+ transmitted. Because current IDL data types do not preserve
+ referential integrity in this way, this requirement is
+ conveniently handled by using a value type. Value types also
+ support the transmission of nulls (as a distinguished value),
+ whereas IDL data types such as string and sequence (which are
+ mapped to empty strings and sequences) do not. The Java to IDL
+ mapping requires both preservation of referential integrity
+ and transmission of nulls. Because it would be cumbersome to
+ require the full IDL syntax for a value type for this specific
+ usage, this shorthand notation is introduced to cover this use
+ of value types for simple containment of a single data member.
+ */
+
+{
+ attribute IDLType original_type_def;
+ };
+
+ // orbos 98-01-18: Objects By Value -- end
+
+ interface NativeDef : TypedefDef {
+ };
+};
diff --git a/staging/darwin-x86/lib/jconsole.jar b/staging/darwin-x86/lib/jconsole.jar
new file mode 100644
index 0000000..c301a7e
--- /dev/null
+++ b/staging/darwin-x86/lib/jconsole.jar
Binary files differ
diff --git a/staging/darwin-x86/lib/orb.idl b/staging/darwin-x86/lib/orb.idl
new file mode 100644
index 0000000..81ed1af
--- /dev/null
+++ b/staging/darwin-x86/lib/orb.idl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// IDL not generated by rmic, do not edit
+// These are all in IDL module CORBA
+// The Java classes are in the package org.omg.CORBA
+// See ValueType Semantics:Standard Value Box Definitions (5.3) in CORBA 2.3 spec
+
+#ifndef __org_omg_CORBA__
+#define __org_omg_CORBA__
+
+#pragma prefix "omg.org"
+
+module CORBA{
+
+ valuetype StringValue string;
+ valuetype WStringValue wstring;
+
+};
+
+#include "ir.idl"
+
+#pragma prefix ""
+
+#endif
diff --git a/staging/darwin-x86/lib/sa-jdi.jar b/staging/darwin-x86/lib/sa-jdi.jar
new file mode 100644
index 0000000..e91c217
--- /dev/null
+++ b/staging/darwin-x86/lib/sa-jdi.jar
Binary files differ
diff --git a/staging/darwin-x86/lib/tools.jar b/staging/darwin-x86/lib/tools.jar
new file mode 100644
index 0000000..e45b586
--- /dev/null
+++ b/staging/darwin-x86/lib/tools.jar
Binary files differ
diff --git a/staging/darwin-x86/release b/staging/darwin-x86/release
new file mode 100644
index 0000000..3d26269
--- /dev/null
+++ b/staging/darwin-x86/release
@@ -0,0 +1,5 @@
+JAVA_VERSION="1.8.0_152"
+OS_NAME="Darwin"
+OS_VERSION="11.2"
+OS_ARCH="x86_64"
+SOURCE=""
diff --git a/staging/darwin-x86/sample/README b/staging/darwin-x86/sample/README
new file mode 100644
index 0000000..ae56b64
--- /dev/null
+++ b/staging/darwin-x86/sample/README
@@ -0,0 +1,6 @@
+The source code provided with samples and demos for the JDK is meant
+to illustrate the usage of a given feature or technique and has been
+deliberately simplified. Additional steps required for a
+production-quality application, such as security checks, input
+validation, and proper error handling, might not be present in the
+sample code.
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java
new file mode 100644
index 0000000..f4fd2c5
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java
@@ -0,0 +1,66 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * Represents the device configuration. The values are loaded from an XML file by JAXB.
+ */
+@XmlRootElement
+public class Device {
+
+ @XmlElement()
+ private Map<Module, Integer> supportedModules = new EnumMap<>(Module.class);
+
+ /**
+ * Returns map of supported modules. The map key is module. The map value is version.
+ *
+ * @return map of supported modules.
+ */
+ public Map<Module, Integer> getSupportedModules() {
+ return Collections.unmodifiableMap(supportedModules);
+ }
+}
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml
new file mode 100644
index 0000000..2e0357d
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+
+
+
+ This source code is provided to illustrate the usage of a given feature
+ or technique and has been deliberately simplified. Additional steps
+ required for a production-quality application, such as security checks,
+ input validation and proper error handling, might not be present in
+ this sample code.
+
+ -->
+
+<device>
+ <supportedModules>
+ <entry>
+ <key>DISPLAY</key>
+ <value>2</value>
+ </entry>
+ <entry>
+ <key>THERMOMETER</key>
+ <value>1</value>
+ </entry>
+ <entry>
+ <key>CLOCK</key>
+ <value>4</value>
+ </entry>
+ </supportedModules>
+</device> \ No newline at end of file
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java
new file mode 100644
index 0000000..2b97b4e
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java
@@ -0,0 +1,49 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * Represents available modules.
+ */
+public enum Module {
+
+ DISPLAY, CLOCK, THERMOMETER, HEATER, SPEAKER, GSM, LED;
+}
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java
new file mode 100644
index 0000000..6db5bae
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package checker;
+
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.xml.bind.JAXBContext;
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.bind.JAXBException;
+
+/**
+ * Reads the device configuration from the XML file specified by -Adevice=device.xml.
+ * For each class in a project, checks required modules. If the device doesn't have
+ * the required module, then a compilation error will be shown.
+ */
+@SupportedAnnotationTypes("checker.RequireContainer")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class PluginChecker extends javax.annotation.processing.AbstractProcessor {
+
+ /**
+ * Name of the option to get the path to the xml with device configuration.
+ */
+ public static final String DEVICE_OPTION = "device";
+ private Device device;
+
+ /**
+ * Only the device option is supported.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getSupportedOptions() {
+ return new HashSet<>(Arrays.asList(DEVICE_OPTION));
+ }
+
+ /**
+ * Initializes the processor by loading the device configuration.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ try {
+ String deviceOption = processingEnv.getOptions().get(DEVICE_OPTION);
+ device = (Device) JAXBContext.newInstance(Device.class)
+ .createUnmarshaller().unmarshal(new File(deviceOption));
+ } catch (JAXBException e) {
+ throw new RuntimeException(
+ "Please specify device by -Adevice=device.xml\n"
+ + e.toString(), e);
+ }
+ }
+
+ /**
+ * Processes @Require annotations and checks that Device meets requirements.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment roundEnv) {
+ for (Element el : roundEnv.getElementsAnnotatedWith(RequireContainer.class)) {
+ for (Require req : el.getAnnotationsByType(Require.class)) {
+ //for every Require annotation checks if device has module of required version.
+ Integer version = device.getSupportedModules().get(req.value());
+
+ if (version == null
+ || version < req.minVersion()
+ || version > req.maxVersion()) {
+ //if module is optional then show only warning not error
+ if (req.optional()) {
+ processingEnv.getMessager()
+ .printMessage(Diagnostic.Kind.WARNING,
+ "Plugin [" + el + "] requires " + req
+ + "\n but device " + (version == null
+ ? "doesn't have such module."
+ + " This module is optional."
+ + " So plugin will work but miss"
+ + " some functionality"
+ : "has " + version
+ + " version of that module"));
+ } else {
+ processingEnv.getMessager()
+ .printMessage(Diagnostic.Kind.ERROR,
+ "Plugin [" + el + "] requires " + req
+ + "\n but device "
+ + (version == null
+ ? "doesn't have such module"
+ : "has " + version
+ + " version of that module"));
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java
new file mode 100644
index 0000000..6681c28
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package checker;
+
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates that a plug-in depends on a module.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Repeatable(RequireContainer.class)
+public @interface Require {
+
+ /**
+ * Returns the required module.
+ *
+ * @return required module.
+ */
+ Module value();
+
+ /**
+ * Returns the minimum supported version of a module.
+ *
+ * @return minimum supported version of a module.
+ */
+ int minVersion() default 1;
+
+ /**
+ * Returns the maximum supported version of a module.
+ *
+ * @return maximum supported version of a module.
+ */
+ int maxVersion() default Integer.MAX_VALUE;
+
+ /**
+ * Returns true if a module is optional. A module is optional if a system
+ * works without that module but is missing some functionality. Returns false if a system
+ * won't work without the specified module.
+ *
+ * @return true if module is optional. False otherwise.
+ */
+ boolean optional() default false;
+}
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java
new file mode 100644
index 0000000..d18e0d5
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java
@@ -0,0 +1,51 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * A container for the repeatable @Require annotation.
+ */
+@Retention(RetentionPolicy.CLASS)
+public @interface RequireContainer {
+
+ Require[] value();
+}
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java b/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java
new file mode 100644
index 0000000..3a9d842
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+
+/**
+ * BoilerPlugin provides support for boiling water and keeping water warm.
+ */
+@Require(value = Module.CLOCK, maxVersion = 3)
+@Require(value = Module.THERMOMETER)
+@Require(value = Module.HEATER)
+@Require(value = Module.LED, optional = true) //will use if present
+public class BoilerPlugin {
+
+ /**
+ * Heats water up to 100 degrees Celsius.
+ */
+ public void boil() {
+ boil(100);
+ }
+
+ /**
+ * Heats water up to temperature.
+ *
+ * @param temperature - desired temperature of the water in the boiler
+ */
+ public void boil(int temperature) {
+ /*
+ * Turn on heater and wait while temperature reaches desired temperature
+ * in Celsius. Finally, turn off heater.
+ * If present, the LED light changes color according to the temperature.
+ */
+ }
+
+ /**
+ * Keeps desired temperature.
+ *
+ * @param temperature - desired temperature of the water in the boiler
+ * @param seconds - period of time for checking temperature in seconds
+ */
+ public void keepWarm(int temperature, int seconds) {
+ //Every n seconds check temperature and warm up, if necessary.
+ }
+
+}
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java b/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java
new file mode 100644
index 0000000..b7be610
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+import java.util.Calendar;
+
+/**
+ * Introduces new features for BoilerPlugin. Features are boiling water by an
+ * SMS and boiling water by date with notification by a phone call.
+ */
+@Require(value = Module.SPEAKER)
+@Require(value = Module.GSM, minVersion = 3)
+@Require(value = Module.DISPLAY)
+public class ExtendedBoilerPlugin extends BoilerPlugin {
+
+ /**
+ * Boils water at the appointed time and wakes you up by a ring and phone
+ * call. Shows "Good morning" and a quote of the day from the Internet on the
+ * display.
+ *
+ * @param calendar - date and time when water should be boiled
+ * @param phoneNumber - phone number to call
+ */
+ public void boilAndWakeUp(Calendar calendar, int phoneNumber) {
+ //implementation
+ }
+
+ /**
+ * Boils water at the appointed time by getting an SMS of fixed format.
+ * Sends an SMS on finish.
+ *
+ * @param sms - text of SMS
+ */
+ public void boilBySMS(String sms) {
+ //implementation
+ }
+}
diff --git a/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java b/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java
new file mode 100644
index 0000000..678785c
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+
+/**
+ * Timer plug-in is used to support an alarm and a timer. It depends on Display and
+ * Clock modules.
+ */
+@Require(Module.DISPLAY)
+@Require(value = Module.CLOCK, maxVersion = 3)
+public class TimerPlugin {
+
+ /**
+ * Sets timer.
+ *
+ * @param time - the remaining time.
+ */
+ public void timer(long time) {
+ //start timer
+ //show the remaining time on display
+ }
+
+ /**
+ * Sets alarm.
+ *
+ * @param time - the alarm time.
+ */
+ public void alarm(long time) {
+ //start alarm
+ //show current time and alarm time on display
+ }
+}
diff --git a/staging/darwin-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java b/staging/darwin-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java
new file mode 100644
index 0000000..0a14913
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.util.function.Supplier;
+
+/**
+ * Supplies a positive number.
+ */
+@Validate(value = Validator.INTEGER_NUMBER,
+ description = "It's not an Integer ")
+@Validate(value = Validator.POSITIVE_NUMBER,
+ description = "It's not a positive Number")
+public class PositiveIntegerSupplier implements Supplier<String> {
+
+ /**
+ * Returns a string representation of a positive integer.
+ *
+ * @return string representation of a positive integer.
+ */
+ @Override
+ public String get() {
+ return "20005"; //random number
+ }
+}
diff --git a/staging/darwin-x86/sample/annotations/Validator/src/SupplierValidator.java b/staging/darwin-x86/sample/annotations/Validator/src/SupplierValidator.java
new file mode 100644
index 0000000..479ac86
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/Validator/src/SupplierValidator.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import javax.xml.bind.ValidationException;
+import java.util.function.Supplier;
+
+/**
+ * Validates the supplier.
+ */
+public class SupplierValidator {
+
+ /**
+ * Validates the supplier.
+ *
+ * @param supplier - Supplier that needs to be validated.
+ * @return true if supplier has passed validation check. False otherwise.
+ */
+ public static boolean validate(Supplier<?> supplier) {
+ for (Validate annotation
+ : supplier.getClass().getAnnotationsByType(Validate.class)) {
+ try {
+ annotation.value().validate(supplier);
+ } catch (ValidationException e) {
+ System.out.println(annotation.description());
+ e.printStackTrace();
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/staging/darwin-x86/sample/annotations/Validator/src/Validate.java b/staging/darwin-x86/sample/annotations/Validator/src/Validate.java
new file mode 100644
index 0000000..e0404ea
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/Validator/src/Validate.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates that the class should be validated by the specified validator.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(ValidateContainer.class)
+public @interface Validate {
+
+ /**
+ * Returns the validator that should validate the annotated class.
+ *
+ * @return Validator that should validate annotated class.
+ */
+ Validator value();
+
+ /**
+ * Returns text to describe the failure of the validation check.
+ *
+ * @return text to describe the failure of the validation check.
+ */
+ String description() default "";
+}
+
+/**
+ * A container for the repeatable @Validate annotation.
+ *
+ * @author Andrey Nazarov
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@interface ValidateContainer {
+
+ Validate[] value();
+}
diff --git a/staging/darwin-x86/sample/annotations/Validator/src/Validator.java b/staging/darwin-x86/sample/annotations/Validator/src/Validator.java
new file mode 100644
index 0000000..9e074f5
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/Validator/src/Validator.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import javax.xml.bind.ValidationException;
+import java.util.function.Supplier;
+
+/**
+ * Enum of Validator implementations.
+ */
+public enum Validator {
+
+ /**
+ * This validator checks that the string represents an integer.
+ */
+ INTEGER_NUMBER {
+ /**
+ * Checks that the string represents an integer.
+ *
+ * @param string - a string supplier
+ * @throws ValidationException if the validation check fails
+ */
+ @Override
+ void validate(Supplier<?> string) throws ValidationException {
+ try {
+ Integer.parseInt((String) string.get());
+ } catch (NumberFormatException ex) {
+ throw new ValidationException("Error while validating "
+ + string.get());
+ }
+ }
+ },
+ /**
+ * This validator checks that the string represents a positive number.
+ */
+ POSITIVE_NUMBER {
+ /**
+ * Checks that the string represents a positive number.
+ *
+ * @param string - an string supplier
+ * @throws ValidationException if the validation check fails
+ */
+ @Override
+ void validate(Supplier<?> string) throws ValidationException {
+ try {
+ if (Double.compare(0.0, Double.parseDouble(
+ (String) string.get())) > 0) {
+ throw new Exception();
+ }
+ } catch (Exception ex) {
+ throw new ValidationException("Error while validating "
+ + string.get());
+ }
+ }
+ };
+
+ /**
+ * Checks that the supplier is valid.
+ *
+ * @param string - a string supplier
+ * @throws ValidationException if validation check fails
+ */
+ abstract void validate(Supplier<?> string) throws ValidationException;
+
+}
diff --git a/staging/darwin-x86/sample/annotations/index.html b/staging/darwin-x86/sample/annotations/index.html
new file mode 100644
index 0000000..804c83d
--- /dev/null
+++ b/staging/darwin-x86/sample/annotations/index.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Repeating Annotations Demo</title>
+</head>
+<body>
+<h2>Repeating Annotations Demo</h2>
+
+<p>
+ This demo shows how to use repeating annotations at runtime and at compile time.
+</p>
+
+<ul>
+ <li><h3>Dependency checker.</h3>
+
+ <p>
+ Shows how to define repeating annotations and process them at compile time.
+ The problem domain is some code that performs useful operations on hardware devices.
+ The code relies on "modules" to be present on the devices. Applicability of the code to a particular
+ device is checked while compiling the code for a particular device.
+ A set of modules provided by a device is listed in an xml file that turns red during the compilation
+ phase and is compared with the required module set specified by annotations.
+ For instance, there is kettle with hardware modules: thermometer, display, and clock.
+ There is also a boiler plug-in that requires clock, thermometer, heater, and optionally an LED light.
+
+ Build the PluginChecker annotation processor first.
+ Then, run javac with the annotation processor against plug-in sources using the following command: </p>
+
+ <code>javac -cp "PluginChecker.jar" -processor checker.PluginChecker -Adevice=Kettle.xml -proc:only &lt;source
+ files&gt;</code>
+
+ <p>
+ where <code>PluginChecker.jar</code> - path to jar file that contains PluginChecker annotation processor
+ class. </br>
+ <code>Kettle.xml</code> - path to device descriptor Kettle.xml </br>
+ <code>&lt;source files&gt;</code> - source files in Plugins/src
+ </p>
+ For more information, see the source files.
+ </p>
+ <ul>
+ <li>Annotation processor sources: <a href="DependencyChecker/PluginChecker/src/">DependencyChecker/PluginChecker/src</a>
+ <li>Processing of repeating annotations can be found in <a href="DependencyChecker/PluginChecker/src/checker/PluginChecker.java">PluginChecker.java</a>
+ <li>Usage of repeating annotation is shown in modules sources.<a href="DependencyChecker/Plugins/src">DependencyChecker/Plugins/src</a>
+ </ul>
+
+ <li><h3>Validator.</h3>
+
+ <p>
+ Shows how to define repeating annotations and process them at runtime.
+ A problem domain is code that needs to validate provided Suppliers for conformance to some criteria.
+ The criteria are implemented by the Validator class which is applied by using annotations that are placed in
+ the code whenever validation is needed. For more information, see the
+ source files.
+ </p>
+
+ <p>
+ <ul>
+ <li>Usage of repeating annotation is described in <a href="Validator/src/PositiveIntegerSupplier.java">PositiveIntegerSupplier.java</a>
+ <li> Example of how to define a repeating annotation type can be found in
+ <a href="Validator/src/Validate.java">Validate.java</a>
+ <li> Usages of the new reflective methods can be found in <a href="Validator/src/SupplierValidator.java">SupplierValidator.java</a>
+ </ul>
+ </p>
+ Sources: <a href="Validator/src/">Validator/src/</a>
+</ul>
+</body>
+</html> \ No newline at end of file
diff --git a/staging/darwin-x86/sample/dtrace/README.txt b/staging/darwin-x86/sample/dtrace/README.txt
new file mode 100644
index 0000000..c3d12b2
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/README.txt
@@ -0,0 +1,43 @@
+DTrace HotSpot probes samples
+=============================
+
+This directory contains the list of D scripts which could be used to trace
+Java application with help of Solaris(tm) 10 Dynamic Tracing (DTrace)
+probes.
+
+The directory is organized as:
+
+* helpers/
+
+ This directory contains the auxiliary script to launch Java application
+ with D script to debug. See more comments in the scripts.
+
+* hotspot/
+
+ This directory contains D scripts which demonstrate usage of 'hotspot'
+ provider probes.
+
+
+* hotspot_jni/
+
+ This directory contains D scripts which demonstrate usage of 'hotspot_jni'
+ provider probes.
+
+
+
+Requirements to run DTrace
+==========================
+
+1. dtrace framework should be installed; (check if /usr/sbin/dtrace exists)
+
+2. the user should have the following rights:
+ dtrace_proc, dtrace_user, dtrace_kernel
+
+ To give a user a privilege on login, insert a line into the
+ /etc/user_attr file of the form:
+ user-name::::defaultpriv=basic,dtrace_proc,dtrace_user,dtrace_kernel
+
+ or
+
+ To give a running process an DTrace privilege, use the ppriv(1) command:
+ # ppriv -s A+privilege process-ID
diff --git a/staging/darwin-x86/sample/dtrace/helpers/dtrace_helper.d b/staging/darwin-x86/sample/dtrace/helpers/dtrace_helper.d
new file mode 100644
index 0000000..896b175
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/helpers/dtrace_helper.d
@@ -0,0 +1,87 @@
+#!/usr/sbin/dtrace -s
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Description:
+ * dtrace -c option launches the command specified in the -c argument and
+ * starts tracing the process. Typically, you can run a D script and trace
+ * a Java application as follows:
+ * dscript.d -Zc "java HelloWorld"
+ *
+ * The -Z option is needed to permit probe descriptions that match zero
+ * probes because Hotspot probes definitions are located in libjvm.so which
+ * has not been yet loaded and thus can't be enabled until the application
+ * is started.
+ *
+ * Straightforward attempt to run D script may fail, e.g.:
+ * dscript.d -c "java HelloWorld"
+ * "probe description hotspotPID:::probename does not match any probes"
+ *
+ * This is because DTrace tries to enable probes before libjvm.so is loaded.
+ * The -Z option requires Solaris patch 118822-30 installed on your system.
+ *
+ * In case you don't have this Solaris patch use dtrace_helper.d script.
+ * This script waits until the Hotspot DTrace probes are loaded and then
+ * stops the Java process (passed as '-c' options). After the process is
+ * stopped, another D script (passed as first argument) is called to do real
+ * trace of Java process.
+ *
+ * Usage example:
+ * dtrace_helper.d -c "java ..." ../hotspot/class_loading_stat.d
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+
+
+pid$target::dlopen:entry
+{
+ self->filename = arg0;
+}
+
+
+pid$target::dlopen:return
+/self->filename && basename(copyinstr(self->filename)) == "libjvm.so"/
+{
+ printf(" loaded %s\n", basename(copyinstr(self->filename)));
+ self->filename = 0;
+
+ stop();
+ printf(" stopped java process with pid=%d \n", $target);
+
+ printf(" run: %s -p %d &", $1, $target);
+ system("(%s -p %d) &", $1, $target);
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/README.txt b/staging/darwin-x86/sample/dtrace/hotspot/README.txt
new file mode 100644
index 0000000..b511b9c
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/README.txt
@@ -0,0 +1,87 @@
+============================
+'hotspot' PROBES DESCRIPTION
+============================
+
+This directory contains D scripts which demonstrate usage of 'hotspot' provider probes.
+
+The 'hotspot' provider makes available probes that can be used to track the
+lifespan of the VM, thread start and stop events, GC and memory pool
+statistics, method compilations, and monitor activity. With a startup flag,
+additional probes are enabled which can be used to monitor the running Java
+program, such as method enter and return probes, and object allocations. All
+of the hotspot probes originate in the VM library (libjvm.so), so they are
+also provided from programs which embed the VM.
+
+Many of the probes in the provider have arguments that can be examined to
+provide further details on the state of the VM. Many of these probes'
+arguments are opaque IDs which can be used to link probe firings to each
+other, however strings and other data are also provided. When string values
+are provided, they are always present as a pair: a pointer to unterminated
+modified UTF-8 data (see JVM spec: 4.4.7) , and a length value which
+indicates the extent of that data. Because the string data (even when none
+of the characters are outside the ASCII range) is not guaranteed to be
+terminated by a NULL character, it is necessary to use the length-terminated
+copyinstr() intrinsic to read the string data from the process.
+
+You can find more information about HotSpot probes here:
+http://java.sun.com/javase/6/docs/technotes/guides/vm/dtrace.html
+
+
+===========
+THE SCRIPTS
+===========
+
+The following scripts/samples which demonstrate 'hotspot' probes usage are
+available:
+
+- class_loading_stat.d
+ The script collects statistics about loaded and unloaded Java classes and
+ dump current state to stdout every N seconds.
+
+- gc_time_stat.d
+ The script measures the duration of a time spent in GC.
+ The duration is measured for every memory pool every N seconds.
+
+- hotspot_calls_tree.d
+ The script prints calls tree of fired 'hotspot' probes.
+
+- method_compile_stat.d
+ The script prints statistics about N methods with largest/smallest
+ compilation time every M seconds.
+
+- method_invocation_stat.d
+ The script collects statistics about Java method invocations.
+
+- method_invocation_stat_filter.d
+ The script collects statistics about Java method invocations.
+ You can specify package, class or method name to trace.
+
+- method_invocation_tree.d
+ The script prints tree of Java and JNI method invocations.
+
+- monitors.d
+ The script traces monitor related probes.
+
+- object_allocation_stat.d
+ The script collects statistics about N object allocations every M seconds.
+
+
+==========
+HOW TO RUN
+==========
+
+To run any D script from hotspot directory you can do either:
+
+ # dscript.d -c "java ..."
+
+ or if you don't have Solaris 10 patch which allows to specify probes that
+ don't yet exist ( Hotspot DTrace probes are defined in libjvm.so and as
+ result they could be not been yet loaded when you try to attach D script to
+ the Java process) do:
+
+ # ../helpers/dtrace_helper.d -c "java ..." dscript.d
+
+ or if your application is already running you can just simply attach
+ the D script like:
+
+ # dscript.d -p JAVA_PID
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/class_loading_stat.d b/staging/darwin-x86/sample/dtrace/hotspot/class_loading_stat.d
new file mode 100644
index 0000000..7197620
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/class_loading_stat.d
@@ -0,0 +1,157 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. class_loading_stat.d -c "java ..." INTERVAL_SECS
+ * 2. class_loading_stat.d -p JAVA_PID INTERVAL_SECS
+ *
+ * This script collects statistics about loaded and unloaded Java classes
+ * and dump current state to stdout every INTERVAL_SECS seconds. If
+ * INTERVAL_SECS is not set then 10 seconds interval is used.
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option aggrate=100ms
+
+
+self char *str_ptr;
+self string class_name;
+self string package_name;
+
+int INTERVAL_SECS;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "hotspot class loadin tracing";
+
+ INTERVAL_SECS = $1 ? $1 : 10;
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+
+ LOADED_CLASSES_CNT = 0;
+ UNLOADED_CLASSES_CNT = 0;
+
+ LINE_SEP =
+ "------------------------------------------------------------------------";
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+/*
+ * hotspot:::class-loaded, hotspot:::class-unloaded probe arguments:
+ * arg0: char*, class name passed as mUTF8 string
+ * arg1: uintptr_t, class name length
+ * arg2: void*, class loader ID, which is unique identifier for
+ * a class loader in the VM.
+ * arg3: uintptr_t, class is shared or not
+ */
+hotspot$target:::class-loaded
+{
+ LOADED_CLASSES_CNT ++;
+
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ self->package_name = dirname(self->class_name);
+
+ @classes_loaded[self->package_name] = count();
+}
+
+hotspot$target:::class-unloaded
+{
+ UNLOADED_CLASSES_CNT ++;
+
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ self->package_name = dirname(self->class_name);
+
+ @classes_unloaded[self->package_name] = count();
+}
+
+
+tick-1sec
+/timestamp > SAMPLING_TIME/
+{
+ printf("%s\n", LINE_SEP);
+ printf("%Y\n", walltimestamp);
+ printf("%s\n", LINE_SEP);
+
+ printf("Loaded classes by package:\n");
+ printa("%10@d %s\n", @classes_loaded);
+
+ printf("\n");
+ printf("Unloaded classes by package:\n");
+ printa("%10@d %s\n", @classes_unloaded);
+
+ printf("\n");
+ printf("Number of loaded classes: %10d\n", LOADED_CLASSES_CNT);
+ printf("Number of unloaded classes: %10d\n", UNLOADED_CLASSES_CNT);
+
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+}
+
+
+:::END
+{
+ printf("%s\n", LINE_SEP);
+ printf("%Y\n", walltimestamp);
+ printf("%s\n", LINE_SEP);
+
+ printf("Loaded classes by package:\n");
+ printa("%10@d %s\n", @classes_loaded);
+
+ printf("\n");
+ printf("Unloaded classes by package:\n");
+ printa("%10@d %s\n", @classes_unloaded);
+
+ printf("\n");
+ printf("Number of loaded classes: %10d\n", LOADED_CLASSES_CNT);
+ printf("Number of unloaded classes: %10d\n", UNLOADED_CLASSES_CNT);
+
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/gc_time_stat.d b/staging/darwin-x86/sample/dtrace/hotspot/gc_time_stat.d
new file mode 100644
index 0000000..c35b87d
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/gc_time_stat.d
@@ -0,0 +1,203 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. gc_time_stat.d -c "java ..." INTERVAL_SECS
+ * 2. gc_time_stat.d -p JAVA_PID INTERVAL_SECS
+ *
+ * This script measures the duration of a time spent in GC. The duration is
+ * measured for every memory pool every INTERVAL_SECS seconds. If
+ * INTERVAL_SECS is not set then 10 seconds interval is used.
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option aggrate=100ms
+
+
+string TEST_NAME;
+self char *str_ptr;
+self string mgr_name;
+self string pool_name;
+
+int INTERVAL_SECS;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "hotspot GC tracing";
+
+ START_TIME = timestamp;
+ gc_total_time = 0;
+ gc_total_count = 0;
+
+ INTERVAL_SECS = $1 ? $1 : 10;
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+
+ LINE_SEP = "--------------------------------------------------------";
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+
+/*
+ * hotspot:::gc-begin
+ * arg0: uintptr_t, boolean value which indicates
+ * if this is to be a full GC or not
+ */
+hotspot$target:::gc-begin
+{
+ self->gc_ts = timestamp;
+ printf("\nGC started: %Y\n", walltimestamp);
+ printf("%20s | %-20s | %10s\n", "manager", "pool", "time (ms)");
+ printf(" %s\n", LINE_SEP);
+}
+
+hotspot$target:::gc-end
+/self->gc_ts/
+{
+ self->time = (timestamp - self->gc_ts) / 1000;
+
+ printf(" %s\n", LINE_SEP);
+ printf(" %40s | %10d\n", "GC total", self->time);
+
+ gc_total_time += self->time;
+ gc_total_count ++;
+ self->gc_ts = 0;
+}
+
+/*
+ * hotspot:::mem-pool-gc-begin, hotspot:::mem-pool-gc-end
+ * arg0: char*, a pointer to mUTF-8 string data which contains the name
+ * of the manager which manages this memory pool
+ * arg1: uintptr_t, the length of the manager name (in bytes
+ * arg2: char*, a pointer to mUTF-8 string data which contains the name
+ * of the memory pool
+ * arg3: uintptr_t, the length of the memory pool name (in bytes)
+ * arg4: uintptr_t, the initial size of the memory pool (in bytes)
+ * arg5: uintptr_t, the amount of memory in use in the memory pool
+ * (in bytes)
+ * arg6: uintptr_t, the the number of committed pages in the memory pool
+ * arg7: uintptr_t, the the maximum size of the memory pool
+ */
+hotspot$target:::mem-pool-gc-begin
+{
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ self->mgr_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg2, arg3+1);
+ self->str_ptr[arg3] = '\0';
+ self->pool_name = (string) self->str_ptr;
+
+ self->mem_pool_ts[self->mgr_name, self->pool_name] = timestamp;
+}
+
+hotspot$target:::mem-pool-gc-end
+{
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ self->mgr_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg2, arg3+1);
+ self->str_ptr[arg3] = '\0';
+ self->pool_name = (string) self->str_ptr;
+
+ self->time =
+ (timestamp - self->mem_pool_ts[self->mgr_name, self->pool_name]) / 1000;
+
+ printf(
+ "%20s | %-20s | %10d\n", self->mgr_name, self->pool_name, self->time);
+
+ @mem_pool_total_time[self->mgr_name, self->pool_name] = sum(self->time);
+ self->mem_pool_ts[self->mgr_name, self->pool_name] = 0;
+
+ @mem_pool_count[self->mgr_name, self->pool_name] = count();
+}
+
+tick-1sec
+/timestamp > SAMPLING_TIME/
+{
+ trace_time = (timestamp - START_TIME) / 1000;
+
+ printf(" %s\n", LINE_SEP);
+ printf("\nGC statistics, time: %Y\n\n", walltimestamp);
+ printf("%20s | %-20s | %10s\n", "manager", "pool", "total time");
+ printf(" %s\n", LINE_SEP);
+ printa("%20s | %-20s | %10@d\n", @mem_pool_total_time);
+ printf(" %s\n", LINE_SEP);
+ printf(" %40s | %10d\n", "total", gc_total_time);
+
+ printf("\n");
+ printf("%20s | %-20s | %10s\n", "manager", "pool", "# of calls");
+ printf(" %s\n", LINE_SEP);
+ printa("%20s | %-20s | %10@d\n", @mem_pool_count);
+ printf(" %s\n", LINE_SEP);
+ printf(" %40s | %10d\n", "total", gc_total_count);
+
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+}
+
+:::END
+{
+ trace_time = (timestamp - START_TIME) / 1000;
+
+ printf(" %s\n", LINE_SEP);
+ printf("\nGC statistics, time: %Y\n\n", walltimestamp);
+ printf("%20s | %-20s | %10s\n", "manager", "pool", "total time");
+ printf(" %s\n", LINE_SEP);
+ printa("%20s | %-20s | %10@d\n", @mem_pool_total_time);
+ printf(" %s\n", LINE_SEP);
+ printf(" %40s | %10d\n", "total", gc_total_time);
+
+ printf("\n");
+ printf("%20s | %-20s | %10s\n", "manager", "pool", "# of calls");
+ printf(" %s\n", LINE_SEP);
+ printa("%20s | %-20s | %10@d\n", @mem_pool_count);
+ printf(" %s\n", LINE_SEP);
+ printf(" %40s | %10d\n", "total", gc_total_count);
+
+
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/hotspot_calls_tree.d b/staging/darwin-x86/sample/dtrace/hotspot/hotspot_calls_tree.d
new file mode 100644
index 0000000..a5af496
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/hotspot_calls_tree.d
@@ -0,0 +1,117 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. hotspot_calls_tree.d -c "java ..."
+ * 2. hotspot_calls_tree.d -p JAVA_PID
+ *
+ * This script prints calls tree of fired 'hotspot' probes.
+ *
+ * Notes:
+ * The script uses 'monitors' probes which are disabled by default since
+ * it incurs performance overhead to the application. To enable them, you
+ * need to turn on the ExtendedDTraceProbes VM option. You can either
+ * start the application with -XX:+ExtendedDTraceProbes option or use the
+ * jinfo command to enable it at runtime as follows:
+ *
+ * jinfo -flag +ExtendedDTraceProbes <java_pid>
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option aggrate=100ms
+
+self int indent;
+string PAUSE_AT_STARTUP_FILE;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "hotspot probes tracing";
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+
+ self->indent = 10;
+}
+
+hotspot$target:::class-loaded,
+hotspot$target:::class-unloaded,
+hotspot$target:::compiled-method-load,
+hotspot$target:::compiled-method-unload,
+hotspot$target:::monitor-notify,
+hotspot$target:::monitor-notifyAll
+{
+ printf("%d %*s <-> %s\n", curcpu->cpu_id, self->indent, "", probename);
+}
+
+hotspot$target:::vm-init-begin,
+hotspot$target:::gc-begin,
+hotspot$target:::mem-pool-gc-begin,
+hotspot$target:::thread-start,
+hotspot$target:::method-compile-begin,
+hotspot$target:::monitor-contended-enter,
+hotspot$target:::monitor-wait
+{
+ self->indent ++;
+ printf("%d %*s -> %s\n", curcpu->cpu_id, self->indent, "", probename);
+}
+
+hotspot$target:::vm-init-end,
+hotspot$target:::vm-shutdown,
+hotspot$target:::gc-end,
+hotspot$target:::mem-pool-gc-end,
+hotspot$target:::thread-stop,
+hotspot$target:::method-compile-end,
+hotspot$target:::monitor-contended-entered,
+hotspot$target:::monitor-contended-exit,
+hotspot$target:::monitor-waited
+{
+ printf("%d %*s <- %s\n", curcpu->cpu_id, self->indent, "", probename);
+ self->indent --;
+}
+
+:::END
+{
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/method_compile_stat.d b/staging/darwin-x86/sample/dtrace/hotspot/method_compile_stat.d
new file mode 100644
index 0000000..0d3812e
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/method_compile_stat.d
@@ -0,0 +1,274 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. method_compile_stat.d -c "java ..." TOP_RESULTS_COUNT INTERVAL_SECS
+ * 2. method_compile_stat.d -p JAVA_PID TOP_RESULTS_COUNT INTERVAL_SECS
+ *
+ * This script prints statistics about TOP_RESULTS_COUNT (default is 25)
+ * methods with largest/smallest compilation time every INTERVAL_SECS
+ * (default is 60) seconds.
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option aggrate=100ms
+
+
+self char *str_ptr;
+self string class_name;
+self string method_name;
+self string signature;
+
+int INTERVAL_SECS;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "hotspot methods compilation tracing";
+
+ TOP_RESULTS_COUNT = $1 ? $1 : 25;
+ INTERVAL_SECS = $2 ? $2 : 60;
+
+ COMPILED_METHODS_COUNT = 0;
+ LOADED_METHODS_CNT = 0;
+ UNLOADED_METHODS_CNT = 0;
+
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+
+ LINE_SEP =
+ "------------------------------------------------------------------------";
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+/*
+ * hotspot:::method-compile-begin
+ * arg0: char*, a pointer to mUTF-8 string containing the name of
+ * the compiler
+ * arg1: uintptr_t, the length of the compiler name (in bytes)
+ * arg2: char*, a pointer to mUTF-8 string containing the class name of
+ * the method being compiled
+ * arg3: uintptr_t, the length of the class name (in bytes)
+ * arg4: char*, a pointer to mUTF-8 string containing the method name of
+ * the method being compiled
+ * arg5: uintptr_t, the length of the method name (in bytes)
+ * arg6: char*, a pointer to mUTF-8 string containing the signature of
+ * the method being compiled
+ * arg7: uintptr_t, the length of the signature(in bytes)
+ */
+hotspot$target:::method-compile-begin
+{
+ /*compiler_name, len, class_name, len, method_name, len, signature, len*/
+
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ compiler_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg2, arg3+1);
+ self->str_ptr[arg3] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg4, arg5+1);
+ self->str_ptr[arg5] = '\0';
+ self->method_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg6, arg7+1);
+ self->str_ptr[arg7] = '\0';
+ self->signature = (string) self->str_ptr;
+
+ self->ts[self->class_name, self->method_name, self->signature] = timestamp;
+}
+
+/*
+ * hotspot:::method-compile-end
+ * arg0: char*, a pointer to mUTF-8 string containing the name of
+ * the compiler
+ * arg1: uintptr_t, the length of the compiler name (in bytes)
+ * arg2: char*, a pointer to mUTF-8 string containing the class name of
+ * the method being compiled
+ * arg3: uintptr_t, the length of the class name (in bytes)
+ * arg4: char*, a pointer to mUTF-8 string containing the method name of
+ * the method being compiled
+ * arg5: uintptr_t, the length of the method name (in bytes)
+ * arg6: char*, a pointer to mUTF-8 string containing the signature of
+ * the method being compiled
+ * arg7: uintptr_t, the length of the signature(in bytes)
+ * arg8: uintptr_t, boolean value which indicates if method
+ * has been compiled successfuly
+ */
+hotspot$target:::method-compile-end
+{
+ /* compiler_name, len, class_name, len, method_name, len,
+ signature, len, isSuccess */
+
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ compiler_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg2, arg3+1);
+ self->str_ptr[arg3] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg4, arg5+1);
+ self->str_ptr[arg5] = '\0';
+ self->method_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg6, arg7+1);
+ self->str_ptr[arg7] = '\0';
+ self->signature = (string) self->str_ptr;
+}
+
+/*
+ * Method was successfuly compiled
+ */
+hotspot$target:::method-compile-end
+/arg8 && self->ts[self->class_name, self->method_name, self->signature]/
+{
+ /* compiler_name, len, class_name, len, method_name, len,
+ signature, len, isSuccess */
+
+ COMPILED_METHODS_COUNT++;
+
+ @compile_time_top[self->class_name, self->method_name, self->signature] =
+ avg((timestamp -
+ self->ts[self->class_name, self->method_name, self->signature]) / 1000);
+
+ @compile_time_last[self->class_name, self->method_name, self->signature] =
+ avg((timestamp -
+ self->ts[self->class_name, self->method_name, self->signature]) / 1000);
+
+ self->ts[self->class_name, self->method_name, self->signature] = 0;
+}
+
+/*
+ * Method compilation was failed
+ */
+hotspot$target:::method-compile-end
+/arg8 != 1 && self->ts[self->class_name, self->method_name, self->signature]/
+{
+ /* compiler_name, len, class_name, len, method_name, len,
+ signature, len, isSuccess */
+
+ @fail_compile_count[self->class_name,
+ self->method_name, self->signature] = count();
+}
+
+hotspot$target:::compiled-method-load
+{
+ /* class_name, len, method_name, len, signature, len, code_address, size */
+
+ LOADED_METHODS_CNT ++;
+}
+
+hotspot$target:::compiled-method-unload
+{
+ /* class_name, len, method_name, len, signature, len, code_address, size */
+
+ UNLOADED_METHODS_CNT ++;
+}
+
+
+tick-1sec
+/timestamp > SAMPLING_TIME/
+{
+ trunc(@compile_time_top, TOP_RESULTS_COUNT);
+ trunc(@compile_time_last, -TOP_RESULTS_COUNT);
+
+ printf("\n");
+ printf("%s\n", LINE_SEP);
+ printf("%Y\n", walltimestamp);
+ printf("%s\n", LINE_SEP);
+
+ printf(
+ "\nTop %d methods with largest compilation time (in milleseconds):\n",
+ TOP_RESULTS_COUNT);
+ printa("%10@d %s::%s%s\n", @compile_time_top);
+
+ printf(
+ "\nTop %d methods with smallest compilation time (in milleseconds):\n",
+ TOP_RESULTS_COUNT);
+ printa("%10@d %s::%s%s\n", @compile_time_last);
+
+ printf("\n");
+ printf("Compiled methods: %10d\n", COMPILED_METHODS_COUNT);
+ printf("Loaded compiled methods: %10d\n", LOADED_METHODS_CNT);
+ printf("Unoaded compiled methods: %10d\n", UNLOADED_METHODS_CNT);
+
+ printf("\nFailed compilation:\n");
+ printa("%10@d %s::%s%s\n", @fail_compile_count);
+
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+}
+
+:::END
+{
+ trunc(@compile_time_top, TOP_RESULTS_COUNT);
+ trunc(@compile_time_last, -TOP_RESULTS_COUNT);
+
+ printf("\n");
+ printf("%s\n", LINE_SEP);
+ printf("%Y\n", walltimestamp);
+ printf("%s\n", LINE_SEP);
+
+ printf(
+ "\nTop %d methods with largest compilation time (in milleseconds):\n",
+ TOP_RESULTS_COUNT);
+ printa("%10@d %s::%s%s\n", @compile_time_top);
+
+ printf(
+ "\nTop %d methods with smallest compilation time (in milleseconds):\n",
+ TOP_RESULTS_COUNT);
+ printa("%10@d %s::%s%s\n", @compile_time_last);
+
+ printf("\n");
+ printf("Compiled methods: %10d\n", COMPILED_METHODS_COUNT);
+ printf("Loaded compiled methods: %10d\n", LOADED_METHODS_CNT);
+ printf("Unoaded compiled methods: %10d\n", UNLOADED_METHODS_CNT);
+
+ printf("\nFailed compilations:\n");
+ printa("%10@d %s::%s%s\n", @fail_compile_count);
+
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat.d b/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat.d
new file mode 100644
index 0000000..1b64b8b
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat.d
@@ -0,0 +1,210 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. method_invocation_stat.d -c "java ..."
+ * 2. method_invocation_stat.d -p JAVA_PID
+ *
+ * This script collects statistics about Java method invocations.
+ *
+ * Notes:
+ * - These probes are disabled by default since it incurs performance
+ * overhead to the application. To trace the method-entry and
+ * method-exit probes, you need to turn on the ExtendedDTraceProbes VM
+ * option.
+ * You can either start the application with -XX:+ExtendedDTraceProbes
+ * option or use the jinfo command to enable it at runtime as follows:
+ *
+ * jinfo -flag +ExtendedDTraceProbes <java_pid>
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+
+self char *str_ptr;
+self string class_name;
+self string method_name;
+self string signature;
+self string package_name;
+self string last_class_name;
+
+long long JAVA_CALLS;
+long long JNI_CALLS;
+long long SYS_CALLS;
+
+int SYS_DEEP;
+long long LAST_SYS_TS;
+
+long long START_TIME;
+long long JAVA_TIME;
+long long RUN_TIME;
+long long SYS_TIME;
+
+BEGIN
+{
+ SAMPLE_NAME = "hotspot method invocation tracing";
+
+ START_TIME = timestamp;
+ SYS_TIME = 0;
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+/*
+ * hotspot:::method-entry, hotspot:::method-return probe arguments:
+ * arg0: uintptr_t, Java thread id
+ * arg1: char*, a pointer to mUTF-8 string containing the name of
+ * the class of the method being entered
+ * arg2: uintptr_t, the length of the class name (in bytes)
+ * arg3: char*, a pointer to mUTF-8 string data which contains the
+ * name of the method being entered
+ * arg4: uintptr_t, the length of the method name (in bytes)
+ * arg5: char*, a pointer to mUTF-8 string data which contains the
+ * signature of the method being entered
+ * arg6: uintptr_t, the length of the signature(in bytes)
+ */
+hotspot$target:::method-entry
+{
+ self->str_ptr = (char*) copyin(arg1, arg2+1);
+ self->str_ptr[arg2] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg3, arg4+1);
+ self->str_ptr[arg4] = '\0';
+ self->method_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg5, arg6+1);
+ self->str_ptr[arg6] = '\0';
+ self->signature = (string) self->str_ptr;
+
+
+ self->package_name = dirname(self->class_name);
+
+ JAVA_CALLS ++;
+ @method_calls[self->class_name,
+ self->method_name, self->signature] = count();
+ @class_calls[self->class_name] = count();
+ @package_calls[self->package_name] = count();
+}
+
+
+hotspot_jni$target:::*-entry
+{
+ JNI_CALLS ++;
+
+ @jni_calls[probename] = count();
+}
+
+syscall:::entry
+/pid == $target && SYS_DEEP == 0/
+{
+ LAST_SYS_TS = timestamp;
+}
+
+syscall:::entry
+/pid == $target/
+{
+ SYS_DEEP ++;
+ @sys_calls[probefunc] = count();
+ SYS_CALLS ++;
+}
+
+syscall:::return
+/pid == $target/
+{
+ SYS_DEEP --;
+}
+
+syscall:::return
+/pid == $target && SYS_DEEP == 0/
+{
+ SYS_TIME += (timestamp - LAST_SYS_TS);
+}
+
+
+:::END
+{
+ RUN_TIME = (timestamp - START_TIME);
+ JAVA_TIME = (RUN_TIME - SYS_TIME);
+
+ printf("System calls:\n");
+ printa("%10@d %s\n", @sys_calls);
+ printf("\n");
+
+ printf("JNI calls:\n");
+ printa("%10@d %s\n", @jni_calls);
+ printf("\n");
+
+ printf("Top packages calls:\n");
+ printa("%10@d %s\n", @package_calls);
+ printf("\n");
+
+ printf("Top class calls:\n");
+ printa("%10@d %s\n", @class_calls);
+ printf("\n");
+
+ printf("Top method calls:\n");
+ printa("%10@d %s:%s:%s\n", @method_calls);
+ printf("\n");
+
+ printf("=======================================\n");
+ printf("JAVA_CALLS: %10d\n", JAVA_CALLS);
+ printf(" JNI_CALLS: %10d\n", JNI_CALLS);
+ printf(" SYS_CALLS: %10d\n", SYS_CALLS);
+ printf("\n");
+
+ printf("Run time: %15d\n", RUN_TIME);
+ printf("Syscall time: %15d\n", SYS_TIME);
+ printf("Java+JNI time: %15d\n", JAVA_TIME);
+ printf("\n");
+}
+
+:::END
+{
+ printf("\nEND %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat_filter.d b/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat_filter.d
new file mode 100644
index 0000000..a36d365
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_stat_filter.d
@@ -0,0 +1,204 @@
+#!/usr/sbin/dtrace -Zs
+
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. method_invocation_stat_filter.d -c "java ..." p|c|m package|class_name|method_name
+ * 2. method_invocation_stat_filter.d -p JAVA_PID p|c|m package|class_name|method_name
+ *
+ * example:
+ * method_invocation_stat_filter.d -c "java -version" '"p"' '"sun/util"'
+ *
+ * This script collects statistics about Java method invocations.
+ *
+ * Notes:
+ * - These probes are disabled by default since it incurs performance
+ * overhead to the application. To trace the method-entry and
+ * method-exit probes, you need to turn on the ExtendedDTraceProbes VM
+ * option.
+ * You can either start the application with -XX:+ExtendedDTraceProbes
+ * option or use the jinfo command to enable it at runtime as follows:
+ *
+ * jinfo -flag +ExtendedDTraceProbes <java_pid>
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+
+self char *str_ptr;
+self string class_name;
+self string method_name;
+self string signature;
+self string package_name;
+self string last_class_name;
+
+long long JAVA_CALLS;
+
+long long START_TIME;
+long long JAVA_TIME;
+long long RUN_TIME;
+
+string FILTER_TYPE;
+string FILTER_VALUE;
+
+
+:::BEGIN
+{
+ SAMPLE_NAME = "hotspot method invocation tracing";
+
+ START_TIME = timestamp;
+
+ FILTER_TYPE = $1;
+ FILTER_VALUE = $2;
+
+ START_TIME = timestamp;
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+/*
+ * hotspot:::method-entry, hotspot:::method-return probe arguments:
+ * arg0: uintptr_t, Java thread id
+ * arg1: char*, a pointer to mUTF-8 string containing the name of
+ * the class of the method being entered
+ * arg2: uintptr_t, the length of the class name (in bytes)
+ * arg3: char*, a pointer to mUTF-8 string data which contains the
+ * name of the method being entered
+ * arg4: uintptr_t, the length of the method name (in bytes)
+ * arg5: char*, a pointer to mUTF-8 string data which contains the
+ * signature of the method being entered
+ * arg6: uintptr_t, the length of the signature(in bytes)
+ */
+hotspot$target:::method-entry
+{
+ self->str_ptr = (char*) copyin(arg1, arg2+1);
+ self->str_ptr[arg2] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg3, arg4+1);
+ self->str_ptr[arg4] = '\0';
+ self->method_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg5, arg6+1);
+ self->str_ptr[arg6] = '\0';
+ self->signature = (string) self->str_ptr;
+
+
+ self->package_name = dirname(self->class_name);
+}
+
+hotspot$target:::method-entry
+/FILTER_TYPE == ""/
+{
+ JAVA_CALLS ++;
+ @method_calls[self->class_name,
+ self->method_name, self->signature] = count();
+ @class_calls[self->class_name] = count();
+ @package_calls[self->package_name] = count();
+}
+
+hotspot$target:::method-entry
+/FILTER_TYPE == "p" && self->package_name == FILTER_VALUE/
+{
+ JAVA_CALLS ++;
+ @method_calls[self->class_name,
+ self->method_name, self->signature] = count();
+ @class_calls[self->class_name] = count();
+ @package_calls[self->package_name] = count();
+}
+
+hotspot$target:::method-entry
+/FILTER_TYPE == "c" && self->class_name == FILTER_VALUE/
+{
+ JAVA_CALLS ++;
+ @method_calls[self->class_name,
+ self->method_name, self->signature] = count();
+ @class_calls[self->class_name] = count();
+ @package_calls[self->package_name] = count();
+}
+
+hotspot$target:::method-entry
+/FILTER_TYPE == "m" && self->method_name == FILTER_VALUE/
+{
+ JAVA_CALLS ++;
+ @method_calls[self->class_name,
+ self->method_name, self->signature] = count();
+ @class_calls[self->class_name] = count();
+ @package_calls[self->package_name] = count();
+}
+
+
+:::END
+{
+ RUN_TIME = (timestamp - START_TIME);
+ JAVA_TIME = RUN_TIME;
+
+ printf("Top packages calls:\n");
+ printa("%10@d %s\n", @package_calls);
+ printf("\n");
+
+ printf("Top class calls:\n");
+ printa("%10@d %s\n", @class_calls);
+ printf("\n");
+
+ printf("Top method calls:\n");
+ printa("%10@d %s:%s:%s\n", @method_calls);
+ printf("\n");
+
+ printf("=======================================\n");
+ printf("JAVA_CALLS: %10d\n", JAVA_CALLS);
+ printf("\n");
+
+ printf("Run time: %15d\n", RUN_TIME);
+ printf("\n");
+}
+
+:::END
+{
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_tree.d b/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_tree.d
new file mode 100644
index 0000000..d27fe27
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/method_invocation_tree.d
@@ -0,0 +1,142 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. method_invocation_tree.d -c "java ..."
+ * 2. method_invocation_tree.d -p JAVA_PID
+ *
+ * This script prints tree of Java and JNI method invocations.
+ *
+ * Notes:
+ * - These probes are disabled by default since it incurs performance
+ * overhead to the application. To trace the method-entry and
+ * method-exit probes, you need to turn on the ExtendedDTraceProbes VM
+ * option.
+ * You can either start the application with -XX:+ExtendedDTraceProbes
+ * option or use the jinfo command to enable it at runtime as follows:
+ *
+ * jinfo -flag +ExtendedDTraceProbes <java_pid>
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+self char *str_ptr;
+self string class_name;
+self string method_name;
+self string signature;
+
+self int indent;
+
+BEGIN
+{
+ SAMPLE_NAME = "hotspot method invocation tracing";
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+hotspot$target:::*
+/!self->indent/
+{
+ self->indent = 0;
+}
+
+/*
+ * hotspot:::method-entry, hotspot:::method-return probe arguments:
+ * arg0: uintptr_t, Java thread id
+ * arg1: char*, a pointer to mUTF-8 string containing the name of
+ * the class of the method being entered
+ * arg2: uintptr_t, the length of the class name (in bytes)
+ * arg3: char*, a pointer to mUTF-8 string data which contains the
+ * name of the method being entered
+ * arg4: uintptr_t, the length of the method name (in bytes)
+ * arg5: char*, a pointer to mUTF-8 string data which contains the
+ * signature of the method being entered
+ * arg6: uintptr_t, the length of the signature(in bytes)
+ */
+
+hotspot$target:::method-return
+{
+ self->indent --;
+ METHOD_RETURN_CNT ++
+}
+
+hotspot$target:::method-entry
+{
+ self->indent ++;
+ METHOD_ENTRY_CNT ++;
+
+ self->str_ptr = (char*) copyin(arg1, arg2+1);
+ self->str_ptr[arg2] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg3, arg4+1);
+ self->str_ptr[arg4] = '\0';
+ self->method_name = (string) self->str_ptr;
+
+ self->str_ptr = (char*) copyin(arg5, arg6+1);
+ self->str_ptr[arg6] = '\0';
+ self->signature = (string) self->str_ptr;
+
+ printf("%-10u%*s%s:%s:%s\n",
+ tid, self->indent, "", self->class_name,
+ self->method_name, self->signature);
+
+}
+
+hotspot_jni$target:::*_entry
+{
+ printf("%-10u%*sJNI:%s\n", tid, self->indent+1, "", probename);
+}
+
+:::END
+{
+ printf("METHOD_ENTRY_CNT: %10d\n", METHOD_ENTRY_CNT);
+ printf("METHOD_RETURN_CNT: %10d\n", METHOD_RETURN_CNT);
+
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/monitors.d b/staging/darwin-x86/sample/dtrace/hotspot/monitors.d
new file mode 100644
index 0000000..fba030e
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/monitors.d
@@ -0,0 +1,152 @@
+#!/usr/sbin/dtrace -Zs
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. monitors.d -c "java ..."
+ * 2. monitors.d -p JAVA_PID
+ *
+ * The script traces monitor related probes.
+ *
+ * Notes:
+ * - These probes are disabled by default since it incurs performance
+ * overhead to the application. To trace the monitor-* probes, you need
+ * to turn on the ExtendedDTraceProbes VM option.
+ * You can either start the application with -XX:+ExtendedDTraceProbes
+ * option or use the jinfo command to enable it at runtime as follows:
+ *
+ * jinfo -flag +ExtendedDTraceProbes <java_pid>
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option aggrate=100ms
+
+
+self string thread_name;
+self char* str_ptr;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "hotspot monitors tracing";
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+/*
+ * hotspot:::thread-start, hotspot:::thread-stop probe arguments:
+ * arg0: char*, thread name passed as mUTF8 string
+ * arg1: uintptr_t, thread name length
+ * arg2: uintptr_t, Java thread id
+ * arg3: uintptr_t, native/OS thread id
+ * arg4: uintptr_t, is a daemon or not
+ */
+hotspot$target:::thread-start
+{
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ self->thread_name = (string) self->str_ptr;
+
+ printf("thread-start: id=%d, is_daemon=%d, name=%s, os_id=%d\n",
+ arg2, arg4, self->thread_name, arg3);
+
+ threads[arg2] = self->thread_name;
+}
+
+
+hotspot$target:::thread-stop
+{
+ self->str_ptr = (char*) copyin(arg0, arg1+1);
+ self->str_ptr[arg1] = '\0';
+ self->thread_name = (string) self->str_ptr;
+
+
+ printf("thread-stop: id=%d, is_daemon=%d, name=%s, os_id=%d\n",
+ arg2, arg4, self->thread_name, arg3);
+}
+
+/*
+ *
+ * hotspot::monitor-contended-enter, hotspot::monitor-contended-entered
+ *
+ * arg0: uintptr_t, the Java thread identifier for the thread peforming
+ * the monitor operation
+ * arg1: uintptr_t, a unique, but opaque identifier for the specific
+ * monitor that the action is performed upon
+ * arg2: char*, a pointer to mUTF-8 string data which contains the
+ * name of the class of the object being acted upon
+ * arg3: uintptr_t, the length of the class name (in bytes)
+ */
+
+hotspot$target:::monitor-contended-enter
+{
+ /* (uintptr_t thread_id, uintptr_t monitor_id,
+ char* obj_class_name, uintptr_t obj_class_name_len) */
+
+ self->str_ptr = (char*) copyin(arg2, arg3+1);
+ self->str_ptr[arg3] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+ monitors[arg1] = self->class_name;
+
+ monitors_enter[arg1] = arg0;
+ printf("%s: -> enter monitor (%d) %s\n",
+ threads[arg0], arg1, monitors[arg1]);
+}
+
+hotspot$target:::monitor-contended-entered
+{
+ /* (uintptr_t thread_id, uintptr_t monitor_id, char* obj_class_name,
+ uintptr_t obj_class_name_len) */
+
+ monitors_entered[arg1] = arg0;
+ printf("%s: <- entered monitor (%d) %s\n",
+ threads[arg0], arg1, monitors[arg1]);
+}
+
+
+:::END
+{
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot/object_allocation_stat.d b/staging/darwin-x86/sample/dtrace/hotspot/object_allocation_stat.d
new file mode 100644
index 0000000..bfb8981
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot/object_allocation_stat.d
@@ -0,0 +1,162 @@
+#!/usr/sbin/dtrace -Zs
+
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. object_allocation_stat.d -c "java ..." TOP_RESULTS_COUNT INTERVAL_SECS
+ * 2. object_allocation_stat.d -p JAVA_PID TOP_RESULTS_COUNT INTERVAL_SECS
+ *
+ * This script collects statistics about TOP_RESULTS_COUNT (default is 25)
+ * object allocations every INTERVAL_SECS (default is 60) seconds.
+ *
+ * The results are displayed in ascending order which means that the highest
+ * allocated type is listed last. The script can be improved to sort the
+ * results in reverse order when DTrace supports it.
+ *
+ * Notes:
+ * - The object-alloc probe is disabled by default since it incurs
+ * performance overhead to the application. To trace object-alloc probe,
+ * you need to turn on the ExtendedDTraceProbes VM option.
+ * You can either start the application with -XX:+ExtendedDTraceProbes
+ * option or use the jinfo command to enable it at runtime as follows:
+ *
+ * jinfo -flag +ExtendedDTraceProbes <java_pid>
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+
+self char *str_ptr;
+self string class_name;
+
+long long ALLOCATED_OBJECTS_CNT;
+
+int INTERVAL_SECS;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "hotspot object allocation tracing";
+
+ TOP_RESULTS_COUNT = $1 ? $1 : 25;
+ INTERVAL_SECS = $2 ? $2 : 60;
+
+ ALLOCATED_OBJECTS_CNT = 0;
+
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+
+ LINE_SEP =
+ "------------------------------------------------------------------------";
+
+ printf("BEGIN %s\n\n", SAMPLE_NAME);
+}
+
+/*
+ * hotspot:::object-alloc probe arguments:
+ * arg0: uintptr_t, Java thread id
+ * arg1: char*, a pointer to mUTF-8 string containing the name of
+ * the class of the object being allocated
+ * arg2: uintptr_t, the length of the class name (in bytes)
+ * arg3: uintptr_t, the size of the object being allocated
+ */
+hotspot$target:::object-alloc
+{
+ ALLOCATED_OBJECTS_CNT ++;
+
+ self->str_ptr = (char*) copyin(arg1, arg2+1);
+ self->str_ptr[arg2] = '\0';
+ self->class_name = (string) self->str_ptr;
+
+
+ @allocs_count[self->class_name] = count();
+ @allocs_size[self->class_name] = sum(arg3);
+}
+
+tick-1sec
+/timestamp > SAMPLING_TIME/
+{
+ printf("\n");
+ printf("%s\n", LINE_SEP);
+ printf("%Y\n", walltimestamp);
+ printf("%s\n", LINE_SEP);
+
+ printf("\n");
+ printf("Top %d allocations by size:\n", TOP_RESULTS_COUNT);
+ trunc(@allocs_size, TOP_RESULTS_COUNT);
+ printa("%10@d %s\n", @allocs_size);
+
+ printf("\n");
+ printf("Top %d allocations by count:\n", TOP_RESULTS_COUNT);
+ trunc(@allocs_count, TOP_RESULTS_COUNT);
+ printa("%10@d %s\n", @allocs_count);
+
+ printf("\nTotal number of allocated objects: %d\n", ALLOCATED_OBJECTS_CNT);
+
+ SAMPLING_TIME = timestamp + INTERVAL_SECS * 1000000000ull;
+}
+
+:::END
+{
+ printf("\n");
+ printf("%s\n", LINE_SEP);
+ printf("%Y\n", walltimestamp);
+ printf("%s\n", LINE_SEP);
+
+ printf("\n");
+ printf("Top %d allocations by size:\n", TOP_RESULTS_COUNT);
+ trunc(@allocs_size, TOP_RESULTS_COUNT);
+ printa("%10@d %s\n", @allocs_size);
+
+ printf("\n");
+ printf("Top %d allocations by count:\n", TOP_RESULTS_COUNT);
+ trunc(@allocs_count, TOP_RESULTS_COUNT);
+ printa("%10@d %s\n", @allocs_count);
+
+ printf("\nTotal number of allocated objects: %d\n", ALLOCATED_OBJECTS_CNT);
+
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection.d b/staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection.d
new file mode 100644
index 0000000..510784f
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection.d
@@ -0,0 +1,136 @@
+#!/usr/sbin/dtrace -Zs
+
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. CriticalSection.d -c "java ..."
+ * 2. CriticalSection.d -p JAVA_PID
+ *
+ * The script inspect a JNI application for Critical Section violations.
+ *
+ * Critical section is the space between calls to JNI methods:
+ * - GetPrimitiveArrayCritical and ReleasePrimitiveArrayCritical; or
+ * - GetStringCritical and ReleaseStringCritical.
+ *
+ * Inside a critical section, native code must not call other JNI functions,
+ * or any system call that may cause the current thread to block and wait
+ * for another Java thread. (For example, the current thread must not call
+ * read on a stream being written by another Java thread.)
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+
+self int in_critical_section;
+self string critical_section_name;
+
+int CRITICAL_SECTION_VIOLATION_CNT;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "critical section violation checks";
+
+ printf("BEGIN %s\n", SAMPLE_NAME);
+}
+
+/*
+ * Multiple pairs of GetPrimitiveArrayCritical/ReleasePrimitiveArrayCritical,
+ * GetStringCritical/ReleaseStringCritical may be nested
+ */
+hotspot_jni$target:::*_entry
+/self->in_critical_section > 0 &&
+ probename != "GetPrimitiveArrayCritical_entry" &&
+ probename != "GetStringCritical_entry" &&
+ probename != "ReleasePrimitiveArrayCritical_entry" &&
+ probename != "ReleaseStringCritical_entry" &&
+ probename != "GetPrimitiveArrayCritical_return" &&
+ probename != "GetStringCritical_return" &&
+ probename != "ReleasePrimitiveArrayCritical_return" &&
+ probename != "ReleaseStringCritical_return"/
+{
+ printf("\nJNI call %s made from JNI critical region '%s'\n",
+ probename, self->critical_section_name);
+
+ printf("Jstack:\n");
+ jstack(50, 500);
+
+ CRITICAL_SECTION_VIOLATION_CNT ++;
+}
+
+syscall:::entry
+/pid == $target && self->in_critical_section > 0/
+{
+ printf("\nSystem call %s made in JNI critical region '%s'\n",
+ probefunc, self->critical_section_name);
+
+ printf("Jstack:\n");
+ jstack(50, 500);
+
+ CRITICAL_SECTION_VIOLATION_CNT ++;
+}
+
+hotspot_jni$target:::ReleasePrimitiveArrayCritical_entry,
+hotspot_jni$target:::ReleaseStringCritical_entry
+/self->in_critical_section > 0/
+{
+ self->in_critical_section --;
+}
+
+hotspot_jni$target:::GetPrimitiveArrayCritical_return
+{
+ self->in_critical_section ++;
+ self->critical_section_name = "GetPrimitiveArrayCritical";
+}
+
+hotspot_jni$target:::GetStringCritical_return
+{
+ self->in_critical_section ++;
+ self->critical_section_name = "GetStringCritical";
+}
+
+
+:::END
+{
+ printf("%d critical section violations have been discovered\n",
+ CRITICAL_SECTION_VIOLATION_CNT);
+
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection_slow.d b/staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection_slow.d
new file mode 100644
index 0000000..a676aa3
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot_jni/CriticalSection_slow.d
@@ -0,0 +1,178 @@
+#!/usr/sbin/dtrace -Zs
+
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. CriticalSection_slow.d -c "java ..."
+ * 2. CriticalSection_slow.d -p JAVA_PID
+ *
+ * The script inspect a JNI application for Critical Section violations.
+ *
+ * Critical section is the space between calls to JNI methods:
+ * - GetPrimitiveArrayCritical and ReleasePrimitiveArrayCritical; or
+ * - GetStringCritical and ReleaseStringCritical.
+ *
+ * Inside a critical section, native code must not call other JNI functions,
+ * or any system call that may cause the current thread to block and wait
+ * for another Java thread. (For example, the current thread must not call
+ * read on a stream being written by another Java thread.)
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+
+self int in_critical_section;
+self string critical_section_name;
+
+self char *str_ptr;
+self string class_name;
+self string method_name;
+self string signature;
+
+self int indent;
+self int JAVA_STACK_DEEP;
+
+int CRITICAL_SECTION_VIOLATION_CNT;
+
+:::BEGIN
+{
+ SAMPLE_NAME = "critical section violation checks";
+
+ printf("BEGIN %s\n", SAMPLE_NAME);
+}
+
+hotspot$target:::*
+/!self->JAVA_STACK_DEEP/
+{
+ self->JAVA_STACK_DEEP = 0;
+}
+
+
+hotspot$target:::method-return
+/self->JAVA_STACK_DEEP > 0/
+{
+ self->JAVA_STACK_DEEP --;
+}
+
+hotspot$target:::method-entry
+{
+ self->JAVA_STACK_DEEP ++;
+
+ self->str_ptr = (char*) copyin(arg1, arg2+1);
+ self->str_ptr[arg2] = '\0';
+ self->method_name = strjoin( (string) self->str_ptr, ":");
+
+ self->str_ptr = (char*) copyin(arg3, arg4+1);
+ self->str_ptr[arg4] = '\0';
+ self->method_name = strjoin(self->method_name, (string) self->str_ptr);
+ self->method_name = strjoin(self->method_name, ":");
+
+ self->str_ptr = (char*) copyin(arg5, arg6+1);
+ self->str_ptr[arg6] = '\0';
+ self->method_name = strjoin(self->method_name, (string) self->str_ptr);
+
+ self->JAVA_STACK[self->JAVA_STACK_DEEP] = self->method_name;
+
+/* printf("%-10u%*s%s\n",
+ * curcpu->cpu_id, self->indent, "", self->method_name);
+ */
+}
+
+
+/*
+ * Multiple pairs of GetPrimitiveArrayCritical/ReleasePrimitiveArrayCritical,
+ * GetStringCritical/ReleaseStringCritical may be nested
+ */
+hotspot_jni$target:::*_entry
+/self->in_critical_section > 0 &&
+ probename != "GetPrimitiveArrayCritical_entry" &&
+ probename != "GetStringCritical_entry" &&
+ probename != "ReleasePrimitiveArrayCritical_entry" &&
+ probename != "ReleaseStringCritical_entry" &&
+ probename != "GetPrimitiveArrayCritical_return" &&
+ probename != "GetStringCritical_return" &&
+ probename != "ReleasePrimitiveArrayCritical_return" &&
+ probename != "ReleaseStringCritical_return"/
+{
+ printf("JNI call %s made from JNI critical region '%s' from %s\n",
+ probename, self->critical_section_name,
+ self->JAVA_STACK[self->JAVA_STACK_DEEP]);
+
+ CRITICAL_SECTION_VIOLATION_CNT ++;
+}
+
+syscall:::entry
+/pid == $target && self->in_critical_section > 0/
+{
+ printf("system call %s made in JNI critical region '%s' from %s\n",
+ probefunc, self->critical_section_name,
+ self->JAVA_STACK[self->JAVA_STACK_DEEP]);
+
+ CRITICAL_SECTION_VIOLATION_CNT ++;
+}
+
+hotspot_jni$target:::ReleasePrimitiveArrayCritical_entry,
+hotspot_jni$target:::ReleaseStringCritical_entry
+/self->in_critical_section > 0/
+{
+ self->in_critical_section --;
+}
+
+hotspot_jni$target:::GetPrimitiveArrayCritical_return
+{
+ self->in_critical_section ++;
+ self->critical_section_name = "GetPrimitiveArrayCritical";
+}
+
+hotspot_jni$target:::GetStringCritical_return
+{
+ self->in_critical_section ++;
+ self->critical_section_name = "GetStringCritical";
+}
+
+
+:::END
+{
+ printf("%d critical section violations have been discovered\n",
+ CRITICAL_SECTION_VIOLATION_CNT);
+
+ printf("\nEND of %s\n", SAMPLE_NAME);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot_jni/README.txt b/staging/darwin-x86/sample/dtrace/hotspot_jni/README.txt
new file mode 100644
index 0000000..0c15a94
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot_jni/README.txt
@@ -0,0 +1,64 @@
+================================
+'hotspot_jni' PROBES DESCRIPTION
+================================
+
+This directory contains D scripts which demonstrate usage of 'hotspot_jni'
+provider probes.
+
+In order to call from native code to Java code, due to embedding of the VM
+in an application or execution of native code within a Java application, the
+native code must make a call through the JNI interface. The JNI interface
+provides a number of methods for invoking Java code and examining the state
+of the VM. DTrace probes are provided at the entry point and return point
+for each of these methods. The probes are provided by the hotspot_jni
+provider. The name of the probe is the name of the JNI method, appended with
+"-entry" for entry probes, and "-return" for return probes. The arguments
+available at each entry probe are the arguments that were provided to the
+function (with the exception of the Invoke* methods, which omit the
+arguments that are passed to the Java method). The return probes have the
+return value of the method as an argument (if available).
+
+You can find more information about HotSpot probes here:
+http://java.sun.com/javase/6/docs/technotes/guides/vm/dtrace.html
+
+===========
+THE SCRIPTS
+===========
+
+The following scripts/samples which demonstrate hotspot_jni probes usage are
+available:
+
+- CriticalSection.d
+ Inspect a JNI application for Critical Section violations.
+
+- CriticalSection_slow.d
+ Do the same as CriticalSection.d but provide more debugging info.
+
+- hotspot_jni_calls_stat.d
+ This script collects statistics about how many times particular JNI method
+ has been called.
+
+- hotspot_jni_calls_tree.d
+ The script prints tree of JNI method calls.
+
+See more details in the scripts.
+
+
+==========
+HOW TO RUN
+==========
+To run any dscript from hotspot directory you can do either:
+
+ # dscript.d -c "java ..."
+
+ or if you don't have Solaris 10 patch which allows to specify probes that
+ don't yet exist ( Hotspot DTrace probes are defined in libjvm.so and as
+ result they could be not been yet loaded when you try to attach dscript to
+ the Java process) do:
+
+ # ../helpers/dtrace_helper.d -c "java ..." dscript.d
+
+ or if your application is already running you can just simply attach
+ the D script like:
+
+ # dscript.d -p JAVA_PID
diff --git a/staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_stat.d b/staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_stat.d
new file mode 100644
index 0000000..8db9e16
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_stat.d
@@ -0,0 +1,81 @@
+#!/usr/sbin/dtrace -Zs
+
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. hotspot_jni_calls_stat.d -c "java ..."
+ * 2. hotspot_jni_calls_stat.d -p JAVA_PID
+ *
+ * This script collects statistics about how many times particular JNI
+ * method has been called.
+ *
+ */
+
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+
+:::BEGIN
+{
+ printf("BEGIN hotspot_jni tracing\n");
+}
+
+
+hotspot_jni$target:::*-entry
+{
+ JNI_CALLS ++;
+ @jni_calls[probename] = count();
+}
+
+:::END
+{
+ printa("%10@d %s\n", @jni_calls);
+ printf("\n");
+ printf("Total number of JNI calls: %d\n", JNI_CALLS);
+
+ printf("\nEND hotspot_jni tracing.\n");
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_tree.d b/staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_tree.d
new file mode 100644
index 0000000..7aeb208
--- /dev/null
+++ b/staging/darwin-x86/sample/dtrace/hotspot_jni/hotspot_jni_calls_tree.d
@@ -0,0 +1,91 @@
+#!/usr/sbin/dtrace -Zs
+
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+*/
+
+/*
+ * Usage:
+ * 1. hotspot_jni_calls_tree.d -c "java ..."
+ * 2. hotspot_jni_calls_tree.d -p JAVA_PID
+ *
+ * The script prints tree of JNI method calls.
+ *
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option defaultargs
+#pragma D option bufsize=16m
+#pragma D option aggrate=100ms
+
+
+self int indent;
+
+:::BEGIN
+{
+ printf("BEGIN hotspot_jni tracing\n");
+}
+
+
+hotspot_jni$target:::*
+/!self->indent/
+{
+ self->indent = 11;
+}
+
+hotspot_jni$target:::*-entry
+{
+ self->indent++;
+ printf("%d %*s -> %s\n", curcpu->cpu_id, self->indent, "", probename);
+}
+
+
+hotspot_jni$target:::*-return
+{
+ printf("%d %*s <- %s\n", curcpu->cpu_id, self->indent, "", probename);
+ self->indent--;
+}
+
+:::END
+{
+ printf("\nEND hotspot_jni tracing.\n");
+
+}
+
+syscall::rexit:entry,
+syscall::exit:entry
+/pid == $target/
+{
+ exit(0);
+}
diff --git a/staging/darwin-x86/sample/forkjoin/mergesort/MergeDemo.java b/staging/darwin-x86/sample/forkjoin/mergesort/MergeDemo.java
new file mode 100644
index 0000000..528f383
--- /dev/null
+++ b/staging/darwin-x86/sample/forkjoin/mergesort/MergeDemo.java
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.util.Arrays;
+import java.util.Random;
+
+import static java.lang.Integer.parseInt;
+
+/**
+ * MergeExample is a class that runs a demo benchmark of the {@code ForkJoin} framework
+ * by benchmarking a {@link MergeSort} algorithm that is implemented using
+ * {@link java.util.concurrent.RecursiveAction}.
+ * The {@code ForkJoin} framework is setup with different parallelism levels
+ * and the sort is executed with arrays of different sizes to see the
+ * trade offs by using multiple threads for different sizes of the array.
+ */
+public class MergeDemo {
+ // Use a fixed seed to always get the same random values back
+ private final Random random = new Random(759123751834L);
+ private static final int ITERATIONS = 10;
+
+ /**
+ * Represents the formula {@code f(n) = start + (step * n)} for n = 0 & n < iterations
+ */
+ private static class Range {
+ private final int start;
+ private final int step;
+ private final int iterations;
+
+ private Range(int start, int step, int iterations) {
+ this.start = start;
+ this.step = step;
+ this.iterations = iterations;
+ }
+
+ /**
+ * Parses start, step and iterations from args
+ * @param args the string array containing the arguments
+ * @param start which element to start the start argument from
+ * @return the constructed range
+ */
+ public static Range parse(String[] args, int start) {
+ if (args.length < start + 3) {
+ throw new IllegalArgumentException("Too few elements in array");
+ }
+ return new Range(parseInt(args[start]), parseInt(args[start + 1]), parseInt(args[start + 2]));
+ }
+
+ public int get(int iteration) {
+ return start + (step * iteration);
+ }
+
+ public int getIterations() {
+ return iterations;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(start).append(" ").append(step).append(" ").append(iterations);
+ return builder.toString();
+ }
+ }
+
+ /**
+ * Wraps the different parameters that is used when running the MergeExample.
+ * {@code sizes} represents the different array sizes
+ * {@code parallelism} represents the different parallelism levels
+ */
+ private static class Configuration {
+ private final Range sizes;
+ private final Range parallelism;
+
+ private final static Configuration defaultConfig = new Configuration(new Range(20000, 20000, 10),
+ new Range(2, 2, 10));
+
+ private Configuration(Range sizes, Range parallelism) {
+ this.sizes = sizes;
+ this.parallelism = parallelism;
+ }
+
+ /**
+ * Parses the arguments and attempts to create a configuration containing the
+ * parameters for creating the array sizes and parallelism sizes
+ * @param args the input arguments
+ * @return the configuration
+ */
+ public static Configuration parse(String[] args) {
+ if (args.length == 0) {
+ return defaultConfig;
+ } else {
+ try {
+ if (args.length == 6) {
+ return new Configuration(Range.parse(args, 0), Range.parse(args, 3));
+ }
+ } catch (NumberFormatException e) {
+ System.err.println("MergeExample: error: Argument was not a number.");
+ }
+ System.err.println("MergeExample <size start> <size step> <size steps> <parallel start> <parallel step>" +
+ " <parallel steps>");
+ System.err.println("example: MergeExample 20000 10000 3 1 1 4");
+ System.err.println("example: will run with arrays of sizes 20000, 30000, 40000" +
+ " and parallelism: 1, 2, 3, 4");
+ return null;
+ }
+ }
+
+ /**
+ * Creates an array for reporting the test result time in
+ * @return an array containing {@code sizes.iterations * parallelism.iterations} elements
+ */
+ private long[][] createTimesArray() {
+ return new long[sizes.getIterations()][parallelism.getIterations()];
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("");
+ if (this == defaultConfig) {
+ builder.append("Default configuration. ");
+ }
+ builder.append("Running with parameters: ");
+ builder.append(sizes);
+ builder.append(" ");
+ builder.append(parallelism);
+ return builder.toString();
+ }
+ }
+
+ /**
+ * Generates an array of {@code elements} random elements
+ * @param elements the number of elements requested in the array
+ * @return an array of {@code elements} random elements
+ */
+ private int[] generateArray(int elements) {
+ int[] array = new int[elements];
+ for (int i = 0; i < elements; ++i) {
+ array[i] = random.nextInt();
+ }
+ return array;
+ }
+
+ /**
+ * Runs the test
+ * @param config contains the settings for the test
+ */
+ private void run(Configuration config) {
+ Range sizes = config.sizes;
+ Range parallelism = config.parallelism;
+
+ // Run a couple of sorts to make the JIT compile / optimize the code
+ // which should produce somewhat more fair times
+ warmup();
+
+ long[][] times = config.createTimesArray();
+
+ for (int size = 0; size < sizes.getIterations(); size++) {
+ runForSize(parallelism, sizes.get(size), times, size);
+ }
+
+ printResults(sizes, parallelism, times);
+ }
+
+ /**
+ * Prints the results as a table
+ * @param sizes the different sizes of the arrays
+ * @param parallelism the different parallelism levels used
+ * @param times the median times for the different sizes / parallelism
+ */
+ private void printResults(Range sizes, Range parallelism, long[][] times) {
+ System.out.println("Time in milliseconds. Y-axis: number of elements. X-axis parallelism used.");
+ long[] sums = new long[times[0].length];
+ System.out.format("%8s ", "");
+ for (int i = 0; i < times[0].length; i++) {
+ System.out.format("%4d ", parallelism.get(i));
+ }
+ System.out.println("");
+ for (int size = 0; size < sizes.getIterations(); size++) {
+ System.out.format("%8d: ", sizes.get(size));
+ for (int i = 0; i < times[size].length; i++) {
+ sums[i] += times[size][i];
+ System.out.format("%4d ", times[size][i]);
+ }
+ System.out.println("");
+ }
+ System.out.format("%8s: ", "Total");
+ for (long sum : sums) {
+ System.out.format("%4d ", sum);
+ }
+ System.out.println("");
+ }
+
+ private void runForSize(Range parallelism, int elements, long[][] times, int size) {
+ for (int step = 0; step < parallelism.getIterations(); step++) {
+ long time = runForParallelism(ITERATIONS, elements, parallelism.get(step));
+ times[size][step] = time;
+ }
+ }
+
+ /**
+ * Runs <i>iterations</i> number of test sorts of a random array of <i>element</i> length
+ * @param iterations number of iterations
+ * @param elements number of elements in the random array
+ * @param parallelism parallelism for the ForkJoin framework
+ * @return the median time of runs
+ */
+ private long runForParallelism(int iterations, int elements, int parallelism) {
+ MergeSort mergeSort = new MergeSort(parallelism);
+ long[] times = new long[iterations];
+
+ for (int i = 0; i < iterations; i++) {
+ // Suggest the VM to run a garbage collection to reduce the risk of getting one
+ // while running the test run
+ System.gc();
+ long start = System.currentTimeMillis();
+ mergeSort.sort(generateArray(elements));
+ times[i] = System.currentTimeMillis() - start;
+ }
+
+ return medianValue(times);
+ }
+
+ /**
+ * Calculates the median value of the array
+ * @param times array of times
+ * @return the median value
+ */
+ private long medianValue(long[] times) {
+ if (times.length == 0) {
+ throw new IllegalArgumentException("Empty array");
+ }
+ // Make a copy of times to avoid having side effects on the parameter value
+ Arrays.sort(times.clone());
+ long median = times[times.length / 2];
+ if (times.length > 1 && times.length % 2 != 0) {
+ median = (median + times[times.length / 2 + 1]) / 2;
+ }
+ return median;
+ }
+
+ /**
+ * Generates 1000 arrays of 1000 elements and sorts them as a warmup
+ */
+ private void warmup() {
+ MergeSort mergeSort = new MergeSort(Runtime.getRuntime().availableProcessors());
+ for (int i = 0; i < 1000; i++) {
+ mergeSort.sort(generateArray(1000));
+ }
+ }
+
+ public static void main(String[] args) {
+ Configuration configuration = Configuration.parse(args);
+ if (configuration == null) {
+ System.exit(1);
+ }
+ System.out.println(configuration);
+ new MergeDemo().run(configuration);
+ }
+}
diff --git a/staging/darwin-x86/sample/forkjoin/mergesort/MergeSort.java b/staging/darwin-x86/sample/forkjoin/mergesort/MergeSort.java
new file mode 100644
index 0000000..0ae48dc
--- /dev/null
+++ b/staging/darwin-x86/sample/forkjoin/mergesort/MergeSort.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.util.Arrays;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinTask;
+import java.util.concurrent.RecursiveAction;
+
+/**
+ * A class for sorting an array of {@code ints} in parallel.
+ * A {@code ForkJoinPool} is used for the parallelism, using the merge sort
+ * algorithm the array is split into halves and a new sub task is created
+ * for each part. Each sub task is dispatched to the {@code ForkJoinPool}
+ * which will schedule the task to a {@code Thread}.
+ * This happens until the size of the array is at most 2
+ * elements long. At this point the array is sorted using a simple compare
+ * and possibly a swap. The tasks then finish by using insert sort to
+ * merge the two just sorted arrays.
+ *
+ * The idea of this class is to demonstrate the usage of RecursiveAction not
+ * to implement the best possible parallel merge sort. This version creates
+ * a small array for each merge (creating a lot of objects), this could
+ * be avoided by keeping a single array.
+ */
+public class MergeSort {
+ private final ForkJoinPool pool;
+
+ private static class MergeSortTask extends RecursiveAction {
+ private final int[] array;
+ private final int low;
+ private final int high;
+ private static final int THRESHOLD = 8;
+
+ /**
+ * Creates a {@code MergeSortTask} containing the array and the bounds of the array
+ *
+ * @param array the array to sort
+ * @param low the lower element to start sorting at
+ * @param high the non-inclusive high element to sort to
+ */
+ protected MergeSortTask(int[] array, int low, int high) {
+ this.array = array;
+ this.low = low;
+ this.high = high;
+ }
+
+ @Override
+ protected void compute() {
+ if (high - low <= THRESHOLD) {
+ Arrays.sort(array, low, high);
+ } else {
+ int middle = low + ((high - low) >> 1);
+ // Execute the sub tasks and wait for them to finish
+ invokeAll(new MergeSortTask(array, low, middle), new MergeSortTask(array, middle, high));
+ // Then merge the results
+ merge(middle);
+ }
+ }
+
+ /**
+ * Merges the two sorted arrays this.low, middle - 1 and middle, this.high - 1
+ * @param middle the index in the array where the second sorted list begins
+ */
+ private void merge(int middle) {
+ if (array[middle - 1] < array[middle]) {
+ return; // the arrays are already correctly sorted, so we can skip the merge
+ }
+ int[] copy = new int[high - low];
+ System.arraycopy(array, low, copy, 0, copy.length);
+ int copyLow = 0;
+ int copyHigh = high - low;
+ int copyMiddle = middle - low;
+
+ for (int i = low, p = copyLow, q = copyMiddle; i < high; i++) {
+ if (q >= copyHigh || (p < copyMiddle && copy[p] < copy[q]) ) {
+ array[i] = copy[p++];
+ } else {
+ array[i] = copy[q++];
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates a {@code MergeSort} containing a ForkJoinPool with the indicated parallelism level
+ * @param parallelism the parallelism level used
+ */
+ public MergeSort(int parallelism) {
+ pool = new ForkJoinPool(parallelism);
+ }
+
+ /**
+ * Sorts all the elements of the given array using the ForkJoin framework
+ * @param array the array to sort
+ */
+ public void sort(int[] array) {
+ ForkJoinTask<Void> job = pool.submit(new MergeSortTask(array, 0, array.length));
+ job.join();
+ }
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/build.properties b/staging/darwin-x86/sample/jmx/jmx-scandir/build.properties
new file mode 100644
index 0000000..cad4a6a
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/build.properties
@@ -0,0 +1,58 @@
+# IMPORTANT NOTE
+#
+# If you made a private copy of this project you may have to update the
+# nbjdk.home variable at the end of this file.
+#
+# To be able to run the test-suite, you will also have to set the
+# variable:
+#
+# libs.junit.classpath=<junit.jar>
+#
+
+main.dir=.
+
+src.dir=${main.dir}/src
+test.src.dir=${main.dir}/test
+
+build.dir=build
+classes.dir=${build.dir}/classes
+
+dist.dir=dist
+jar=${dist.dir}/jmx-scandir.jar
+javadoc.dir=${dist.dir}/javadoc
+
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+
+build.sysclasspath=ignore
+# E.g.: cp=lib/x.jar:lib/y.jar
+cp=
+extra.run.cp=
+
+# To be able to run the test-suite, set the following property:
+# libs.junit.classpath=...
+
+javac.test.classpath=\
+ ${classes.dir}:\
+ ${libs.junit.classpath}
+
+main.agent.class=com.sun.jmx.examples.scandir.ScanDirAgent
+main.client.class=com.sun.jmx.examples.scandir.ScanDirClient
+main.class=${main.client.class}
+
+run.jvmargs=-Djava.util.logging.config.file=logging.properties
+common.jvmargs=${run.jvmargs} -Djavax.net.ssl.keyStore=keystore -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=truststore -Djavax.net.ssl.trustStorePassword=trustword
+client.jvmargs=${common.jvmargs}
+agent.jvmargs=${common.jvmargs} -Dcom.sun.management.config.file=src/etc/management.properties -Dscandir.config.file=src/etc/testconfig.xml
+
+client.args=localhost 4545
+
+run.cp=${cp}:${classes.dir}:${extra.run.cp}
+run.test.classpath=${run.cp}:${build.test.classes.dir}
+
+debug=true
+deprecation=false
+
+# Update this variable if need be to point to the JDK 6 location.
+#
+nbjdk.home=${basedir}/../../..
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/build.xml b/staging/darwin-x86/sample/jmx/jmx-scandir/build.xml
new file mode 100644
index 0000000..e54fcec
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/build.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+
+<!--
+ This is ant (http://ant.apache.org) build script to build the
+ "jmx-scandir" sample. Either this build.xml can be used standalone
+ with "ant" tool or can be opened as a project with NetBeans IDE
+ (http://www.netbeans.org).
+-->
+
+<project name="jmx-scandir" default="jar" basedir=".">
+
+ <import file="nbproject/jdk.xml"/>
+
+
+ <target name="-prop-init">
+ <property file="user.build.properties"/>
+ <property file="build.properties"/>
+ </target>
+
+ <target name="-init" depends="-prop-init,-jdk-init"/>
+
+ <target name="compile" depends="-init" description="Compile main sources.">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ </javac>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}"/>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile" description="Build JAR file for main sources.">
+ <mkdir dir="${dist.dir}" />
+ <jar jarfile="${jar}" compress="true">
+ <manifest>
+ <attribute name="Main-Class" value="${main.agent.class}"/>
+ </manifest>
+ <fileset dir="${classes.dir}"/>
+ </jar>
+ </target>
+
+ <target name="run-client" depends="compile" description="Run client.">
+ <fail unless="main.client.class">Must set property 'main.client.class' (e.g. in build.properties)</fail>
+ <java classname="${main.client.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg line="${client.jvmargs}" />
+ <arg line="${client.args}" />
+ </java>
+ </target>
+
+ <target name="run-agent" depends="compile" description="Run agent.">
+ <fail unless="main.agent.class">Must set property 'main.agent.class' (e.g. in build.properties)</fail>
+ <java classname="${main.agent.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg line="${agent.jvmargs}" />
+ </java>
+ </target>
+
+ <target name="run" depends="run-agent" description="Run agent." />
+
+ <target name="run-single" depends="-init,compile">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <java classname="${run.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ </java>
+ </target>
+
+ <target name="javadoc" depends="-init" description="Build Javadoc.">
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc destdir="${javadoc.dir}">
+ <classpath path="${cp}"/>
+ <sourcepath>
+ <pathelement location="${src.dir}"/>
+ </sourcepath>
+ <fileset dir="${src.dir}"/>
+ </javadoc>
+ </target>
+
+ <target name="clean" depends="-init" description="Clean build products.">
+ <delete dir="${build.dir}"/>
+ <delete file="${jar}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+
+ <target name="profile">
+ <ant antfile="nbproject/netbeans-targets.xml" target="profile"/>
+ </target>
+
+ <!-- JUnit targets -->
+
+ <target name="compile-test" depends="-init,compile">
+ <fail unless="libs.junit.classpath">Must set libs.junit.classpath variable to the JUnit classpath in the build.properties file.</fail>
+ <mkdir dir="${build.test.classes.dir}"/>
+ <javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="${debug}" classpath="${javac.test.classpath}"/>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.src.dir}" excludes="**/*.java"/>
+ </copy>
+ </target>
+
+ <target name="-do-test-run" depends="-init,compile-test">
+ <mkdir dir="${build.test.results.dir}"/>
+ <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.src.dir}" includes="**/*Test.java"/>
+ </batchtest>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper type="glob" from="test-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${run.jvmargs}"/>
+ </junit>
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+
+ <target name="test" depends="-init,compile-test,-do-test-run" description="Run unit tests."/>
+
+ <target name="-do-test-run-single" depends="-init,compile-test">
+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+ <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.src.dir}" includes="${test.includes}"/>
+ </batchtest>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper type="glob" from="test-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${run.jvmargs}"/>
+ </junit>
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+
+ <target name="test-single" depends="-init,compile-test,-do-test-run-single" description="Run single unit test."/>
+</project>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpg
new file mode 100644
index 0000000..6a58f0e
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpg
new file mode 100644
index 0000000..86add09
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpg
new file mode 100644
index 0000000..0259e96
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpg
new file mode 100644
index 0000000..001b0fa
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpg
new file mode 100644
index 0000000..90d07a0
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpg
new file mode 100644
index 0000000..9e0a10c
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpg
new file mode 100644
index 0000000..75e7baf
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpg b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpg
new file mode 100644
index 0000000..5bceae5
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpg
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/index.html b/staging/darwin-x86/sample/jmx/jmx-scandir/index.html
new file mode 100644
index 0000000..4fd2ae6
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/index.html
@@ -0,0 +1,2217 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+ <head>
+<!--
+ Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+ <title>JMX(TM) "scandir" Example</title>
+ </head>
+ <body>
+
+ <h1><center>Java<font size="-1"><sup>TM</sup></font> Management Extensions (JMX<font size="-1"><sup>TM</sup></font>) <i>scandir</i> Example</center></h1>
+
+ <h2><a name="h2-Introduction">Introduction</a></h2>
+ <ul>
+ <p>The JMX <i>scandir</i> example is an application that
+ scans parts of a filesystem - e.g. a set of directories
+ used by a number of lab machines when running tests - in
+ order to clean up and optimize disk space by removing
+ obsolete files - e.g. files that are leaked by the test
+ suites running on those machines, like coredump files, or
+ temporary files that might remain after a test crash.
+ It could also serve as a basis for an application that
+ would monitor disk usage and suggest removal of old big
+ long-unaccessed files.
+ </p>
+ <p>The JMX <i>scandir</i> example does not however implement
+ the full fledged logic that such an application might
+ have. It implements a subset of this logic which is
+ sufficient to demonstrate common patterns and
+ solutions used when implementing a monitoring and
+ management interface for an application with JMX
+ Technology.</p>
+ <p>This example is an advanced JMX example, which presents
+ advanced JMX concepts. It is assumed that the reader is already
+ familiar with the JMX API. Newcomers to JMX Technology are
+ invited to have a look at the <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/jmx/"
+ >JMX API Overview, Tutorial and Examples</a> before going any further.
+ </p>
+ <p></p>
+ <hr>
+ <blockquote>
+ <u>Note:</u> This example was developed using <a
+ href="http://www.netbeans.org">NetBeans 5.0 IDE</a>. The instructions
+ given in this document to build, run, and test the example assume that
+ you have at your disposal:
+ <ul><li>either <a href="http://www.netbeans.org">NetBeans 5.0 IDE</a>,</li>
+ <li>or <a href="http://ant.apache.org/">Apache Ant 1.6.5</a> and
+ <a href="http://sourceforge.net/projects/junit/">JUnit 3.8.1 or
+ 3.8.2</a><br>
+ (JUnit is only needed to run the example's unit tests).
+ </li>
+ </ul>
+ <p><a name="setup">In order to build the example</a>,
+ <u>you may need to copy the jmx-scandir</u>
+ directory to somewhere where you have write permissions.
+ <br>In that case, you will need to update the <i>nbjdk.home</i> variable
+ in the copied <i><a href="build.properties">build.properties</a></i>
+ file located at the root of the copied project directory.
+ Please make sure that this variable points to the JDK 6 home directory.
+ </p>
+ <p>If you wish to run the testsuite from within the <a
+ href="http://www.netbeans.org">NetBeans IDE</a> you will also have
+ to set the <i>libs.junit.classpath</i> variable in
+ <a href="build.properties">build.properties</a>.
+ The <i>libs.junit.classpath</i> variable should point to your
+ <a href="http://sourceforge.net/projects/junit/">junit.jar</a>,
+ version 3.8.1 or 3.8.2.
+ </p>
+ </blockquote>
+ <hr>
+ <p></p>
+ <p><u>Table Of Contents:</u></p>
+ <p><center>[<a href="#h2-Generating">Generating&nbsp;the&nbsp;Java&nbsp;Documentation</a>]
+ [<a href="#h2-Overview">Overview&nbsp;of&nbsp;the&nbsp;<i>scandir</i>&nbsp;Example</a>]
+ [<a href="#h2-API-Doc">API&nbsp;Documentation&nbsp;and&nbsp;Sources</a>]
+ [<a href="#h2-Patterns">Patterns,&nbsp;Best&nbsp;Practices,&nbsp;and&nbsp;Common&nbsp;Pitfalls</a>]
+ [<a href="#h2-Testing">Testing&nbsp;the&nbsp;<i>scandir</i>&nbsp;Example</a>]
+ [<a href="#h2-Running">Running&nbsp;the&nbsp;<i>scandir</i>&nbsp;Example</a>]
+ [<a href="#h2-Playing">Playing&nbsp;with&nbsp;JConsole</a>]
+ [<a href="#h2-Turning">Turning&nbsp;the&nbsp;example&nbsp;into&nbsp;a&nbsp;Secure&nbsp;JMX&nbsp;Application</a>]
+ [<a href="#h2-Connecting">Connecting&nbsp;to&nbsp;the&nbsp;Secure&nbsp;JMX&nbsp;Application</a>]
+ [<a href="#h2-Conclusion">Conclusion</a>]
+ [<a href="#h2-References">References</a>]</center></p>
+
+ </ul>
+ <h2><a name="h2-Generating">Generating the Java Documentation</a></h2>
+
+ <ul>
+ <p>Before reading further, you will need to generate the
+ Java Documentation for the example's sources.</p>
+ <p>In the example root directory (where the <code>build.xml</code>
+ file is located) run the following command:
+ <pre>ant javadoc</pre>
+ </p>
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE and generate the Javadoc from its <code>Build</code>
+ menu.
+ </p>
+ <p>If building the documentation fails, please make sure to read the
+ <a href="#setup">note</a> at the beginning of this document.</p>
+ </ul>
+
+ <h2><a name="h2-Overview">Overview of the <i>scandir</i> Example</a></h2>
+
+ <ul>
+ <p>The JMX <i>scandir</i> example is built around the
+ following MBeans:</p>
+ <ul>
+ <li>The first MBean we will present here is the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a>. <br>A
+ <code>DirectoryScannerMXBean</code> is an MBean that scans a
+ file system starting at a given root directory, and then looks
+ for files that match the given criteria. When such a file is
+ found, the <code>DirectoryScannerMXBean</code> takes the
+ action for which it was configured: emit a notification,
+ <i>and/or</i> log a <code>record</code> for this file,
+ <i>and/or</i> delete that file. The code that would actually
+ delete the file is commented out - so that nothing valuable is
+ lost if the example is run by mistake on the wrong set of
+ directories.<br> <code>DirectoryScannerMXBeans</code> are
+ created by the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> - see next item on the list, from its
+ configuration.
+ </li>
+ <li>
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> is the actual entry point of the
+ application. It reads the application's
+ configuration, and from that configuration,
+ will create a <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html"
+title="The ResultLogManager is in charge of managing result logs"
+ >ResultLogManager</a> and some <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a>.
+ <br>The <code>ScanManagerMXBean</code> lets you start, stop, and
+ schedule directory scans. The
+ <code>ScanManagerMXBean</code> is a singleton
+ MBean: there can be at most one instance of such
+ an MBean registered in a given MBeanServer.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> is an MBean which is able to
+ load/save the configuration to/from an XML file. It
+ will also let you modify that configuration - by e.g.
+ creating new directory scanners in there.
+ The corresponding MBeans will be created later, only
+ when you later
+ ask the <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> </code> to apply the
+ configuration again.<br>
+ The <code>ScanDirConfigMXBean</code> is created by the
+ <code>ScanManagerMXBean</code>, when the
+ <code>ScanManagerMXBean</code> is registered.
+ It is also possible to create an alternate
+ <code>ScanDirConfigMXBean</code>, and to switch the
+ <code>ScanDirConfigMXBean</code> to use one or the other
+ configuration.
+ <br>An example of XML configuration file is given
+ <a href="src/etc/testconfig.xml"
+ title="An Example Of Configuration"
+ >here</a>. Although you could edit such a file by
+ hand, it is easier to do it programmatically (or
+ with <a href="#JConsole">JConsole</a>) through
+ the <code>ScanDirConfigMXBean</code> interface.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> is in charge of managing result logs.
+ <br>Directory Scanners can be configured to log a
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/ResultRecord.html"
+title="A ResultRecord contains information about a file matching the criteria of a Directory Scanner"
+ >ResultRecord</a> whenever they take action upon a file that
+ matches their criteria. The <code>ResultLogManagerMXBean</code> is
+ responsible for logging these result records.
+ The <code>ResultLogManagerMXBean</code> can be configured to log
+ such records to a flat file, or into a log held in memory, or
+ both. Both logs (file and memory) can be configured with a
+ maximum capacity.
+ <br>When the maximum capacity of the memory
+ log is reached, its first entry (i.e. its oldest entry) is
+ removed to make place for the latest one.
+ <br>When the maximum
+ capacity of the file log is reached, the file is
+ renamed by appending a tilde '~' to its name and a
+ new result log is created.
+ <br>The <code>ResultLogManagerMXBean</code>
+ will let you interactively clear these result logs, change their
+ capacity, and decide where (memory or file) to log.
+ The memory log is useful in that its content can be interactively
+ returned by the <code>ResultLogManagerMXBean</code>, while
+ the file log doesn't have this facility.<br>
+ The result logs are intended to be used by e.g. an offline
+ program that would take some actions on the files that
+ matched the scan criteria:
+ <br>The <i>scandir</i> application
+ could be configured to only produce logs (i.e. takes no
+ action but logging the matching files), and the real
+ action could be performed by another program or module (e.g. mail the result log to the engineer who
+ maintains the lab, or parse that log and delete all the
+ files listed there, or parse the log and prepare and send
+ a single mail to each owner of matching files, containing
+ the list of files they should consider deleting).<br>
+ The <code>ResultLogManagerMXBean</code> is a singleton
+ MBean created by the <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> </code>
+ which reads and writes its configuration from the
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code>.
+ </li>
+ </ul>
+ <p>An application <code>main()</code> method is
+ provided in the <a
+ href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+ >ScanDirAgent</a> class. The <code>main()</code> simply registers
+ a <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> </code> in the platform MBeanServer, and
+ then waits for someone to call <code>close()</code> on the
+ <code>ScanManagerMXBean</code>.
+ </p>
+ <p>When the <code>ScanManagerMXBean</code> is registered, it
+ will create a default <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code> bound
+ to a default XML config file.
+ </p>
+ <p>The application's default XML config file is determined as
+ follows:
+ <ol>
+ <li>If the property <code>scandir.config.file</code> is
+ defined, the default application file will be the
+ file pointed to by this property. If that file
+ doesn't exist, it will be created when
+ <code>ScanDirConfigMXBean.save()</code> is
+ invoked.
+ </li>
+ <li>Otherwise the application config file is
+ assumed to be a file called <code>jmx-scandir.xml</code>,
+ located in the user's directory (as defined by
+ the System property <code>user.home</code>).
+ If that file doesn't exists, it will be created when
+ <code>ScanDirConfigMXBean.save()</code> is
+ invoked.
+ </li>
+ </ol>
+ <p>It is worth noting that this project is defined to
+ run with the following properties:
+ <pre>-Djava.util.logging.config.file=logging.properties</pre>
+ <pre>-Dscandir.config.file=src/etc/testconfig.xml</pre>
+ With <code>ScanDirAgent</code> defined as the project's
+ main class. Hence when you invoke from the NetBeans IDE
+ <i>Run Project</i> on the <i>jmx-scandir</i> project,
+ or <i>Run file</i> on the <code>ScanDirAgent</code>, the
+ application starts with the test configuration provided in
+ <a href="src/etc/testconfig.xml"
+ title="An Example Of Configuration"
+ >src/etc/testconfig.xml</a>
+ </p>
+ </ul>
+ <h2><a name="h2-API-Doc">API Documentation and Sources</a></h2>
+ <ul>
+ <p>Once generated, the Javadoc of example classes can
+ be found starting from <a href="dist/javadoc/index.html"
+ title="The API Documentation"
+ ><code>dist/javadoc/index.html</code></a>.</p>
+ <p>You can view the sources in the <a
+ href="src"
+ title="The Example Source Tree"
+ ><code>src</code></a> subdirectory.</p>
+ </ul>
+ <h2><a name="h2-Patterns">Patterns, Best Practices, and Common Pitfalls</a></h2>
+ <ul>
+ <p>This section discusses some common patterns and
+ design choices that this example demonstrates, and some pitfalls that
+ it avoids.
+ </ul>
+ <h3>MBeans or MXBeans?</h3>
+ <ul>
+ <p>What is an MXBean? MXBeans made their appearance in
+ J2SE 5.0 (Tiger), with the Management and Monitoring
+ API of the JVM. However, Java SE 6 is the first
+ Java SE release that contains a standard framework which
+ makes it possible to create and register your own MXBeans.
+ </p>
+ <p>MXBeans are a special kind of MBean, which once registered
+ in the MBeanServer, get automatically transformed into
+ OpenMBeans. From a developer point of view, nothing changes:
+ A Wombat MBean can become an MXBean simply by renaming
+ its <code>WombatMBean</code> interface into <code>WombatMXBean</code>.</p>
+ <p>Using MXBeans rather than plain Standard MBean brings its
+ own advantages:</p>
+ <ul>
+ <li>
+ Generic tools, like JConsole, will be able to
+ display and interact with your MXBeans nicely, even
+ if your MXBean interfaces reference custom types
+ - e.g. custom Java enums. This is because all the types
+ exposed by your MXBeans are converted to Open Types.
+ Just look at the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> with JConsole and you will
+ understand the benefits.
+ </li>
+ <li>
+ When writing a programmatic client, you can obtain
+ a proxy that implements the original MXBean interface,
+ and forget about the Open Type conversion.
+ The JUnit unit tests that come with this example
+ use this feature very widely. Have a look at them.
+ </li>
+ <li>
+ The MXBean framework also lets you nicely navigate
+ from one MXBean to another: your MXBeans can
+ have attributes and parameters which are proxies
+ to other MXBeans! We demonstrate this in the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> which exposes a list
+ of <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a></code> and points
+ towards a <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code>.
+ </li>
+ </ul>
+ <p>In short, MXBeans are so much easier to use that
+ this example doesn't even have a single regular
+ Standard MBean.
+ </p>
+ <p>See also <a
+href="http://weblogs.java.net/blog/emcmanus/archive/2006/02/what_is_an_mxbe.html"
+title="What is an MXBean?"
+ >What is an MXBean?</a>
+ and <a
+href="http://weblogs.java.net/blog/emcmanus/archive/2006/06/intermxbean_ref.html"
+title="Inter-MXBean references"
+ >Inter-MXBean References</a>.
+ </p>
+ <blockquote><u>Hint:</u> In order to simplify the task of coding a
+ JMX programmatic client, we recommend that getters, setters, and
+ operations defined in MBean and MXBean interfaces throw
+ <code>IOException</code>. Proxy objects will then be able
+ to rethrow directly any <code>IOException</code> received from
+ their underlying MBean Server connection, without wrapping
+ them into <code>UndeclaredThrowableExceptions</code>.<br>
+ Since the life cycle of the proxy object is not directly tied to
+ the life cycle of the MBean it proxies, you may also want to
+ have all methods in the MBean or MXBean interface throw
+ <code>InstanceNotFoundException</code> or more generally
+ <code>JMException</code>.
+ </blockquote>
+ </ul>
+ <h3>MBean Names - aka ObjectNames</h3>
+ <ul>
+ <p>As you must know if you've been studying JMX, MBeans are
+ named objects. The names of MBeans are represented by
+ instances of <code>ObjectName</code>. An ObjectName is
+ composed of a <i>domain</i>, followed by a colon ':',
+ followed by a comma-separated list of <i>key=value</i>
+ pairs.<br>
+ The ordering of the <i>key=value</i> pairs is not
+ important, but <code>ObjectNames</code> are case sensitive
+ (both keys and values are case sensitive) and <b>white space
+ is not ignored</b>.<br>
+ A common pitfall for JMX beginners is to inadvertently
+ insert white space after commas into an ObjectName,
+ and expect that two ObjectNames which differ only by such white
+ space will be considered identical. This is not the
+ case.<br>
+ As an example, the ObjectName '<b><code>D:k1=v1, k2=v2, k3=v3</code></b>' has
+ three keys, which are '<b><code>k1</code></b>', '<b><code> k2</code></b>',
+ and '<b><code> k3</code></b>': beware
+ of the space in the name of the second and third
+ keys!<br>
+ It is therefore a different ObjectName from
+ '<b><code>D:k1=v1,k2=v2,k3=v3</code></b>' (the keys are now
+ '<b><code>k1</code></b>', '<b><code>k2</code></b>', and
+ '<b><code>k3</code></b>'), but the same ObjectName as
+ '<b><code>D: k2=v2, k3=v3,k1=v1</code></b>', and yet different
+ from '<b><code>D:k2=v2, k3=v3, k1=v1</code></b>'!
+ <p>In this example, we are following the rules
+ for ObjectName suggested in the <a
+href="http://java.sun.com/products/JavaManagement/best-practices.html"
+ >JMX Best Practices</a>:</p>
+ <ul>
+ <li>ObjectNames should be <a
+ href="http://java.sun.com/products/JavaManagement/best-practices.html#mozTocId654884"
+ >predictable</a>
+ </li>
+ <li>The domain part of our ObjectNames starts with a Java
+ package name
+ </li>
+ <li>Our ObjectNames contain a <code>type=</code>
+ key property. This property is different for every
+ object type in our domain.
+ </li>
+ <li>For every ObjectName with a given type, we have the same set of key
+ properties with the same syntax and semantics for their values - in
+ fact we only use an additional <code>name=</code> key.
+ </li>
+ <li>When there can only be one instance of a given type
+ there aren't any other key properties than <code>type=</code>.
+ The ObjectNames of the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a>, which are both singleton MBeans, are
+ composed in this way.
+ </li>
+ <li>When there can be several instances of a given type,
+ we differentiate them by further key properties.
+ To achieve this, we are using the most usual key property
+ in addition to <code>type=</code>: the <code>name=</code> key.
+ In this example, a key property list of the form
+ <code>type=X,name=Y</code> is always enough to uniquely name
+ an MBean. Tools like jconsole are usually aware
+ of the semantics of the <code>type=</code> key and
+ <code>name=</code> key, and are therefore able to
+ display this form of name in a way that
+ is easier to read than other name forms.
+ </li>
+ </ul>
+ <p>The rules listed above are implemented by a couple
+ of static helper functions in the <a
+href="src/com/sun/jmx/examples/scandir/ScanManager.java"
+title="ScanManager.java"
+ >ScanManager</a> class. See the code of the
+ <b><code>makeSingletonName</code></b> and
+ <b><code>makeMBeanName</code></b> methods.
+ </p>
+ </ul>
+ <h3>Inter MBean Navigation</h3>
+ <ul>
+ <p>One of the most common problems that needs to be solved
+ when designing a management interface with JMX is to
+ choose a representation for inter-MBean relationships.<br>
+ Prior to Java 6, there were basically three possible
+ choices:</p>
+ <ul>
+ <li><b>Make the relation appear in the ObjectName</b>.
+ For instance, if MBean B was contained in
+ MBean A, you could choose to name MBean B so
+ that its parent relationship with MBean A
+ appeared in its name. <br>
+ The obvious limitation of this solution is that
+ it only allows to model one such relation (an
+ MBean has only one name) and the relation must
+ be fixed - it cannot change during the life of
+ the MBean since the name of an MBean cannot
+ change.<br>
+ This scheme is therefore mostly used when
+ the application MBeans are modeling objects
+ which are conceptually contained within
+ each other in a tree-like structure.
+ <br>For instance, most MBean names defined by
+ <a href="http://jcp.org/en/jsr/detail?id=77"
+ >J2EE Management (JSR 77)</a> follow
+ this scheme.
+ </li>
+ <li><b>Design getters and setters (or operations) which
+ return <code>ObjectName</code> or
+ <code>ObjectName[]</code> values</b>. The ObjectNames
+ point to the MBeans which are related to that
+ object. For instance , <a
+ href="http://glassfish.dev.java.net/"
+ title="Open Source Java EE 5 Application Server"
+ >GlassFish</a>
+ defines MBeans which also use this pattern.
+ </li>
+ <li><b>Use the JMX RelationService</b>. The JMX RelationService
+ is quite powerful, but simple relationships often
+ do not justify that overhead.
+ </li>
+ </ul>
+ <p>In Java 6, these three possibilities still remain, but
+ the new MXBean framework brings up an interesting
+ alternative. Instead of returning an ObjectName or
+ an ObjectName array, <b>an MXBean can return a proxy</b>
+ to its related MXBeans. This is how we have chosen to
+ implement our inter MBean relationships in this
+ example:
+ <br>For instance the
+ <code>ScanManagerMXBean</code>/<code>DirectoryScannerMXBean</code>
+ relationship and the
+ <code>ScanManagerMXBean</code>/<code>ScanDirConfigMXBean</code>
+ relationships are implemented in this way.
+ <p>
+ The additional benefit, as compared to returning ObjectNames or
+ using the RelationService is that interface type of the MBeans
+ which are pointed to by the relationship becomes directly
+ apparent. The method:
+ <pre>
+ public Map&lt;String,DirectoryScannerMXBean&gt; getDirectoryScanners();
+ </pre>
+ makes it immediately obvious that the MBeans to which we point are
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a>. It would have been much less obvious in prior
+ versions of Java SE, were the returned type would have had to be
+ <code>Map&lt;String,ObjectName&gt;</code>, or
+ even worse just <code>Map</code>.
+ </p>
+ <p>However, it must be clear that the behaviour will be
+ quite different when an MXBean is returned as compared
+ to when a simple bean is returned.
+ </p>
+ <p>When an MXBean is returned, the remote client sees either
+ an ObjectName, if it is a generic client like jconsole, or
+ a proxy to a remote MXBean, if the client is working with the
+ MXBean interface. Invoking an operation on one of the
+ proxy returned by a method such as
+ <code>getDirectoryScanners</code> will cause the
+ MBean to be invoked on the remote server side.
+ </p>
+ <p>If <code>getDirectoryScanners</code> were
+ defined as:
+ <pre>
+ public Map&lt;String,DirectoryScannerConfig&gt; getDirectoryScanners();
+ </pre>
+ then invoking a method on one of the returned objects
+ would have absolutely no effect on the remote
+ server side - because the returned objects in this
+ case would simply be a bunch of serialized data objects.
+ </p>
+ <p>It is worth noting that although an MXBean interface
+ can have getters and operations which return an MXBean
+ interface, a regular standard MBean shouldn't have
+ any getters or methods which return MBean interfaces or
+ MXBean interfaces.
+ </p>
+ <p>For more information see also <a
+href="http://weblogs.java.net/blog/emcmanus/archive/2006/06/intermxbean_ref.html"
+title="Inter-MXBean references"
+ >Inter-MXBean References</a>.
+ </p>
+ </ul>
+ <h3>The MBeanRegistration interface, or how an MBean can
+ know or provide its own name</h3>
+ <ul>
+ <p>
+ Sometimes, an MBean needs to have a reference to the
+ MBeanServer in which it is registered, or needs to know
+ with which ObjectName it has been registered.
+ </p>
+ <p>
+ Sometimes also, an MBean may need to perform some
+ checks before being registered, or will need
+ to carry out some actions right after it has been
+ successfully registered in the MBeanServer.
+ </p>
+ <p>
+ Sometimes again, an MBean may need to perform some
+ checks, or some cleaning actions, just before, or
+ just after, it is unregistered.
+ </p>
+ <p>
+ When an MBean has such needs, the easiest solution
+ for it is to implement the <code>MBeanRegistration</code>
+ interface.
+ </p>
+ <p>The <code>MBeanRegistration</code> interface is a callback
+ interface which defines pre and post registration and
+ unregistration callbacks.
+ </p>
+ <p>
+ When an MBean implementing this interface is created
+ (with <code>createMBean</code>) or registered
+ (with <code>registerMBean</code>) in an MBeanServer,
+ the MBeanServer will call the <code>preRegister</code>
+ and <code>postRegister</code> method implemented by
+ the MBean. The <code>preRegister</code> method
+ has an <code>MBeanServer</code> and <code>ObjectName</code>
+ parameter, which are passed by the MBeanServer to the
+ MBean. The MBean can store the reference it is being passed
+ in a private instance variable for later use.
+ </p>
+ <p>
+ Most of the MXBeans we have defined in this example
+ implement the <code>MBeanRegistration</code> interface. The table
+ below show how our MBeans use this interface to control
+ their own names, make sanity checks, perform
+ initialization steps or cleanup actions.
+ </p>
+ <p><br><center>
+ <table border="1" cellpadding="4" cellspacing="2"
+ bgcolor="#eeeeee" width="95%">
+ <thead>
+ <tr bgcolor="#cecece">
+ <th width="20%">MBean Requirement</th>
+ <th>callback</th>
+ <th>use case example</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td bgcolor="#dedede">get a reference to the MBeanServer</td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> needs a reference
+ to the MBeanServer in order to create and
+ register other MBeans, such as the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a>, and the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a>.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">reject registration if conditions are
+ not met.
+ </td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> will throw
+ an IllegalArgumentException in <code>preRegister</code>
+ if the ObjectName it is being passed is
+ illegal. Throwing an exception in
+ <code>preRegister</code> makes the registration fail.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">get my client-assigned MBean name</td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> propagates the
+ value of the <code>name=</code> property of
+ the ObjectName it is given into its
+ ScanManagerConfig bean.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">provide my own default ObjectName if none
+ was given to the MBeanServer
+ </td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The name that is returned by <code>preRegister</code>
+ is the ObjectName with which the MBean will be
+ eventually registered.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> is able to suggest
+ a value for its own ObjectName if none was
+ provided. Similarly, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a>
+ always returns its singleton ObjectName
+ defined by <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html#SCAN_MANAGER_NAME"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean.SCAN_MANAGER_NAME</a>.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">perform initialization steps</td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> uses <code>preRegister</code>
+ to initialize its internal ScanManagerConfig bean.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">perform initialization steps, once it is
+ known that the registration was successful.
+ </td>
+ <td><code>postRegister</code></td>
+ <td bgcolor="#fafafa">The <code>postRegister</code> method
+ can be used to implement
+ initialization steps that need to be done once it
+ is known that the registration was successful, or to
+ undo any action performed by <code>preRegister</code> once it
+ is known that registration was not successful.
+ The <code>postRegister</code> method has a Boolean parameter
+ which tells the MBean whether it was or wasn't
+ successfully registered in the MBeanServer.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses <code>postRegister</code> to create
+ and register other MBeans, such as the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> and the default
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a>.
+ Note that <code>postRegister</code> is not expected to throw any
+ exception. If an exception needs to be thrown, it should
+ be thrown in <code>preRegister</code>.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">check whether the MBean can be deregistered</td>
+ <td><code>preDeregister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses this method to verify
+ that its state allows it to be deregistered.
+ In particular, it will refuse to be deregistered
+ if it is in the RUNNING or SCHEDULED state.
+ If <code>preDeregister</code> throws an exception, the unregisterMBean
+ call will fail and the MBean will remain registered in
+ the MBeanServer.
+ Take particular care when implementing business logic
+ in this method: if the logic you implement has an
+ unfortunate bug which makes it always throw an
+ exception, you will never be able to unregister
+ that MBean.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">clean up resources, refusing to be deregistered if
+ it fails
+ </td>
+ <td><code>preDeregister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses this method to unregister
+ all the other MBeans it has created and registered in the
+ MBeanServer. This includes the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a>, the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBeans</a> it has created, and the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a> it has created when
+ applying its configuration.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">clean up resources which need to be released in
+ a best-effort way, when it is known that the MBean is no
+ longer registered.
+ </td>
+ <td><code>postDeregister</code></td>
+ <td bgcolor="#fafafa"><code>postDeregister</code> is only called if the MBean was succesfully
+ unregistered.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses this method to cancel
+ its internal java.util.Timer.
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </center><br></p>
+ </ul>
+ <h3>The Singleton MBean Pattern</h3>
+ <ul>
+ <p>
+ A singleton MBean is an MBean which can only have one
+ instance registered in a given MBeanServer. <br>
+ A singleton MBean usually has a well-known name,
+ which can be defined as a constant. In that case,
+ clients no longer need to call <code>new ObjectName(...)</code>
+ and catch the declared <code>MalformedObjectNameException</code>.
+ </p>
+ <p>There are already quite a few examples of singleton
+ MBeans in the java.lang.management API. The
+ ThreadingMXBean, ClassLoadingMXBean, RuntimeMXBean, etc.
+ are all singleton MBeans.
+ </p>
+ <p>In this example, we have two singleton MBeans:
+ The <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a></code> and the
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a></code>. But in fact,
+ the only real singleton MBean is the
+ <code>ScanManagerMXBean</code>. The
+ <code>ResultLogManagerMXBean</code> just happens to
+ be a singleton MBean because it has a 1-1 relationship
+ with the <code>ScanManagerMXBean</code>.
+ </p>
+ <p>The <code>ScanManagerMXBean</code> implements the
+ singleton MBean pattern in this way:
+ </p>
+ <ul>
+ <li>The <code>ScanManagerMXBean</code> name has a single
+ key property: <code>type=ScanManagerMXBean</code>.</li>
+ <li>Its name is defined by an ObjectName constant called
+ <code>SCAN_MANAGER_NAME</code> in the <code>ScanManager</code> class</li>
+ <li>The <code>ScanManagerMXBean</code> enforces its status of
+ singleton MBean. It will refuse to be registered
+ with a name other than
+ the <code>SCAN_MANAGER_NAME</code>. You can therefore depend on
+ the fact that the <code>ScanManagerMXBean</code> will always
+ be registered with its singleton <code>SCAN_MANAGER_NAME</code>
+ (see <code>preRegister</code>)
+ </li>
+ <li>You are not obliged to provide a name when you
+ register the <code>ScanManagerMXBean</code>: if you pass null,
+ then the <code>ScanManager</code> will be registered with
+ its singleton <code>SCAN_MANAGER_NAME</code>
+ (see <code>preRegister</code>).
+ </li>
+ <li>The <code>ScanManager</code> class has a no-arg static
+ <code>register</code> method that will register
+ the singleton instance in the Platform MBeanServer.
+ This static <code>register</code> method returns
+ a proxy to the registered singleton.
+ </li>
+ <li>The <code>ScanManager</code> class has also a static
+ <code>register</code> method that will create
+ a singleton instance in a (possibly remote)
+ MBeanServerConnection - using
+ <code>createMBean</code>.
+ This static <code>register</code> method
+ also returns a proxy to the registered singleton.
+ </li>
+ <li>Only the MBeanServer has a reference to the
+ singleton instance. The singleton instance is
+ not returned to the caller, and not kept
+ in any other static data structure.
+ </li>
+ </ul>
+ <p>
+ On the other hand, the <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a></code>
+ has a much more relaxed implementation of the pattern:
+ <br>It simply provides its own singleton name if it is
+ registered with a null ObjectName, but will not enforce
+ the use of that name.
+ </p>
+ <p>Note that all singleton MBean names in this example
+ are created using the <code>ScanManager.makeSingletonName</code>
+ method, which implements the pattern for ObjectNames suggested
+ in the JMX Best Practices.
+ </p>
+ </ul>
+ <h3>Managing the Life Cycle of dependent MBeans</h3>
+ <ul>
+ <p>A common task that many JMX applications have
+ is to manage the life cycle of MBeans registered
+ in the MBeanServer.</p>
+ <p>In this example, we have decided to follow a simple
+ pattern:</p>
+ <ul>
+ <li>The application is initialized simply
+ by registering the singleton
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> in
+ the MBeanServer.
+ </li>
+ <li>The <code>ScanManagerMXBean</code> will then
+ in turn register any other MBean that the
+ application might need:
+ <ul>
+ <li>It creates and registers the singleton
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a></code>
+ </li>
+ <li>It creates and registers the default
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code>
+ which loads the initial configuration
+ </li>
+ <li>It creates as many
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a></code> as
+ needed when the configuration is applied
+ </li>
+ <li>It lets you create alternate
+ <code>ScanDirConfigMXBean</code>, to
+ which you can later switch in order
+ to apply a new alternate configuration.
+ </li>
+ </ul>
+ </li>
+ <li>When a new configuration is applied (or if the
+ current configuration is reapplied), the
+ <code>ScanManagerMXBean</code> will unregister
+ any <code>DirectoryScannerMXBeans</code> it has
+ previously registered, and will re-create
+ brand new <code>DirectoryScannerMXBeans</code>
+ from the applied configuration.
+ </li>
+ <li>When you unregister the <code>ScanManagerMXBean</code>,
+ it does all the cleanup for you, by unregistering
+ all the MBeans that it has created during the
+ course of the application.
+ </li>
+ </ul>
+ <p>The <code>ScanManagerMXBean</code> makes use of its
+ <code>MBeanRegistration</code> interface in order
+ to register the other MBeans it needs (see the
+ <code>ScanManager.postRegister</code> method) and to unregister
+ every MBean it has created (see the <code>ScanManager.preDeregister</code>
+ method).
+ </p>
+ <p>You will note that the <code>ScanManagerMXBean</code>
+ will only allow itself to be deregistered if it can be
+ closed - that is if there's no other action in
+ progress.
+ This is to make sure that the deregistration of
+ dependent MBeans will work smoothly.
+ <br>
+ The deregistration of related MBeans will happen
+ in the <code>ScanManager.preDeregister</code>
+ method.
+ <br>
+ If one of these MBeans could not be deregistered,
+ then the <code>ScanManagerMXBean</code> will throw
+ an exception, refusing to be deregistered.
+ <br>This leaves you a chance to try to deregister it
+ again later. Since the <code>ScanManagerMXBean</code>
+ has switched its state to CLOSED before starting
+ to unregister its dependent MBeans, it will refuse
+ any further actions, ensuring that e.g. nobody
+ can try to start it or schedule it while it
+ is in that partially-deregistered state.
+ </p>
+ <p>Handling the LifeCycle of all the application's
+ MBeans in a single MBean is usually a good design
+ pattern, especially if the application is a
+ module which is intended to share a JVM - or
+ an MBeanServer - with other modules.
+ </p>
+ <p>This is specially useful if the application needs to
+ be loaded and unloaded on demand: in that
+ case, simply registering or unregistering the top level
+ MBean (in our example the <code>ScanManagerMXBean</code>) does
+ the trick.
+ </p>
+ </ul>
+ <h3>Emitting Notifications</h3>
+ <ul>
+ <p>In order to emit notifications, an MBean must be
+ an instance of <code>NotificationEmitter</code>.
+ The <code>NotificationEmitter</code> interface defines methods
+ that the MBeanServer will call on the MBean in order
+ to register <code>NotificationListeners</code> with the MBean.
+ </p>
+ <p>It is worth noting that the MBean may not be
+ invoked each time a JMX client wants to register
+ a listener. For instance, the RMIConnectorServer
+ registers <i>only once</i> a single listener with each MBean
+ which is a <code>NotificationEmitter</code>.
+ In that specific case, the listener may even be registered
+ with the MBean before any client has actually subscribed
+ for notifications from that particular MBean.
+ </p>
+ <p>An MBean can therefore make no assumption about
+ which client or how many clients have registered for
+ notifications.
+ </p>
+ <p>It is also worth noting that the logic of the
+ methods defined in <code>NotificationEmitter</code> would not
+ be trivial to implement from scratch. Fortunately
+ the JMX API defines a helper class, called
+ <code>NotificationBroadcasterSupport</code>, which
+ provides an implementation for these methods.
+ </p>
+ <p>There are actually three ways for an MBean to
+ implement <code>NotificationEmitter</code>, of which only two
+ are recommended.
+ </p>
+ </ul>
+
+ <h4>Extending NotificationBroadcasterSupport</h4>
+ <ul>
+ <p>This is the simplest way of coding an MBean which
+ is a <code>NotificationEmitter</code>:
+ </p>
+ <p>Simply extend <code>NotificationBroadcasterSupport</code>,
+ then override its <code>getNotificationInfo</code> method
+ which returns the <code>MBeanNotificationInfo[]</code> array
+ that should be included in your MBean's <code>MBeanInfo</code>
+ and that's it.
+ <br>You just need to call the <code>sendNotification</code> method
+ inherited from <code>NotificationBroadcasterSupport</code> whenever
+ your MBean needs to send a notification.
+ </p>
+ <p>In our example, both the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> and <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> extend
+ <code>NotificationBroadcasterSupport</code> in order
+ to send notifications.
+ </p>
+ </ul>
+ <h4>The Delegation Pattern: delegating to a
+ NotificationBroadcasterSupport delegate</h4>
+ <ul>
+ <p>There may be cases however where delegating to a
+ wrapped <code>NotificationBroadcasterSupport</code>
+ object may be preferred to extending
+ <code>NotificationBroadcasterSupport</code>.
+ </p>
+ <p>For instance, if your MBeans already derive from
+ some base class, extending <code>NotificationBroadcasterSupport</code>
+ might not be an option.
+ </p>
+ <p>Similarly, if you do not want to have the inherited
+ <code>public void sendNotification(Notification notification)</code>
+ method appear in the Javadoc of the concrete class of your
+ MBean, you may want to consider using the delegation
+ pattern instead of extending
+ <code>NotificationBroadcasterSupport</code>
+ </p>
+ <p>In our example both the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a> use the delegation
+ pattern rather than extending
+ <code>NotificationBroadcasterSupport</code>.
+ In the end, choosing between one or the other method
+ is more a question of taste, although the delegation
+ pattern could be considered more flexible since it
+ doesn't require extending any given superclass.
+ </p>
+ <p>It may be also worth noting that some tools like
+ the JMX Module of <a
+href="http://www.netbeans.org"
+ >NetBeans IDE</a>, will be able to
+ generate for you all the code that delegates to a
+ wrapped <code>NotificationBroadcasterSupport</code>.
+ </p>
+ </ul>
+
+ <h4>Implementing NotificationEmitter from scratch</h4>
+ <ul>
+ <p>This is the last possibility for an MBean that
+ needs to send notifications: simply implement
+ <code>NotificationEmitter</code> from scratch. This is highly
+ discouraged since that logic is not trivial, and
+ already provided by
+ <code>NotificationBroadcasterSupport</code> anyway.
+ </p>
+ </ul>
+
+ <h4>Beware of Synchronization Locks</h4>
+ <ul>
+
+ <p>One thing you must keep in mind when sending
+ notifications is not to send them from within
+ a synchronized block, or while holding a lock on
+ some resource.</p>
+ <p>Indeed, what happens when you send a notification
+ may vary greatly depending on whether the client
+ which has registered for notifications has done
+ so through a <code>JMXConnector</code> (like the
+ <code>JMXRMIConnector</code>)
+ or through a direct reference to the MBeanServer
+ (by calling
+ <code>MBeanServer.addNotificationListener</code>).
+ </p>
+ <p>In this latter case, the listener will be invoked
+ synchronously in the same thread that your MBean is
+ using to send its notification. If by misfortune, the
+ code of that listener now re-enters your MBean through a
+ call that flows through a JMXConnector, a deadlock
+ could occur. It is therefore very important to release
+ any lock you may have before calling
+ <code>sendNotification</code>.</p>
+ <p>An easy way to do that is demonstrated in the
+ <code>ScanManager</code> class. The ScanManager
+ has an internal private queue of pending notifications.
+ When a notification needs to be sent (e.g. because the
+ ScanManager state is being switched), the notification
+ is simply prepared and put into the pending notification
+ queue.
+ The notification queue is then processed later on,
+ at the end of the method, when the processing is finally
+ completed and all the locks have been released.
+ <br>At this point the notification queue might already
+ have been emptied by another thread - in which case
+ the pending notifications will have already been
+ removed from the queue. Which thread actually gets
+ to send the notifications is of no importance. The
+ important point is that all the locks detained by
+ your MBean code in that thread were released before
+ the notification was sent.
+ </p>
+ <p>In our example the <code>ScanManager</code> class
+ ensures this by:
+ <ul>
+ <li>Only calling <code>sendNotification</code>
+ in its private <code>sendQueuedNotifications</code>
+ method.
+ </li>
+ <li>Only calling <code>sendQueuedNotifications</code>
+ when all locks have been released.
+ </li>
+ <li>Never calling a method that calls
+ <code>sendQueuedNotifications</code> from within
+ a synchronized block.</li>
+ </ul>
+ </p>
+ </ul>
+
+
+
+ <h4>Don't subclass Notification</h4>
+ <ul>
+ <p>Another common best practice when you want
+ to improve interoperability is to use directly
+ the Notification base classes provided in the
+ JMX<sup>TM</sup> API. Do not create your own
+ subclasses of these standard classes.
+ </p>
+ <p>Indeed, if you code your own subclass, a generic
+ client, like jconsole, will not be able to receive
+ that notification unless it has that custom
+ subclass in its classpath.
+ </p>
+ <p>
+ If you want your application to be interoperable, it is
+ therefore preferable not to subclass any of the standard
+ Notification classes. You can define your own
+ Notification type string, and if you need to send
+ additional data, you can put a CompositeData, or a
+ HashMap of serializable standard types in the
+ Notification's user data fields.
+ </p>
+ <p>In this example, we are using directly the
+ standard notification classes:
+ <ul>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a> both use directly
+ <code>AttributeChangeNotification</code> to notify
+ changes in their <code>State</code> attribute.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a>
+ also uses the base <code>Notification</code>
+ class directly in order to notify whenever
+ it finds a matching file.
+ <br>In that case, we simply use the base
+ <code>Notification</code>
+ class with a new
+ <b><code>com.sun.jmx.examples.scandir.filematch</code></b>
+ type.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> and <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> also both use the base
+ <code>Notification</code> class.
+ </li>
+ </ul>
+ <p>Careful readers will have noted that the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a> both use the
+ <code>AttributeChangeNotification</code> class
+ to notify about their state change, whereas the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> uses the base
+ <code>Notification</code> class.
+ </p>
+ <p>In fact, this is because the semantics of these
+ notifications is not exactly the same - although
+ both denote a state change:
+ <ul>
+ <p>In the case of <code>ScanManagerMXBean</code>
+ and <code>DirectoryScannerMXBean</code>, the
+ notification which is emitted is more about a
+ state transition, from one state to another.
+ For instance, going from <code>RUNNING</code>
+ to <code>STOPPED</code>, or from
+ <code>SCHEDULED</code> to <code>STOPPED</code>.
+ <br>In that case, the
+ <code>AttributeChangeNotification</code> was
+ more appropriate because it made it possible
+ to send the previous and the new value of the
+ state attribute, thus reflecting the whole
+ state transition.
+ </p>
+ <p>In the case of the <code>ScanDirConfigMXBean</code>
+ however, what is of interest is the state in
+ which the MBean has arrived. Using the base
+ <code>Notification</code> class with three different
+ notification type strings -
+ <b><code>com.sun.jmx.examples.scandir.config.loaded</code></b>,
+ <b><code>com.sun.jmx.examples.scandir.config.modified</code></b>,
+ and
+ <b><code>com.sun.jmx.examples.scandir.config.saved</code></b> -
+ was therefore closer to what we wanted to model.
+ </p>
+ </ul>
+ </p>
+ </ul>
+
+ <h3>Configuration MBeans</h3>
+ <ul>
+ <p>A common practice when designing a management application is
+ to have an MBean, or a set of MBeans, dedicated to configuration.
+ Separating configuration from control and monitoring allows
+ more appropriate logic, and often simplifies the design and
+ implementation of the management interface.
+ </p>
+ <p>
+ In our example, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> is dedicated to the application configuration.
+ </p>
+ <p>The <code>ScanDirConfigMXBean</code> will let you interactively
+ modify, save, or load the application configuration. The modifications
+ will not be taken into account until it is applied, by invoking
+ <code>applyConfiguration</code> on the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a>.
+ It is also possible to create many configurations, by creating as
+ many <code>ScanDirConfigMXBean</code>s, and then to choose and apply
+ one of these configurations by calling
+ <code>ScanManagerMXBean.setConfigurationMBean</code> and then
+ <code>ScanManagerMXBean.applyConfiguration</code>.
+ </p>
+ <p>In this way, all configurations aspects are gathered and concentrated
+ inside the <code>ScanDirConfigMXBean</code> instead of being scattered
+ throughout all the MBeans that compose the application.
+ </p>
+ <p>In order to save and store the application configuration data, the
+ <code>ScanDirConfigMXBean</code> uses a set of XML serializable Java beans
+ defined in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/package-summary.html"
+title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
+ >com.sun.jmx.examples.scandir.config</a> package. These beans are very
+ simple Java beans which have been lightly annotated for XML binding.
+ </p>
+ <p>It is worth noting that these same beans can also be handled by the
+ MXBean framework (our beans don't contain recursive data structures) and can
+ therefore be used directly as attributes and parameters of MXBeans, without
+ needing to be Java-serializable (the MXBean framework transform them in
+ CompositeData objects - which <b>are</b> serializable).
+ </p>
+ <p>The same <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/ScanManagerConfig.html"
+title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
+ >ScanManagerConfig</a> bean that we use to read from and write to the
+ XML configuration file is thus also used as attribute of the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a>. It is transformed into a <code>CompositeData</code>
+ by the MXBean framework, and can be easily introspected with
+ <a href="#JConsole">jconsole</a>.
+ </p>
+ </ul>
+ <h3>MBeans Must Be Thread-Safe</h3>
+ <ul>
+ <p>A question often asked by newcomers to JMX technology
+ is whether the MBeanServer is thread-safe. Well, the MBeanServer <b>is</b>
+ thread safe, but it doesn't put any locks on the MBeans it contains. The
+ MBeans can be concurrently accessed by multiple threads, and must therefore
+ take care of their own thread safety.
+ </p>
+ <p>In this example, we have been using two methods to ensure thread
+ safety for our MBeans: synchronized blocks, and semaphores.
+ </p>
+ <p>Using synchronized blocks is probably the most common and easiest way
+ to implement thread safety in Java. When dealing with MBeans though, here
+ are a couple of rules to keep in mind:
+ <ul>
+ <li>Don't send notifications from within a synchronized block: there's
+ no way to tell whether the listener's code will be executed in the
+ same thread or a different thread, and holding a lock in these
+ conditions is therefore dangerous, as it could lead to deadlocks.</li>
+ <li>Also avoid invoking another MBean from a synchronized block
+ unless you are completely in control of both MBeans, and you can
+ ascertain that it won't lead to any deadlock. Indeed, if you invoke an
+ MBean exposed by another application, it can be sometime hard to
+ know with certainty whether holding a lock while invoking that
+ MBean will have any side effect. Maybe that MBean will make
+ further calls to other MBeans which will in turn try to call
+ your MBean, or maybe it will emit a
+ notification, and we'll be back to the considerations just
+ above.</li>
+ </ul>
+ </p>
+ <p>Another means of implementing thread-safe code is to use semaphores.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses a semaphore called
+ <code>sequencer</code> to ensure
+ that critical code sections are not executed concurrently. In this
+ MBean, we use <code>Semaphore.tryAcquire</code> to lock the sequencer
+ semaphore before entering the critical section. If the
+ <code>Semaphore.tryAcquire</code> returns true then we enter the critical
+ section. If it returns false, we throw an IllegalStateException, stating
+ that we couldn't acquire the lock. The code looks like this:
+ <pre>
+ if (!sequencer.tryAcquire())
+ throw new IllegalStateException("resource locked");
+ try {
+ // critical code here ...
+ } finally {
+ // Always use try/finally to ensure that the semaphore
+ // will be released, even if exceptions or errors are raised!
+ sequencer.release();
+ }
+ </pre>
+ </p>
+ <p>Using <code>Semaphore.tryAcquire</code> and throwing an exception if
+ the semaphore is already locked makes it safer to call other MBeans
+ from within the critical section: in potential deadlock situations
+ the calling code will get the <code>IllegalStateException</code>
+ instead of being blocked on the deadlocked lock.
+ </p>
+ <p>It is worth noting that each of these techniques has its own
+ advantages and disadvantages - which can make one of them more or less
+ appropriate depending on the inner logic of the MBean you're implementing.
+ </p>
+ <p>Careful readers will also have noted that we used
+ <code>IllegalStateException</code> directly, instead of defining
+ our own subclass of RuntimeException, which could have had a more
+ precise semantics. If you define a new exception for your JMX application,
+ you must keep in mind that your client will need to have the class
+ of your exception in its classpath to get that exception.
+ Otherwise your client will get a completely different exception, indicating a
+ deserialization issue.
+ </p>
+ </ul>
+
+ <h3>Waiting for Notifications</h3>
+ <ul>
+ <p>Implementing code that needs to wait for notifications is sometimes
+ difficult. Because notifications are asynchronous, doing something
+ like:
+ <pre>
+ // register a notification listener
+ ...
+ // start a management action
+ ...
+ // wait for a notification
+ ...
+ // do something based on whether the expected notification
+ // is received
+ ...
+ </pre>
+ is not always trivial. However, there's a very easy way to do that: use
+ a blocking queue of notifications.
+ <pre>
+ final BlockingQueue&lt;Notification&gt; notifQueue =
+ new LinkedBlockingQueue&lt;Notification&gt;();
+
+ final NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ // Just put the received notification in the queue.
+ // It will be consumed later on.
+ //
+ notifQueue.put(notification);
+ } catch (InterruptedException ex) {
+ // OK
+ }
+ }
+ };
+
+ // register the listener - possibly also as a JMXConnectionNotification
+ // listener to get Notification Lost notification
+ ...
+ // start management action
+ ...
+ // wait for notification
+ while (expected notif not received and delay not expired) {
+ Notification n = notifQueue.poll(3,TimeUnit.SECONDS);
+ // if expected notif, do something
+ ...
+ }
+ // if expected notification not received do something else.
+ ....
+ </pre>
+ </p>
+ <p>You will note that this is a technique we've been using in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+title="The ScanDirAgent class defines a main method for the scandir application"
+ >ScanDirAgent</a> class and in the example unit tests.
+ </p>
+ </ul>
+
+ <h3>Holding hard references to other MBeans: proxy or direct reference?</h3>
+ <ul>
+ <p>We have seen that MXBeans will let you return proxy references to other
+ MXBeans. But should that MXBean hold a direct reference to the MXBeans it
+ relates to, or would it be better for it to hold only a proxy?
+ </p>
+ <p>
+ As a general rule it is better when an MBean reference is
+ only held by the MBeanServer. It is a better design
+ to hold a reference to a proxy, rather than to hold
+ a hard reference to an MBean. However there are two cases
+ when holding a hard reference might be preferred:
+ <ol>
+ <li>When MBean A needs to call a method of method B which
+ is not part of its MBean interface</li>
+ <li>When the overhead of going through the MBeanServer
+ plus the MXBean framework is too great (frequently-called
+ method, with creation of OpenType)</li>
+ </ol>
+ However - holding a hard reference is only advisable
+ when both MBeans are created by the same piece of code,
+ and the application can ensure that the life cycle
+ of each MBean is consistent with regard to the other.
+ </p>
+ <p>In our example, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> holds only proxy references to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+ >ScanDirConfigMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+ >DirectoryScannerMXBeans</a>. <br>
+ However it holds a direct reference to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html"
+ >ResultLogManager</a>. This makes it possible to pass a direct
+ reference to the <code>DirectoryScannerMXBeans</code>,
+ which can then log their results
+ more efficiently, and would also make it possible to remove
+ the <code>log</code> method from the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+ >ResultLogManagerMXBean</a> interface - leaving it in the
+ <code>ResultLogManager</code> class (possibly as a package method)
+ should we wish to do so.
+ </p>
+
+ </ul>
+
+ <h3>Agent Class</h3>
+ <ul>
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+title="The ScanDirAgent class defines a main method for the scandir application"
+ >ScanDirAgent</a> is the Agent class for the <i>scandir</i> application.
+ This class contains the <code>main</code> method to start a standalone
+ <i>scandir</i> application.
+ </p>
+ <p>The <code>main</code> method simply registers a <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> in the platform MBeanServer, and then waits
+ for someone to call <code>ScanManagerMXBean.close</code>.
+ </p>
+ <p>
+ When the <code>ScanManagerMXBean</code> state is switched to
+ <code>ScanManagerMXBean.ScanState.CLOSED</code>, the
+ <code>ScanManagerMXBean</code> is unregistered, and the application
+ terminates (i.e. the main thread completes).
+ </p>
+ <p>Standalone JMX applications usually have an Agent class that contain
+ their <code>main</code> method, which performs all the MBean
+ registration steps.
+ However, it is usually not a bad idea if that class can
+ be easily turned into an MBean. Indeed, this will make your
+ application easier to integrate in an environment where it would
+ no longer be standalone and would no longer control the implementation
+ of <code>main</code>. In our example the Agent
+ class could be easily turned into an MBean, exposing its three
+ <code>init</code>, <code>waitForClose</code> and <code>cleanup</code>
+ method. However we didn't go as far as turning it into an MBean since
+ the application can be already easily started by registering an instance
+ of <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a>.
+ </p>
+ </ul>
+ <h3>Secure Client Class</h3>
+ <ul>
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
+title="The ScanDirClient class is a very short example of secure programmatic client"
+ >ScanDirClient</a> is an example class that shows how a
+ programmatic client can connect to a secured <i>scandir</i> application.
+ This class contains a <code>main</code> method which creates and
+ configures a <code>JMXConnector</code> client to connect with
+ a secured <i>scandir</i> daemon. This class will not work with
+ the default unsecured agent since it requires mutual authentication.
+ </p>
+ <p>How to secure a JMX <i>scandir</i> application and run
+ the secure <code>ScanDirClient</code> is discussed <a href="#secure"
+ >later</a> in this document.
+ </p>
+ <p>The <code>ScanDirClient</code> is not really part of the
+ application - and is given here only for the sake of
+ the example.
+ </p>
+ </ul>
+
+ <h2><a name="h2-Testing">Testing the <i>scandir</i> Example</a></h2>
+ <ul>
+ <p>Make sure that you have access to junit.jar (either 3.8.1 or 3.8.2).
+ Make sure also that you have junit.jar in your
+ <code>CLASSPATH</code>.<br>
+ Then in the example root directory (where the <code>build.xml</code>
+ file is located) run the following command:
+ <pre>ant test -Dlibs.junit.classpath=<i><u>path to junit jar (either 3.8.1 or 3.8.2)</u></i></pre>
+ </p>
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE and test the jmx-scandir project from the
+ <code>Run</code> menu.
+ </p>
+
+ </ul>
+
+ <h2><a name="h2-Running">Running the <i>scandir</i> Example</a></h2>
+ <ul>
+ <p>In the example root directory (where the <code>build.xml</code>
+ file is located) run the following commands:
+ <pre>ant jar
+ant run-single -Drun.class=com.sun.jmx.examples.scandir.ScanDirAgent -Djavac.includes=src</pre>
+ or simply <pre>ant run</pre>
+ </p>
+
+ <p>This will run the example using the configuration
+ file provided in the src/etc directory.
+ </p>
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE. You can run the example by
+ selecting the <code>ScanDirAgent</code> file
+ and run it with <code>Run File</code> in the
+ <code>Run</code> menu or simply
+ set the <i>jmx-scandir</i> project as main project and
+ select <code>Run Main Project</code> from the
+ main menu. Both targets will use the configuration
+ file provided in the src/etc directory.
+ </p>
+ <p>When the application is started, you can connect to
+ it with <a href="#JConsole">jconsole</a>.
+ </p>
+ <blockquote>
+ <u>Note:</u> You can also run the <i>scandir</i>
+ application directly from the <code>java</code>
+ command line. Make sure to build the project jar
+ first.
+ <br>On Unix systems:
+ <pre>ant jar
+java -Djava.util.logging.config.file=logging.properties \
+ -Dscandir.config.file=src/etc/testconfig.xml \
+ -jar dist/jmx-scandir.jar</pre>
+ <br>On Windows systems:
+ <p><code>ant jar<br>
+java &nbsp;-Djava.util.logging.config.file=logging.properties
+ &nbsp;-Dscandir.config.file=src\etc\testconfig.xml
+ &nbsp;-jar&nbsp;dist\jmx-scandir.jar</code></p>
+ </blockquote>
+ </ul>
+
+ <h2><a name="h2-Playing">Playing with JConsole</a></h2>
+ <ul>
+ <p>Run the example as explained in the previous section, so
+ that it uses the provided <code>src/etc/testconfig.xml</code>
+ configuration file. Then start
+ jconsole. In the connection window choose the process that runs
+ <code>com.sun.jmx.examples.scandir.ScanDirAgent</code> or
+ <code>jmx-scandir.jar</code>.
+ </p>
+ <p><center>
+ <table border="0" cellpadding="2" cellspacing="2">
+ <tr><td>
+ <a href="docfiles/connect-local-ant-run.jpg"
+ title="jconsole connection window - connect to local process"
+ ><img height="440"
+ src="docfiles/connect-local-ant-run.jpg"
+ alt="jconsole connection window - connect to local process"
+ /></a>
+ </td>
+ <td>
+ <a href="docfiles/connect-local-java-jar.jpg"
+ title="jconsole connection window - connect to local process"
+ ><img height="440"
+ src="docfiles/connect-local-java-jar.jpg"
+ alt="jconsole connection window - connect to local process"
+ /></a>
+ </td></tr></table>
+ </center>
+ </p>
+ <p>Open the MBeans tab, and look for the
+ <code>ScanDirConfigMXBean</code>.
+ Click on its <code>Attributes</code> node and double click on its
+ <code>Configuration</code> attribute, to look at
+ the loaded configuration - values in bold can
+ be expanded by a double-click.
+ </p>
+ <p><center><a href="docfiles/scandir-config.jpg"
+ title="jconsole MBean tab: ScanDirConfigMXBean"
+ ><img
+ src="docfiles/scandir-config.jpg"
+ alt="jconsole MBean tab: ScanDirConfigMXBean"
+ /></a></center>
+ </p>
+ <p>Now go to the <code>ScanManagerMXBean</code>, click on
+ its <code>Notifications</code> node, and subscribe
+ for notifications. Then click on the
+ <code>Operations</code> node and invoke the
+ <code>start()</code> operation:
+ </p>
+ <p><center><a href="docfiles/scandir-start.jpg"
+ title="jconsole MBean tab: ScanDirConfigMXBean"
+ ><img
+ src="docfiles/scandir-start.jpg"
+ alt="jconsole MBean tab: ScanDirConfigMXBean"
+ /></a></center>
+ </p>
+ <p>You can see that the notifications counter was
+ incremented by three: you have just scheduled,
+ run, and completed a batch of directory scans.
+ </p>
+ <p>Now go to the <code>ResultLogManagerMXBean</code>,
+ click on its <code>Attributes</code> node, and
+ expand its <code>MemoryLog</code> attribute:
+ </p>
+ <p><center><a href="docfiles/scandir-result.jpg"
+ title="jconsole MBean tab: ScanDirConfigMXBean"
+ ><img
+ src="docfiles/scandir-result.jpg"
+ alt="jconsole MBean tab: ScanDirConfigMXBean"
+ /></a></center>
+ </p>
+ <p>You can see that the directory scan results have
+ been logged.</p>
+ <p>To make the application terminate go back to the
+ <code>ScanManagerMXBean</code> and invoke
+ <code>close()</code>. The <code>ScanDirAgent</code>
+ will receive the notification, step out of
+ the application main thread, and the application
+ will terminate.
+ </p>
+ <p>This is of course a very limited scenario. Feel free
+ to improvise with all the features of the example, creating
+ a new configuration -
+ <code>ScanManagerMXBean.createOtherConfigurationMBean</code> -
+ adding multiple directory scanners to that configuration -
+ <code>ScanDirConfigMXBean.addDirectoryScanner</code> -
+ then switching the <code>ScanManagerMXBean</code> current
+ configuration by changing the value of the <i>ConfigurationMBean</i>
+ attribute - <code>ScanManagerMXBean.setConfigurationMBean</code>
+ - then applying the new configuration -
+ <code>ScanManagerMXBean.applyConfiguration(true)</code> -
+ then scheduling repeated directory scans every 10 seconds -
+ <code>ScanManagerMXBean.schedule(0,10000)</code> -
+ subscribing for notifications, etc...
+ </p>
+ </ul>
+
+ <a name="secure"></a>
+ <h2><a name="h2-Turning">Turning the example into a Secure JMX Application</a></h2>
+ <ul>
+ <p>In this section, we will see how to configure and
+ start the <i>scandir</i> example so that the JVM agent
+ is bootstrapped with a secure JMXConnectorServer. Indeed, until
+ now we have only used the insecure local connection,
+ which can only be used as long as both the client and
+ the server run on the same machine. This section will
+ explain how to start the <code>ScanDirAgent</code> so
+ that a real secure RMIConnectorServer is started at bootstrap.
+ </p>
+ <p>To achieve this we will: <a href="#management.properties"
+ >provide our own management.properties</a>, <a
+ href="#password-access">create our own password and access files</a>,
+ <a href="#keystore-truststore">provide a keystore and truststore</a>,
+ <a href="#start-secure-agent">start the ScanDirAgent with the
+ appropriate system properties</a>.
+ </ul>
+ <h3>Configuring the JVM Agent for Secure Remote Connection</h3>
+ <ul>
+ <p>The easiest way to <a name="management.properties">configure the
+ JVM Agent</a> for Secure Remote
+ Connection is to use your own <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#properties"
+ title="This page describes the properties you can put in your management.properties file"
+ >management.properties</a> file.
+ In this example, we have copied the default
+ <code>$JRE/lib/management/management.properties</code>
+ file to the example's <code>src/etc</code> directory and
+ modified it in <a href="src/etc/management.properties"
+ title="our modified management.properties"
+ >this way</a>:
+ <ul>
+ <li>We have set the RMI port to <u>4545</u> - this is just a
+ random port number we have picked up. Feel free to use your
+ own value suited to your environment.
+ <pre># For setting the JMX RMI agent port use the following line
+com.sun.management.jmxremote.port=<b>4545</b></pre>
+ </li>
+ <li>We have <u>switched on</u> SSL <u>mutual authentication</u>
+ <pre># For RMI monitoring with SSL client authentication use the following line
+com.sun.management.jmxremote.ssl.<b>need.client.auth</b>=<b>true</b></pre>
+ </li>
+ <li>We have also <u>secured the RMI Registry</u> with SSL
+ <pre># For using an SSL/TLS <b>protected</b> RMI Registry use the following line
+com.sun.management.jmxremote.<b>registry.ssl</b>=<b>true</b></pre>
+ </li>
+ <li>We have provided <a
+ href="src/etc/password.properties">our own password file</a>
+ <pre># For a non-default password file location use the following line
+com.sun.management.jmxremote.password.file=<i>src/etc/password.properties</i></pre>
+ </li>
+ <li>We have provided <a
+ href="src/etc/access.properties">our own access file</a>
+ <pre># For a non-default password file location use the following line
+com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
+ </li>
+ </ul>
+ <p>You will note that we haven't provided any value
+ for the other security properties, like
+ <code>com.sun.management.jmxremote.authenticate=true</code>,
+ because these properties already default to a value
+ which enables security by default.
+ Note however that protecting the RMI Registry with SSL
+ improves the application security, but only as long as
+ mutual authentication is also switched on. Otherwise, just
+ anybody would be able to connect to the registry and
+ get the RMIServer stub.
+ </p>
+ <p>We do recommend that you <u>use the most secure configuration
+ when you deploy a JMX agent</u> - which means <u>switching on
+ SSL protection for the RMI registry</u> <b>and</b> <u>requiring
+ mutual authentication</u>, as we show in this example.
+ </p>
+ <p>We will use the <code>com.sun.management.config.file</code>
+ system property to pass our <a
+ href="src/etc/management.properties">management.properties</a>
+ file to the <code>ScanDirAgent</code>.
+ </p>
+ </ul>
+
+ <h3>Creating a password and access file</h3>
+ <ul>
+ <p>As explained above, we have created our own
+ <a href="src/etc/password.properties">password file</a>
+ and <a href="src/etc/access.properties">access file</a>
+ for <a name="password-access">access control and authorization</a>.
+ </p>
+ <p>In the password file, we have defined two logins:
+ <i>guest</i> and <i>admin</i>. The password for
+ <i>guest</i> is <i>guestpasswd</i> and the password
+ for <i>admin</i> is <i>adminpasswd</i>.
+ </p>
+ <p>In the access file, we have mapped these two logins
+ to access rights: the <i>admin</i> login has <i>read-write</i>
+ access, while the <i>guest</i> login only has <i>read-only</i>.
+ </p>
+ <p>Before starting the <code>ScanDirAgent</code>, you will
+ need to restrict access permission to the password file,
+ in such a way that nobody but you can read it. Otherwise, the
+ JVM Agent will refuse to start the JMXConnectorServer, as it will
+ fear that security can be compromised if other parties can
+ have read access to the password file. How to restrict
+ read access to the password file is explained in detail
+ <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#PasswordAccessFiles"
+ title="Using Password and Access Files"
+ >here</a>.
+ </p>
+ <p>As we have seen above, the location
+ of our access and password files is configured in our own <a
+ href="src/etc/management.properties">management.properties</a>
+ file.
+ </p>
+ </ul>
+ <h3>Keystore and Truststore</h3>
+ <ul>
+ <p>Using SSL with mutual authentication means that both
+ client and server will need a <a name="keystore-truststore"
+ >keystore and a truststore</a>
+ to store their own certificates, and the certificates of
+ the parties they trust. Usually, client and server will
+ have their own keystore and truststore.
+ </p>
+ <p>For the sake of simplicity - and to get you started
+ without the tedious necessity of creating your own keystore
+ and truststore, we are providing a dummy keystore and
+ truststore, containing a certificate self-signed by duke.
+ The password for our keystore is <i>password</i>, and the
+ password for our truststore is <i>trustword</i>.
+ We suggest that you first get the example running with the
+ keystore and truststore we are providing before attempting
+ to use your own keystore and truststore.
+ </p>
+ <p>A secure application will obviously need to use its own
+ keystore and truststore, <b><u>and should not rely on the keystore
+ and truststore we are providing here!</u></b>
+ </p>
+ <p>How to create your own keystore and truststore, is explained
+ in <a
+href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
+title="Monitoring and Management Using JMX"
+ >here</a>.
+ As shown <a href="#start-secure-agent">later</a>,
+ we will need to use <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
+ >system properties</a> to pass our truststore
+ and keystore to the <code>ScanDirAgent</code>.
+ </p>
+ </ul>
+ <h3>Starting a Secure <i>scandir</i> agent</h3>
+ <ul>
+ <p>To start a <a name="start-secure-agent"
+ >secure <i>scandir</i> agent</a>, go to the
+ <i>scandir</i> example root directory and type the
+ following command:</p>
+ <p>On Unix Systems:
+<pre>ant jar
+java \
+ -Djava.util.logging.config.file=logging.properties \
+ -Djavax.net.ssl.keyStore=keystore \
+ -Djavax.net.ssl.keyStorePassword=password \
+ -Djavax.net.ssl.trustStore=truststore \
+ -Djavax.net.ssl.trustStorePassword=trustword \
+ -Dcom.sun.management.config.file=src/etc/management.properties \
+ -Dscandir.config.file=src/etc/testconfig.xml \
+ -jar dist/jmx-scandir.jar</pre>
+ </p>
+ <p>On Windows Systems:
+<p><code>ant jar<br>
+java
+ &nbsp;-Djava.util.logging.config.file=logging.properties
+ &nbsp;-Djavax.net.ssl.keyStore=keystore
+ &nbsp;-Djavax.net.ssl.keyStorePassword=password
+ &nbsp;-Djavax.net.ssl.trustStore=truststore
+ &nbsp;-Djavax.net.ssl.trustStorePassword=trustword
+ &nbsp;-Dcom.sun.management.config.file=src\etc\management.properties
+ &nbsp;-Dscandir.config.file=src\etc\testconfig.xml
+ &nbsp;-jar&nbsp;dist\jmx-scandir.jar</code></p>
+ </p>
+ <p>If you start jconsole now, you will see that you
+ are still able to connect to the agent using the
+ local connection. However, if you try to connect
+ through the remote connector, using
+ <a href="docfiles/remote-connection.jpg">localhost:4545</a>,
+ the connection will <a href="docfiles/remote-connection-failed.jpg"
+ >fail</a>, even if you provide a correct login/password
+ pair. Indeed, since the JMXConnectorServer is now protected with SSL,
+ jconsole must also be configured with the appropriate SSL parameters
+ so that it can authenticate the server and get authenticated by the
+ server too as the SSL configuration of the server requires mutual
+ authentication.
+ </p>
+ <p>The next section will discuss how to connect to the
+ secure agent.
+ </p>
+ </ul>
+
+ <h2><a name="h2-Connecting">Connecting to the Secure JMX Application</a></h2>
+ <ul>
+ <p>We will now see how to connect to the secure agent,
+ using jconsole, and using a programmatic client.
+ </p>
+ </ul>
+
+ <h3>Using jconsole to connect to the secure agent</h3>
+ <ul>
+ <p>The only special thing you need to do in order to
+ be able to connect to your secure agent with
+ jconsole, is to give it a keystore (containing
+ its client certificate) and a truststore (containing
+ the certificates of the servers it can trust).
+ In our example, we use the same keystore/truststore
+ pair on the client and server side - but this is
+ not what a real application would do.
+ Indeed a real application would have different
+ certificates for the client and the server, and
+ thus use different keystores (and probably truststores).
+ More information on SSL authentication can be obtained from the <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
+ title="How SSL Works"
+ >Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>.
+ </p>
+ <p>To start jconsole with our provided keystore and
+ truststore, go to the scandir example root directory and
+ type in the following command:
+ <p><code>jconsole
+ &nbsp;-J-Djava.util.logging.config.file=logging.properties
+ &nbsp;-J-Djavax.net.ssl.keyStore=keystore
+ &nbsp;-J-Djavax.net.ssl.keyStorePassword=password
+ &nbsp;-J-Djavax.net.ssl.trustStore=truststore
+ &nbsp;-J-Djavax.net.ssl.trustStorePassword=trustword</code></p>
+ </p>
+ <p>The <code>-J-Djava.util.logging.config.file=logging.properties</code>
+ flag is not mandatory, but passing a <code>logging.properties</code>
+ may help you debug connection problems if anything goes wrong.
+ </p>
+ <p>In jconsole connection window, choose to connect to a
+ remote process, using the address <i>localhost:4545</i>
+ and the guest login:
+ </p>
+ <p><center><a href="docfiles/remote-connection.jpg"
+ ><img src="docfiles/remote-connection.jpg"
+ alt="jconsole connection window"/></a></center>
+ </p>
+ <p>You will see that the agent will let view all the
+ MBeans and their attributes, but will reject any
+ attribute modification or remote method invocation.
+ </p>
+ <hr>
+ <p><u>Note:</u> if jconsole fails to connect and show
+ you <a href="docfiles/remote-connection-failed.jpg">this screen</a>
+ you have probably misspelled some of the properties on jconsole
+ command line, or you didn't start jconsole from the
+ scandir example root directory where our <code>truststore</code>
+ and <code>keystore</code> files are located. This article - <a
+ href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
+ title="Troubleshooting connection problems in JConsole"
+ >Troubleshooting connection problems in JConsole</a> - may help
+ you figure out what is going wrong.
+ </p>
+ <hr>
+ </ul>
+
+ <h3>Writing a programmatic client to connect to the secure agent</h3>
+ <ul>
+ <p>
+ In this section we will show the steps involved in writing
+ a programmatic client that will connect to our secure agent.
+ </p>
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
+title="The ScanDirClient class is a very short example of secure programmatic client"
+ >ScanDirClient</a> is an example class that shows how a
+ programmatic client can connect to a secured <i>scandir</i> application.
+ This class contains a <code>main</code> method which creates and
+ configures a <code>JMXConnector</code> client to connect with
+ the secured <i>scandir</i> agent.
+ </p>
+ <p>The secure client differs only from a non secure client in
+ so far as it needs to use SSL RMI Factories and credentials to
+ connect to the secure agent. The steps required mainly involve:
+ <ul>
+ <li>Creating an empty environment map:
+ <pre>
+ // Create an environment map to hold connection properties
+ // like credentials etc... We will later pass this map
+ // to the JMX Connector.
+ //
+ System.out.println("\nInitialize the environment map");
+ final Map&lt;String,Object> env = new HashMap&lt;String,Object>();
+ </pre>
+ </li>
+ <li>Putting the client's credentials in that map:
+ <i>(here the client will log in as <b>guest</b>)</i>
+ <pre>
+ // Provide the credentials required by the server
+ // to successfully perform user authentication
+ //
+ final String[] credentials = new String[] { "guest" , "guestpasswd" };
+ env.put("jmx.remote.credentials", credentials);
+ </pre>
+ </li>
+ <li>Providing an <code>SslRMIClientSocketFactory</code> to interact
+ with the secure RMI Registry:
+ <pre>
+ // Provide the SSL/TLS-based RMI Client Socket Factory required
+ // by the JNDI/RMI Registry Service Provider to communicate with
+ // the SSL/TLS-protected RMI Registry
+ //
+ env.put("com.sun.jndi.rmi.factory.socket",
+ new SslRMIClientSocketFactory());
+ </pre>
+ </li>
+ <li>Creating a JMXConnector and connecting with the
+ secure server:
+ <pre>
+ // Create the RMI connector client and
+ // connect it to the secure RMI connector server.
+ // args[0] is the server's host - localhost
+ // args[1] is the secure server port - 4545
+ //
+ System.out.println("\nCreate the RMI connector client and " +
+ "connect it to the RMI connector server");
+ final JMXServiceURL url = new JMXServiceURL(
+ "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1]+
+ "/jmxrmi");
+ final JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
+ </pre>
+ </li>
+ </ul>
+ <p>For this to work, we also need to start the <code>ScanDirClient</code>
+ with the appropriate system properties that will point to our
+ <code>keystore</code> and <code>truststore</code>. To start the secure
+ client, go to the <i>scandir</i> example root directory and type
+ the following command:
+ <p><code>ant jar<br>
+java
+ &nbsp;-Djava.util.logging.config.file=logging.properties
+ &nbsp;-Djavax.net.ssl.keyStore=keystore
+ &nbsp;-Djavax.net.ssl.keyStorePassword=password
+ &nbsp;-Djavax.net.ssl.trustStore=truststore
+ &nbsp;-Djavax.net.ssl.trustStorePassword=trustword
+ &nbsp;-classpath&nbsp;dist/jmx-scandir.jar
+ &nbsp;com.sun.jmx.examples.scandir.ScanDirClient&nbsp;localhost&nbsp;4545
+ </code></p>
+ </p>
+ <p>You should be seeing this trace:
+<center><table width="90%" border="0" bgcolor="#eeeeee">
+<tr><td>
+<pre>
+Initialize the environment map
+
+Create the RMI connector client and connect it to the RMI connector server
+Connecting to: service:jmx:rmi:///jndi/rmi://localhost:4545/jmxrmi
+
+Get the MBeanServerConnection
+
+Get ScanDirConfigMXBean from ScanManagerMXBean
+
+Get 'Configuration' attribute on ScanDirConfigMXBean
+
+Configuration:
+
+&lt;ScanManager xmlns="jmx:com.sun.jmx.examples.scandir.config" name="testconfig">
+ &lt;InitialResultLogConfig>
+ &lt;LogFileMaxRecords>2048&lt;/LogFileMaxRecords>
+ &lt;LogFileName>build/scandir.log&lt;/LogFileName>
+ &lt;MemoryMaxRecords>128&lt;/MemoryMaxRecords>
+ &lt;/InitialResultLogConfig>
+ &lt;DirectoryScannerList>
+ &lt;DirectoryScanner name="scan-build">
+ &lt;Actions>NOTIFY LOGRESULT&lt;/Actions>
+ &lt;ExcludeFiles/>
+ &lt;IncludeFiles>
+ &lt;FileFilter>
+ &lt;FilePattern>.*\.class&lt;/FilePattern>
+ &lt;SizeExceedsMaxBytes>4096&lt;/SizeExceedsMaxBytes>
+ &lt;/FileFilter>
+ &lt;/IncludeFiles>
+ &lt;RootDirectory>build&lt;/RootDirectory>
+ &lt;/DirectoryScanner>
+ &lt;/DirectoryScannerList>
+&lt;/ScanManager>
+
+Invoke 'close' on ScanManagerMXBean
+
+Got expected security exception: java.lang.SecurityException: Access denied!
+Invalid access level for requested MBeanServer operation.
+
+Close the connection to the server
+
+Bye! Bye!
+</pre>
+</td></tr></table></center>
+ <p>If the <code>ScanDirClient</code> fails to connect with
+ the secure agent, then this article - <a
+ href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
+ title="Troubleshooting connection problems in JConsole"
+ >Troubleshooting connection problems in JConsole</a> - may help
+ you figure out what is going wrong. Indeed the connection steps
+ performed by the <code>ScanDirClient</code> are very similar to
+ those performed by <code>jconsole</code>, and the problems you
+ could encounter are identical. Just remember that
+ <code>jconsole</code> needs the extra <code>-J</code> flag to pass
+ system properties to the VM, which is not needed with regular
+ <code>java</code> launcher invocations.
+ </p>
+ </ul>
+
+ <h2><a name="h2-Conclusion">Conclusion</a></h2>
+ <ul>
+ <p>
+ In this document, we have presented an advanced
+ JMX example, and shown how to run a secure
+ JMX agent in a production environment.
+ We have also shown how to connect to such a
+ secure agent with both jconsole and a programmatic
+ client. We have also discuss various JMX
+ design-patterns and best practices.
+ Readers who would wish to learn more about JMX, and
+ Monitoring and Management of the JVM, are invited
+ to follow the links given in reference below.
+ </p>
+ </ul>
+ <h2><a name="h2-References">References</a></h2>
+ <ol>
+ <li><a href="http://java.sun.com/products/JavaManagement/best-practices.html"
+ >JMX Best Practices</a>: This document describes best practices that
+ have been identified for modeling using the JMX API. </li>
+ <li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html"
+ >Monitoring and Management Using JMX</a>: How to enable, configure, and
+ connect to the JVM JMX agent.</li>
+ <li><a name="JConsole"><a
+href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html"
+>Using JConsole</a>: JConsole is a JMX-Compliant monitoring tool which allows
+ you to interact graphically with your own MBeans.
+ </li>
+ <li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/"
+ >Monitoring and Management for the Java Platform</a>: The Java Platform
+ Standard Edition (Java SE) 6 provides comprehensive monitoring and
+ management support for the Java platform. </li>
+ <li><a href="http://java.sun.com/products/JavaManagement/community/jmx_blogs.html"
+ >List of JMX-related Blogs</a>: This page provides links to the
+ different web logs written by members of the Sun team working on the
+ JMX API.</li>
+ <li><a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
+ title="The JSSE Reference Guide"
+ >Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>:
+ comprehensive documentation about the Java<sup>TM</sup> Secure Socket
+ Extension (JSSE)
+ </li>
+ <li><a href="http://java.sun.com/javase/6/docs/"
+ >Java SE 6 Documentation Index</a>: This document covers the
+ Java<sup>TM</sup> Platform, Standard Edition 6 JDK.</li>
+ </ol>
+ <p>
+ <hr>
+ <p>
+ </body>
+</html>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/keystore b/staging/darwin-x86/sample/jmx/jmx-scandir/keystore
new file mode 100644
index 0000000..05f5356
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/keystore
Binary files differ
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/logging.properties b/staging/darwin-x86/sample/jmx/jmx-scandir/logging.properties
new file mode 100644
index 0000000..1714bee
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/logging.properties
@@ -0,0 +1,17 @@
+handlers= java.util.logging.ConsoleHandler
+
+.level=INFO
+
+
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+javax.management.level=INFO
+com.sun.jmx.level=INFO
+com.sun.jmx.examples.level=FINE
+
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/manifest.mf b/staging/darwin-x86/sample/jmx/jmx-scandir/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml
new file mode 100644
index 0000000..42da880
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="jmx-scandir/file">
+
+ <import file="../build.xml"/>
+
+ <target name="compile-selected" depends="-init">
+ <fail unless="includes">Must set property 'includes'</fail>
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" includes="${includes}">
+ <classpath path="${cp}"/>
+ </javac>
+ </target>
+
+</project>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml
new file mode 100644
index 0000000..2b85b77
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project name="jdk" basedir=".">
+
+ <target name="-jdk-preinit">
+ <condition property=".exe" value=".exe">
+ <os family="windows"/>
+ </condition>
+ <property name=".exe" value=""/>
+ <property name="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}"/>
+ <property name="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}"/>
+ <property name="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}"/>
+ <property name="nbjdk.appletviewer" value="${nbjdk.home}/bin/appletviewer${.exe}"/>
+ <property name="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar"/>
+ </target>
+
+ <target name="-jdk-presetdef-basic" depends="-jdk-preinit" unless="nbjdk.presetdef.basic.done">
+ <macrodef name="javac-presetdef">
+ <attribute name="javacval"/>
+ <sequential>
+ <presetdef name="javac">
+ <javac fork="yes" executable="@{javacval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javac-presetdef javacval="${nbjdk.javac}"/>
+ <macrodef name="java-presetdef">
+ <attribute name="javaval"/>
+ <sequential>
+ <presetdef name="java">
+ <java fork="yes" jvm="@{javaval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <java-presetdef javaval="${nbjdk.java}"/>
+ <macrodef name="javadoc-presetdef">
+ <attribute name="javadocval"/>
+ <sequential>
+ <presetdef name="javadoc">
+ <javadoc executable="@{javadocval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
+ <property name="nbjdk.presetdef.basic.done" value="true"/>
+ </target>
+
+ <target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" unless="nbjdk.presetdef.nbjpdastart.done">
+ <macrodef name="nbjpdastart-presetdef">
+ <attribute name="bootcpval"/>
+ <sequential>
+ <presetdef name="nbjpdastart">
+ <nbjpdastart>
+ <bootclasspath>
+ <path path="@{bootcpval}"/>
+ </bootclasspath>
+ </nbjpdastart>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
+ <property name="nbjdk.presetdef.nbjpdastart.done" value="true"/>
+ </target>
+
+ <target name="-jdk-init" depends="-jdk-preinit,-jdk-presetdef-basic"/>
+
+</project>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml
new file mode 100644
index 0000000..facdb4e
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="jmx-scandir/NB">
+
+ <import file="../build.xml"/>
+
+ <target name="debug" depends="compile,-jdk-presetdef-nbjpdastart">
+ <nbjpdastart addressproperty="jpda.address" name="jmx-scandir" transport="dt_socket">
+ <classpath path="${run.cp}"/>
+ </nbjpdastart>
+ <java classname="${main.client.class}" failonerror="true" fork="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=none"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ <arg line="${client.args}" />
+ </java>
+ </target>
+
+ <target name="debug-fix" depends="-init">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ <include name="${class}.java"/>
+ </javac>
+ <nbjpdareload>
+ <fileset dir="${classes.dir}">
+ <include name="${class}.class"/>
+ </fileset>
+ </nbjpdareload>
+ </target>
+
+ <target name="show-info" depends="-init">
+ <nbbrowse file="${main.dir}/index.html"/>
+ </target>
+
+ <target name="show-javadoc" depends="javadoc">
+ <nbbrowse file="${javadoc.dir}/index.html"/>
+ </target>
+
+ <target name="profile" depends="compile">
+ <nbprofiledirect>
+ <classpath path="${run.cp}"/>
+ </nbprofiledirect>
+ <property environment="env"/>
+ <java classname="${main.client.class}" fork="true" failonerror="true" dir="${profiler.session.working.dir}" jvm="${profiler.info.jvm}">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <arg line="localhost 4545" />
+ <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}"/>
+ <env key="Path" path="${profiler.info.agentpath}:${env.Path}"/>
+ </java>
+ </target>
+
+</project>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/project.xml b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/project.xml
new file mode 100644
index 0000000..a988de6
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/nbproject/project.xml
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>jmx-scandir</name>
+ <properties>
+ <property-file>user.build.properties</property-file>
+ <property-file>build.properties</property-file>
+ <property name="nbjdk.bootclasspath">${nbjdk.home}/jre/lib/rt.jar</property>
+ </properties>
+ <folders>
+ <source-folder>
+ <label>JDK Demo</label>
+ <location>${main.dir}</location>
+ </source-folder>
+ <source-folder>
+ <label>Sources</label>
+ <type>java</type>
+ <location>${src.dir}</location>
+ </source-folder>
+ <source-folder>
+ <label>test</label>
+ <type>java</type>
+ <location>test</location>
+ </source-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>jar</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>jar</target>
+ </action>
+ <action name="run">
+ <target>run</target>
+ </action>
+ <action name="ReadMe">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>show-info</target>
+ </action>
+ <action name="javadoc">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>show-javadoc</target>
+ </action>
+ <action name="debug">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ </action>
+ <action name="compile.single">
+ <script>nbproject/file-targets.xml</script>
+ <target>compile-selected</target>
+ <context>
+ <property>includes</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path</format>
+ <arity>
+ <separated-files>,</separated-files>
+ </arity>
+ </context>
+ </action>
+ <action name="run.single">
+ <target>run</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.single">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.fix">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug-fix</target>
+ <context>
+ <property>class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path-noext</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="test">
+ <target>test</target>
+ </action>
+ </ide-actions>
+ <export>
+ <type>folder</type>
+ <location>${classes.dir}</location>
+ <build-target>jar</build-target>
+ </export>
+ <export>
+ <type>jar</type>
+ <location>${jar}</location>
+ <build-target>jar</build-target>
+ </export>
+ <export>
+ <type>folder</type>
+ <location>${build.test.classes.dir}</location>
+ <build-target>jar</build-target>
+ </export>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>Sources</label>
+ <location>${src.dir}</location>
+ </source-folder>
+ <source-folder style="packages">
+ <label>test</label>
+ <location>test</location>
+ </source-folder>
+ <source-file>
+ <location>${main.dir}/index.html</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="ReadMe"/>
+ <ide-action name="build"/>
+ <ide-action name="clean"/>
+ <ide-action name="rebuild"/>
+ <ide-action name="javadoc"/>
+ <ide-action name="debug"/>
+ <!-- ide-action name="test"/ -->
+ <separator/>
+ <action>
+ <label>Run Agent</label>
+ <target>run-agent</target>
+ </action>
+ <action>
+ <label>Run Client</label>
+ <target>run-client</target>
+ </action>
+ </context-menu>
+ </view>
+ <subprojects/>
+ </general-data>
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
+ <compilation-unit>
+ <package-root>${src.dir}</package-root>
+ <classpath mode="compile">${cp}</classpath>
+ <classpath mode="execute">${run.cp}</classpath>
+ <classpath mode="boot">${nbjdk.bootclasspath}</classpath>
+ <built-to>${classes.dir}</built-to>
+ <built-to>${jar}</built-to>
+ <javadoc-built-to>${javadoc.dir}</javadoc-built-to>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ <compilation-unit>
+ <package-root>test</package-root>
+ <unit-tests/>
+ <built-to>${build.test.classes.dir}</built-to>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java
new file mode 100644
index 0000000..0ff58a2
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java
@@ -0,0 +1,591 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManager.getNextSeqNumber;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import static com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action.*;
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action;
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.management.AttributeChangeNotification;
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+
+/**
+ * A <code>DirectoryScanner</code> is an MBean that
+ * scans a file system starting at a given root directory,
+ * and then looks for files that match a given criteria.
+ * <p>
+ * When such a file is found, the <code>DirectoryScanner</code> takes
+ * the action for which it was configured: emit a notification,
+ * <i>and or</i> log a {@link
+ * com.sun.jmx.examples.scandir.config.ResultRecord} for this file,
+ * <i>and or</i> delete that file.
+ * </p>
+ * <p>
+ * The code that would actually delete the file is commented out - so that
+ * nothing valuable is lost if this example is run by mistake on the wrong
+ * set of directories.<br>
+ * Logged results are logged by sending them to the {@link ResultLogManager}.
+ * </p>
+ * <p>
+ * <code>DirectoryScannerMXBeans</code> are created, initialized, and
+ * registered by the {@link ScanManagerMXBean}.
+ * The {@link ScanManagerMXBean} will also schedule and run them in
+ * background by calling their {@link #scan} method.
+ * </p>
+ * <p>Client code is not expected to create or register directly any such
+ * MBean. Instead, clients are expected to modify the configuration, using
+ * the {@link ScanDirConfigMXBean}, and then apply it, using the {@link
+ * ScanManagerMXBean}. Instances of <code>DirectoryScannerMXBeans</code>
+ * will then be created and registered (or unregistered and garbage collected)
+ * as a side effect of applying that configuration.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class DirectoryScanner implements
+ DirectoryScannerMXBean, NotificationEmitter {
+
+ /**
+ * The type for <i>com.sun.jmx.examples.scandir.filematch</i> notifications.
+ * Notifications of this type will be emitted whenever a file that
+ * matches this {@code DirectoryScanner} criteria is found, but only if
+ * this {@code DirectoryScanner} was configured to {@link
+ * Action#NOTIFY notify} for matching files.
+ **/
+ public static final String FILE_MATCHES_NOTIFICATION =
+ "com.sun.jmx.examples.scandir.filematch";
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(DirectoryScanner.class.getName());
+
+ // Attribute : State
+ //
+ private volatile ScanState state = STOPPED;
+
+ // The DirectoryScanner delegates the implementation of
+ // the NotificationEmitter interface to a wrapped instance
+ // of NotificationBroadcasterSupport.
+ //
+ private final NotificationBroadcasterSupport broadcaster;
+
+ // The root directory at which this DirectoryScanner will start
+ // scanning. Constructed from config.getRootDirectory().
+ //
+ private final File rootFile;
+
+ // This DirectoryScanner config - this is a constant which is
+ // provided at construction time by the {@link ScanManager}.
+ //
+ private final DirectoryScannerConfig config;
+
+ // The set of actions for which this DirectoryScanner is configured.
+ // Constructed from config.getActions()
+ //
+ final Set<Action> actions;
+
+ // The ResultLogManager that this DirectoryScanner will use to log
+ // info. This is a hard reference to another MBean, provided
+ // at construction time by the ScanManager.
+ // The ScanManager makes sure that the life cycle of these two MBeans
+ // is consistent.
+ //
+ final ResultLogManager logManager;
+
+ /**
+ * Constructs a new {@code DirectoryScanner}.
+ * <p>This constructor is
+ * package protected, and this MBean cannot be created by a remote
+ * client, because it needs a reference to the {@link ResultLogManager},
+ * which cannot be provided from remote.
+ * </p>
+ * <p>This is a conscious design choice: {@code DirectoryScanner} MBeans
+ * are expected to be completely managed (created, registered, unregistered)
+ * by the {@link ScanManager} which does provide this reference.
+ * </p>
+ *
+ * @param config This {@code DirectoryScanner} configuration.
+ * @param logManager The info log manager with which to log the info
+ * records.
+ * @throws IllegalArgumentException if one of the parameter is null, or if
+ * the provided {@code config} doesn't have its {@code name} set,
+ * or if the {@link DirectoryScannerConfig#getRootDirectory
+ * root directory} provided in the {@code config} is not acceptable
+ * (not provided or not found or not readable, etc...).
+ **/
+ public DirectoryScanner(DirectoryScannerConfig config,
+ ResultLogManager logManager)
+ throws IllegalArgumentException {
+ if (logManager == null)
+ throw new IllegalArgumentException("log=null");
+ if (config == null)
+ throw new IllegalArgumentException("config=null");
+ if (config.getName() == null)
+ throw new IllegalArgumentException("config.name=null");
+
+ broadcaster = new NotificationBroadcasterSupport();
+
+ // Clone the config: ensure data encapsulation.
+ //
+ this.config = XmlConfigUtils.xmlClone(config);
+
+ // Checks that the provided root directory is valid.
+ // Throws IllegalArgumentException if it isn't.
+ //
+ rootFile = validateRoot(config.getRootDirectory());
+
+ // Initialize the Set<Action> for which this DirectoryScanner
+ // is configured.
+ //
+ if (config.getActions() == null)
+ actions = Collections.emptySet();
+ else
+ actions = EnumSet.copyOf(Arrays.asList(config.getActions()));
+ this.logManager = logManager;
+ }
+
+ // see DirectoryScannerMXBean
+ public void stop() {
+ // switch state to stop and send AttributeValueChangeNotification
+ setStateAndNotify(STOPPED);
+ }
+
+ // see DirectoryScannerMXBean
+ public String getRootDirectory() {
+ return rootFile.getAbsolutePath();
+ }
+
+
+ // see DirectoryScannerMXBean
+ public ScanState getState() {
+ return state;
+ }
+
+ // see DirectoryScannerMXBean
+ public DirectoryScannerConfig getConfiguration() {
+ return config;
+ }
+
+ // see DirectoryScannerMXBean
+ public String getCurrentScanInfo() {
+ final ScanTask currentOrLastTask = currentTask;
+ if (currentOrLastTask == null) return "Never Run";
+ return currentOrLastTask.getScanInfo();
+ }
+
+ // This variable points to the current (or latest) scan.
+ //
+ private volatile ScanTask currentTask = null;
+
+ // see DirectoryScannerMXBean
+ public void scan() {
+ final ScanTask task;
+
+ synchronized (this) {
+ final LinkedList<File> list;
+ switch (state) {
+ case RUNNING:
+ case SCHEDULED:
+ throw new IllegalStateException(state.toString());
+ case STOPPED:
+ case COMPLETED:
+ // only accept to scan if state is STOPPED or COMPLETED.
+ list = new LinkedList<File>();
+ list.add(rootFile);
+ break;
+ default:
+ throw new IllegalStateException(String.valueOf(state));
+ }
+
+ // Create a new ScanTask object for our root directory file.
+ //
+ currentTask = task = new ScanTask(list,this);
+
+ // transient state... will be switched to RUNNING when
+ // task.execute() is called. This code could in fact be modified
+ // to use java.util.concurent.Future and, to push the task to
+ // an executor. We would then need to wait for the task to
+ // complete before returning. However, this wouldn't buy us
+ // anything - since this method should wait for the task to
+ // finish anyway: so why would we do it?
+ // As it stands, we simply call task.execute() in the current
+ // thread - brave and fearless readers may want to attempt the
+ // modification ;-)
+ //
+ setStateAndNotify(SCHEDULED);
+ }
+ task.execute();
+ }
+
+ // This method is invoked to carry out the configured actions on a
+ // matching file.
+ // Do not call this method from within synchronized() { } as this
+ // method may send notifications!
+ //
+ void actOn(File file) {
+
+ // Which action were actually taken
+ //
+ final Set<Action> taken = new HashSet<Action>();
+ boolean logresult = false;
+
+ // Check out which actions are configured and carry them out.
+ //
+ for (Action action : actions) {
+ switch (action) {
+ case DELETE:
+ if (deleteFile(file)) {
+ // Delete succeeded: add DELETE to the set of
+ // actions carried out.
+ taken.add(DELETE);
+ }
+ break;
+ case NOTIFY:
+ if (notifyMatch(file)) {
+ // Notify succeeded: add NOTIFY to the set of
+ // actions carried out.
+ taken.add(NOTIFY);
+ }
+ break;
+ case LOGRESULT:
+ // LOGRESULT was configured - log actions carried out.
+ // => we must execute this action as the last action.
+ // simply set logresult=true for now. We will do
+ // the logging later
+ logresult = true;
+ break;
+ default:
+ LOG.fine("Failed to execute action: " +action +
+ " - action not supported");
+ break;
+ }
+ }
+
+ // Now is time for logging:
+ if (logresult) {
+ taken.add(LOGRESULT);
+ if (!logResult(file,taken.toArray(new Action[taken.size()])))
+ taken.remove(LOGRESULT); // just for the last trace below...
+ }
+
+ LOG.finest("File processed: "+taken+" - "+file.getAbsolutePath());
+ }
+
+ // Deletes a matching file.
+ private boolean deleteFile(File file) {
+ try {
+ // file.delete() is commented so that we don't do anything
+ // bad if the example is mistakenly run on the wrong set of
+ // directories.
+ //
+ /* file.delete(); */
+ System.out.println("DELETE not implemented for safety reasons.");
+ return true;
+ } catch (Exception x) {
+ LOG.fine("Failed to delete: "+file.getAbsolutePath());
+ }
+ return false;
+ }
+
+ // Notifies of a matching file.
+ private boolean notifyMatch(File file) {
+ try {
+ final Notification n =
+ new Notification(FILE_MATCHES_NOTIFICATION,this,
+ getNextSeqNumber(),
+ file.getAbsolutePath());
+
+ // This method *is not* called from any synchronized block, so
+ // we can happily call broadcaster.sendNotification() here.
+ // Note that verifying whether a method is called from within
+ // a synchronized block demends a thoroughful code reading,
+ // examining each of the 'parent' methods in turn.
+ //
+ broadcaster.sendNotification(n);
+ return true;
+ } catch (Exception x) {
+ LOG.fine("Failed to notify: "+file.getAbsolutePath());
+ }
+ return false;
+ }
+
+ // Logs a result with the ResultLogManager
+ private boolean logResult(File file,Action[] actions) {
+ try {
+ logManager.log(new ResultRecord(config, actions,file));
+ return true;
+ } catch (Exception x) {
+ LOG.fine("Failed to log: "+file.getAbsolutePath());
+ }
+ return false;
+ }
+
+
+ // Contextual object used to store info about current
+ // (or last) scan.
+ //
+ private static class ScanTask {
+
+ // List of Files that remain to scan.
+ // When files are discovered they are added to the list.
+ // When they are being handled, they are removed from the list.
+ // When the list is empty, the scanning is finished.
+ //
+ private final LinkedList<File> list;
+ private final DirectoryScanner scan;
+
+ // Some statistics...
+ //
+ private volatile long scanned=0;
+ private volatile long matching=0;
+
+ private volatile String info="Not started";
+
+ ScanTask(LinkedList<File> list, DirectoryScanner scan) {
+ this.list = list; this.scan = scan;
+ }
+
+ public void execute() {
+ scan(list);
+ }
+
+ private void scan(LinkedList<File> list) {
+ scan.scan(this,list);
+ }
+
+ public String getScanInfo() {
+ return info+" - ["+scanned+" scanned, "+matching+" matching]";
+ }
+ }
+
+ // The actual scan logic. Switches state to RUNNING,
+ // and scan the list of given dirs.
+ // The list is a live object which is updated by this method.
+ // This would allow us to implement methods like "pause" and "resume",
+ // since all the info needed to resume would be in the list.
+ //
+ private void scan(ScanTask task, LinkedList<File> list) {
+ setStateAndNotify(RUNNING);
+ task.info = "In Progress";
+ try {
+
+ // The FileFilter will tell us which files match and which don't.
+ //
+ final FileFilter filter = config.buildFileFilter();
+
+ // We have two condition to end the loop: either the list is
+ // empty, meaning there's nothing more to scan, or the state of
+ // the DirectoryScanner was asynchronously switched to STOPPED by
+ // another thread, e.g. because someone called "stop" on the
+ // ScanManagerMXBean
+ //
+ while (!list.isEmpty() && state == RUNNING) {
+
+ // Get and remove the first element in the list.
+ //
+ final File current = list.poll();
+
+ // Increment number of file scanned.
+ task.scanned++;
+
+ // If 'current' is a file, it's already been matched by our
+ // file filter (see below): act on it.
+ // Note that for the first iteration of this loop, there will
+ // be one single file in the list: the root directory for this
+ // scanner.
+ //
+ if (current.isFile()) {
+ task.matching++;
+ actOn(current);
+ }
+
+ // If 'current' is a directory, then
+ // find files and directories that match the file filter
+ // in this directory
+ //
+ if (current.isDirectory()) {
+
+ // Gets matching files and directories
+ final File[] content = current.listFiles(filter);
+ if (content == null) continue;
+
+ // Adds all matching file to the list.
+ list.addAll(0,Arrays.asList(content));
+ }
+ }
+
+ // The loop terminated. If the list is empty, then we have
+ // completed our task. If not, then somebody must have called
+ // stop() on this directory scanner.
+ //
+ if (list.isEmpty()) {
+ task.info = "Successfully Completed";
+ setStateAndNotify(COMPLETED);
+ }
+ } catch (Exception x) {
+ // We got an exception: stop the scan
+ //
+ task.info = "Failed: "+x;
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,"scan task failed: "+x,x);
+ else if (LOG.isLoggable(Level.FINE))
+ LOG.log(Level.FINE,"scan task failed: "+x);
+ setStateAndNotify(STOPPED);
+ } catch (Error e) {
+ // We got an Error:
+ // Should not happen unless we ran out of memory or
+ // whatever - don't even try to notify, but
+ // stop the scan anyway!
+ //
+ state=STOPPED;
+ task.info = "Error: "+e;
+
+ // rethrow error.
+ //
+ throw e;
+ }
+ }
+
+ /**
+ * MBeanNotification support - delegates to broadcaster.
+ */
+ public void addNotificationListener(NotificationListener listener,
+ NotificationFilter filter, Object handback)
+ throws IllegalArgumentException {
+ broadcaster.addNotificationListener(listener, filter, handback);
+ }
+
+ // Switch this object state to the desired value an send
+ // a notification. Don't call this method from within a
+ // synchronized block!
+ //
+ private final void setStateAndNotify(ScanState desired) {
+ final ScanState old = state;
+ if (old == desired) return;
+ state = desired;
+ final AttributeChangeNotification n =
+ new AttributeChangeNotification(this,
+ getNextSeqNumber(),System.currentTimeMillis(),
+ "state change","State",ScanState.class.getName(),
+ String.valueOf(old),String.valueOf(desired));
+ broadcaster.sendNotification(n);
+ }
+
+
+ /**
+ * The {@link DirectoryScannerMXBean} may send two types of
+ * notifications: filematch, and state attribute changed.
+ **/
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return new MBeanNotificationInfo[] {
+ new MBeanNotificationInfo(
+ new String[] {FILE_MATCHES_NOTIFICATION},
+ Notification.class.getName(),
+ "Emitted when a file that matches the scan criteria is found"
+ ),
+ new MBeanNotificationInfo(
+ new String[] {AttributeChangeNotification.ATTRIBUTE_CHANGE},
+ AttributeChangeNotification.class.getName(),
+ "Emitted when the State attribute changes"
+ )
+ };
+ }
+
+ /**
+ * MBeanNotification support - delegates to broadcaster.
+ */
+ public void removeNotificationListener(NotificationListener listener)
+ throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener);
+ }
+
+ /**
+ * MBeanNotification support - delegates to broadcaster.
+ */
+ public void removeNotificationListener(NotificationListener listener,
+ NotificationFilter filter, Object handback)
+ throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener, filter, handback);
+ }
+
+ // Validates the given root directory, returns a File object for
+ // that directory.
+ // Throws IllegalArgumentException if the given root is not
+ // acceptable.
+ //
+ private static File validateRoot(String root) {
+ if (root == null)
+ throw new IllegalArgumentException("no root specified");
+ if (root.length() == 0)
+ throw new IllegalArgumentException("specified root \"\" is invalid");
+ final File f = new File(root);
+ if (!f.canRead())
+ throw new IllegalArgumentException("can't read "+root);
+ if (!f.isDirectory())
+ throw new IllegalArgumentException("no such directory: "+root);
+ return f;
+ }
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java
new file mode 100644
index 0000000..2ca3548
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import java.io.IOException;
+import javax.management.InstanceNotFoundException;
+
+/**
+ * A <code>DirectoryScannerMXBean</code> is an MBean that
+ * scans a file system starting at a given root directory,
+ * and then looks for files that match a given criteria.
+ * <p>
+ * When such a file is found, the <code>DirectoryScannerMXBean</code> takes
+ * the actions for which it was configured: see {@link #scan scan()}.
+ * <p>
+ * <code>DirectoryScannerMXBeans</code> are created, initialized, and
+ * registered by the {@link ScanManagerMXBean}.
+ * The {@link ScanManagerMXBean} will also schedule and run them in
+ * background by calling their {@link #scan} method.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public interface DirectoryScannerMXBean {
+ /**
+ * Get The {@link DirectoryScanner} state.
+ * @return the current state of the <code>DirectoryScanner</code>.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanState getState()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Stops the current scan if {@link ScanState#RUNNING running}.
+ * After this method completes the state of the application will
+ * be {@link ScanState#STOPPED STOPPED}.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void stop()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Scans the file system starting at the specified {@link #getRootDirectory
+ * root directory}.
+ * <p>If a file that matches this <code>DirectoryScannerMXBean</code>
+ * {@link #getConfiguration} criteria is found,
+ * the <code>DirectoryScannerMXBean</code> takes the {@link
+ * DirectoryScannerConfig#getActions() actions} for which
+ * it was {@link #getConfiguration configured}: emit a notification,
+ * <i>and or</i> log a {@link
+ * com.sun.jmx.examples.scandir.config.ResultRecord} for this file,
+ * <i>and or</i> delete that file.
+ * </p>
+ * <p>
+ * The code that would actually delete the file is commented out - so that
+ * nothing valuable is lost if this example is run by mistake on the wrong
+ * set of directories.
+ * </p>
+ * <p>This method returns only when the directory scan is completed, or
+ * if it was {@link #stop stopped} by another thread.
+ * </p>
+ * @throws IllegalStateException if already {@link ScanState#RUNNING}
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void scan()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the root directory at which this <code>DirectoryScannerMXBean</code>
+ * will start scanning the file system.
+ * <p>
+ * This is a shortcut to {@link #getConfiguration
+ * getConfiguration()}.{@link
+ * DirectoryScannerConfig#getRootDirectory
+ * getRootDirectory()}.
+ * </p>
+ * @return This <code>DirectoryScannerMXBean</code> root directory.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getRootDirectory()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * The configuration data from which this {@link DirectoryScanner} was
+ * created.
+ * <p>
+ * You cannot change this configuration here. You can however
+ * {@link ScanDirConfigMXBean#setConfiguration modify} the
+ * {@link ScanDirConfigMXBean} configuration, and ask the
+ * {@link ScanManagerMXBean} to {@link ScanManagerMXBean#applyConfiguration
+ * apply} it. This will get all <code>DirectoryScannerMXBean</code>
+ * replaced by new MBeans created from the modified configuration.
+ * </p>
+ *
+ * @return This <code>DirectoryScannerMXBean</code> configuration data.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public DirectoryScannerConfig getConfiguration()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * A short string describing what's happening in current/latest scan.
+ * @return a short info string.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getCurrentScanInfo()
+ throws IOException, InstanceNotFoundException;
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java
new file mode 100644
index 0000000..a0a4bb9
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java
@@ -0,0 +1,534 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManager.getNextSeqNumber;
+import com.sun.jmx.examples.scandir.config.ResultLogConfig;
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Logger;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.ObjectName;
+import javax.xml.bind.JAXBException;
+
+/**
+ * The <code>ResultLogManager</code> is in charge of managing result logs.
+ * {@link DirectoryScanner DirectoryScanners} can be configured to log a
+ * {@link ResultRecord} whenever they take action upon a file that
+ * matches their set of matching criteria.
+ * The <code>ResultLogManagerMXBean</code> is responsible for storing these
+ * results in its result logs.
+ * <p>The <code>ResultLogManagerMXBean</code> can be configured to log
+ * these records to a flat file, or into a log held in memory, or both.
+ * Both logs (file and memory) can be configured with a maximum capacity.
+ * <br>When the maximum capacity of the memory log is reached - its first
+ * entry (i.e. its eldest entry) is removed to make place for the latest.
+ * <br>When the maximum capacity of the file log is reached, the file is
+ * renamed by appending a tilde '~' to its name and a new result log is created.
+ *
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ResultLogManager extends NotificationBroadcasterSupport
+ implements ResultLogManagerMXBean, MBeanRegistration {
+
+ /**
+ * The default singleton name of the {@link ResultLogManagerMXBean}.
+ **/
+ public static final ObjectName RESULT_LOG_MANAGER_NAME =
+ ScanManager.makeSingletonName(ResultLogManagerMXBean.class);
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ResultLogManager.class.getName());
+
+ // The memory log
+ //
+ private final List<ResultRecord> memoryLog;
+
+ // Whether the memory log capacity was reached. In that case every
+ // new entry triggers the deletion of the eldest one.
+ //
+ private volatile boolean memCapacityReached = false;
+
+ // The maximum number of record that the memory log can
+ // contain.
+ //
+ private volatile int memCapacity;
+
+ // The maximum number of record that the ResultLogManager can
+ // log in the log file before creating a new file.
+ //
+ private volatile long fileCapacity;
+
+ // The current log file.
+ //
+ private volatile File logFile;
+
+ // The OutputStream of the current log file.
+ //
+ private volatile OutputStream logStream = null;
+
+ // number of record that this object has logged in the log file
+ // since the log file was created. Creating a new file or clearing
+ // the log file reset this value to '0'
+ //
+ private volatile long logCount = 0;
+
+ // The ResultLogManager config - modified whenever
+ // ScanManager.applyConfiguration is called.
+ //
+ private volatile ResultLogConfig config;
+
+ /**
+ * Create a new ResultLogManagerMXBean. This constructor is package
+ * protected: only the {@link ScanManager} can create a
+ * <code>ResultLogManager</code>.
+ **/
+ ResultLogManager() {
+ // Instantiate the memory log - override the add() method so that
+ // it removes the head of the list when the maximum capacity is
+ // reached. Note that add() is the only method we will be calling,
+ // otherwise we would have to override all the other flavors
+ // of adding methods. Note also that this implies that the memoryLog
+ // will *always* remain encapsulated in this object and is *never*
+ // handed over (otherwise we wouldn't be able to ensure that
+ // add() is the only method ever called to add a record).
+ //
+ memoryLog =
+ Collections.synchronizedList(new LinkedList<ResultRecord>() {
+ public synchronized boolean add(ResultRecord e) {
+ final int max = getMemoryLogCapacity();
+ while (max > 0 && size() >= max) {
+ memCapacityReached = true;
+ removeFirst();
+ }
+ return super.add(e);
+ }
+ });
+
+ // default memory capacity
+ memCapacity = 2048;
+
+ // default file capacity: 0 means infinite ;-)
+ fileCapacity = 0;
+
+ // by default logging to file is disabled.
+ logFile = null;
+
+ // Until the ScanManager apply a new configuration, we're going to
+ // work with a default ResultLogConfig object.
+ config = new ResultLogConfig();
+ config.setMemoryMaxRecords(memCapacity);
+ config.setLogFileName(getLogFileName(false));
+ config.setLogFileMaxRecords(fileCapacity);
+ }
+
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * registered in the MBean server.
+ * <p>If the name of the MBean is not
+ * specified, the MBean can provide a name for its registration. If
+ * any exception is raised, the MBean will not be registered in the
+ * MBean server.</p>
+ * <p>The {@code ResultLogManager} uses this method to supply its own
+ * default singleton ObjectName (if <var>name</var> parameter is null).
+ * @param server The MBean server in which the MBean will be registered.
+ * @param name The object name of the MBean. This name is null if the
+ * name parameter to one of the createMBean or registerMBean methods in
+ * the MBeanServer interface is null. In that case, this method must
+ * return a non-null ObjectName for the new MBean.
+ * @return The name under which the MBean is to be registered. This value
+ * must not be null. If the name parameter is not null, it will usually
+ * but not necessarily be the returned value.
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public ObjectName preRegister(MBeanServer server, ObjectName name)
+ throws Exception {
+ if (name == null)
+ name = RESULT_LOG_MANAGER_NAME;
+ objectName = name;
+ mbeanServer = server;
+ return name;
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having
+ * been registered in the MBean server or after the registration has
+ * failed.
+ * <p>This implementation does nothing.</p>
+ * @param registrationDone Indicates whether or not the MBean has been
+ * successfully registered in the MBean server. The value false means
+ * that the registration has failed.
+ */
+ public void postRegister(Boolean registrationDone) {
+ // Don't need to do anything here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * unregistered by the MBean server.
+ * <p>This implementation does nothing.</p>
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public void preDeregister() throws Exception {
+ // Don't need to do anything here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having been
+ * unregistered in the MBean server.
+ * <p>Closes the log file stream, if it is still open.</p>
+ */
+ public void postDeregister() {
+ try {
+ if (logStream != null) {
+ synchronized(this) {
+ logStream.flush();
+ logStream.close();
+ logFile = null;
+ logStream = null;
+ }
+ }
+ } catch (Exception x) {
+ LOG.finest("Failed to close log properly: "+x);
+ }
+ }
+
+ /**
+ * Create a new empty log file from the given basename, renaming
+ * previously existing file by appending '~' to its name.
+ **/
+ private File createNewLogFile(String basename) throws IOException {
+ return XmlConfigUtils.createNewXmlFile(basename);
+ }
+
+ /**
+ * Check whether a new log file should be created.
+ * If a new file needs to be created, creates it, renaming
+ * previously existing file by appending '~' to its name.
+ * Also reset the log count and file capacity.
+ * Sends a notification indicating that the log file was changed.
+ * Returns the new log stream;
+ * Creation of a new file can be forced by passing force=true.
+ **/
+ private OutputStream checkLogFile(String basename, long maxRecords,
+ boolean force)
+ throws IOException {
+ final OutputStream newStream;
+ synchronized(this) {
+ if ((force==false) && (logCount < maxRecords))
+ return logStream;
+ final OutputStream oldStream = logStream;
+
+ // First close the stream. On some platforms you cannot rename
+ // a file that has open streams...
+ //
+ if (oldStream != null) {
+ oldStream.flush();
+ oldStream.close();
+ }
+ final File newFile = (basename==null)?null:createNewLogFile(basename);
+
+ newStream = (newFile==null)?null:new FileOutputStream(newFile,true);
+ logStream = newStream;
+ logFile = newFile;
+ fileCapacity = maxRecords;
+ logCount = 0;
+ }
+ sendNotification(new Notification(LOG_FILE_CHANGED,objectName,
+ getNextSeqNumber(),
+ basename));
+ return newStream;
+ }
+
+ // see ResultLogManagerMXBean
+ public void log(ResultRecord record)
+ throws IOException {
+ if (memCapacity > 0) logToMemory(record);
+ if (logFile != null) logToFile(record);
+ }
+
+ // see ResultLogManagerMXBean
+ public ResultRecord[] getMemoryLog() {
+ return memoryLog.toArray(new ResultRecord[0]);
+ }
+
+ // see ResultLogManagerMXBean
+ public int getMemoryLogCapacity() {
+ return memCapacity;
+ }
+
+ // see ResultLogManagerMXBean
+ public void setMemoryLogCapacity(int maxRecords) {
+ synchronized(this) {
+ memCapacity = maxRecords;
+ if (memoryLog.size() < memCapacity)
+ memCapacityReached = false;
+ config.setMemoryMaxRecords(maxRecords);
+ }
+ }
+
+ // see ResultLogManagerMXBean
+ public void setLogFileCapacity(long maxRecords)
+ throws IOException {
+ synchronized (this) {
+ fileCapacity = maxRecords;
+ config.setLogFileMaxRecords(maxRecords);
+ }
+ checkLogFile(getLogFileName(),fileCapacity,false);
+ }
+
+ // see ResultLogManagerMXBean
+ public long getLogFileCapacity() {
+ return fileCapacity;
+ }
+
+ // see ResultLogManagerMXBean
+ public long getLoggedCount() {
+ return logCount;
+ }
+
+ // see ResultLogManagerMXBean
+ public void newLogFile(String logname, long maxRecord)
+ throws IOException {
+ checkLogFile(logname,maxRecord,true);
+ config.setLogFileName(getLogFileName(false));
+ config.setLogFileMaxRecords(getLogFileCapacity());
+ }
+
+ // see ResultLogManagerMXBean
+ public String getLogFileName() {
+ return getLogFileName(true);
+ }
+
+ // see ResultLogManagerMXBean
+ public void clearLogs() throws IOException {
+ clearMemoryLog();
+ clearLogFile();
+ }
+
+ // Clear the memory log, sends a notification indicating that
+ // the memory log was cleared.
+ //
+ private void clearMemoryLog()throws IOException {
+ synchronized(this) {
+ memoryLog.clear();
+ memCapacityReached = false;
+ }
+ sendNotification(new Notification(MEMORY_LOG_CLEARED,
+ objectName,
+ getNextSeqNumber(),"memory log cleared"));
+ }
+
+ // Clears the log file.
+ //
+ private void clearLogFile() throws IOException {
+ // simply force the creation of a new log file.
+ checkLogFile(getLogFileName(),fileCapacity,true);
+ }
+
+ // Log a record to the memory log. Send a notification if the
+ // maximum capacity of the memory log is reached.
+ //
+ private void logToMemory(ResultRecord record) {
+
+ final boolean before = memCapacityReached;
+ final boolean after;
+ synchronized(this) {
+ memoryLog.add(record);
+ after = memCapacityReached;
+ }
+ if (before==false && after==true)
+ sendNotification(new Notification(MEMORY_LOG_MAX_CAPACITY,
+ objectName,
+ getNextSeqNumber(),"memory log capacity reached"));
+ }
+
+
+ // Log a record to the memory log. Send a notification if the
+ // maximum capacity of the memory log is reached.
+ //
+ private void logToFile(ResultRecord record) throws IOException {
+ final String basename;
+ final long maxRecords;
+ synchronized (this) {
+ if (logFile == null) return;
+ basename = getLogFileName(false);
+ maxRecords = fileCapacity;
+ }
+
+ // Get the stream into which we should log.
+ final OutputStream stream =
+ checkLogFile(basename,maxRecords,false);
+
+ // logging to file now disabled - too bad.
+ if (stream == null) return;
+
+ synchronized (this) {
+ try {
+ XmlConfigUtils.write(record,stream,true);
+ stream.flush();
+ // don't increment logCount if we were not logging in logStream.
+ if (stream == logStream) logCount++;
+ } catch (JAXBException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException("bad record",x);
+ LOG.finest("Failed to log record: "+x);
+ throw iae;
+ }
+ }
+ }
+
+ /**
+ * The notification type which indicates that the log file was switched:
+ * <i>com.sun.jmx.examples.scandir.log.file.switched</i>.
+ * The message contains the name of the new file (or null if log to file
+ * is now disabled).
+ **/
+ public final static String LOG_FILE_CHANGED =
+ "com.sun.jmx.examples.scandir.log.file.switched";
+
+ /**
+ * The notification type which indicates that the memory log capacity has
+ * been reached:
+ * <i>com.sun.jmx.examples.scandir.log.memory.full</i>.
+ **/
+ public final static String MEMORY_LOG_MAX_CAPACITY =
+ "com.sun.jmx.examples.scandir.log.memory.full";
+
+ /**
+ * The notification type which indicates that the memory log was
+ * cleared:
+ * <i>com.sun.jmx.examples.scandir.log.memory.cleared</i>.
+ **/
+ public final static String MEMORY_LOG_CLEARED =
+ "com.sun.jmx.examples.scandir.log.memory.cleared";
+
+ /**
+ * This MBean emits three kind of notifications:
+ * <pre>
+ * <i>com.sun.jmx.examples.scandir.log.file.switched</i>
+ * <i>com.sun.jmx.examples.scandir.log.memory.full</i>
+ * <i>com.sun.jmx.examples.scandir.log.memory.cleared</i>
+ * </pre>
+ **/
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return new MBeanNotificationInfo[] {
+ new MBeanNotificationInfo(new String[] {
+ LOG_FILE_CHANGED},
+ Notification.class.getName(),
+ "Emitted when the log file is switched")
+ ,
+ new MBeanNotificationInfo(new String[] {
+ MEMORY_LOG_MAX_CAPACITY},
+ Notification.class.getName(),
+ "Emitted when the memory log capacity is reached")
+ ,
+ new MBeanNotificationInfo(new String[] {
+ MEMORY_LOG_CLEARED},
+ Notification.class.getName(),
+ "Emitted when the memory log is cleared")
+ };
+ }
+
+ // Return the name of the log file, or null if logging to file is
+ // disabled.
+ private String getLogFileName(boolean absolute) {
+ synchronized (this) {
+ if (logFile == null) return null;
+ if (absolute) return logFile.getAbsolutePath();
+ return logFile.getPath();
+ }
+ }
+
+ // This method is be called by the ScanManagerMXBean when a configuration
+ // is applied.
+ //
+ void setConfig(ResultLogConfig logConfigBean) throws IOException {
+ if (logConfigBean == null)
+ throw new IllegalArgumentException("logConfigBean is null");
+ synchronized (this) {
+ config = logConfigBean;
+ setMemoryLogCapacity(config.getMemoryMaxRecords());
+ }
+ final String filename = config.getLogFileName();
+ final String logname = getLogFileName(false);
+ if ((filename != null && !filename.equals(logname))
+ || (filename == null && logname != null)) {
+ newLogFile(config.getLogFileName(),
+ config.getLogFileMaxRecords());
+ } else {
+ setLogFileCapacity(config.getLogFileMaxRecords());
+ }
+ }
+
+ // This method is called by the ScanManagerMXBean when
+ // applyCurrentResultLogConfig() is called.
+ //
+ ResultLogConfig getConfig() {
+ return config;
+ }
+
+
+ // Set by preRegister().
+ private MBeanServer mbeanServer;
+ private ObjectName objectName;
+
+
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java
new file mode 100644
index 0000000..eb1f0f6
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import java.io.IOException;
+import javax.management.InstanceNotFoundException;
+
+/**
+ * The <code>ResultLogManagerMXBean</code> is in charge of managing result logs.
+ * {@link DirectoryScanner DirectoryScanners} can be configured to log a
+ * {@link ResultRecord} whenever they take action upon a file that
+ * matches their set of matching criteria.
+ * The <code>ResultLogManagerMXBean</code> is responsible for storing these
+ * results in its result logs.
+ * <p>The <code>ResultLogManagerMXBean</code>
+ * will let you interactively clear these result logs, change their
+ * capacity, and decide where (memory or file or both) the
+ * {@link ResultRecord ResultRecords} should be stored.
+ * <p>The memory log is useful in so far that its content can be interactively
+ * returned by the <code>ResultLogManagerMXBean</code>.
+ * The file log doesn't have this facility.
+ * <p>The result logs are intended to be used by e.g. an offline program that
+ * would take some actions on the files that were matched by the scanners
+ * criteria:
+ * <p>The <i>scandir</i> application could be configured to only produce logs
+ * (i.e. takes no action but logging the matching files), and the real
+ * action (e.g. mail the result log to the engineer which maintains the lab,
+ * or parse the log and prepare and send a single mail to the matching
+ * files owners, containing the list of file he/she should consider deleting)
+ * could be performed by such another program/module.
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public interface ResultLogManagerMXBean {
+
+ /**
+ * Creates a new log file in which to store results.
+ * <p>When this method is called, the {@link ResultLogManager} will stop
+ * logging in its current log file and use the new specified file instead.
+ * If that file already exists, it will be renamed by appending a '~' to
+ * its name, and a new empty file with the name specified by
+ * <var>basename</var> will be created.
+ * </p>
+ * <p>Calling this method has no side effect on the {@link
+ * com.sun.jmx.examples.scandir.config.ScanManagerConfig#getInitialResultLogConfig
+ * InitialResultLogConfig} held in the {@link ScanDirConfigMXBean}
+ * configuration. To apply these new values to the
+ * {@link ScanDirConfigMXBean}
+ * configuration, you must call {@link
+ * ScanManagerMXBean#applyCurrentResultLogConfig
+ * ScanManagerMXBean.applyCurrentResultLogConfig}.
+ *<p>
+ * @param basename The name of the new log file. This will be the
+ * new name returned by {@link #getLogFileName}.
+ * @param maxRecord maximum number of records to log in the specified file
+ * before creating a new file. <var>maxRecord</var> will be the
+ * new value returned by {@link #getLogFileCapacity}.
+ * When that maximum number of
+ * records is reached the {@link ResultLogManager} will rename
+ * the file by appending a '~' to its name, and a new empty
+ * log file will be created.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void newLogFile(String basename, long maxRecord)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Logs a result record to the active result logs (memory,file,both,or none)
+ * depending on how this MBean is currently configured.
+ * @see #getLogFileName()
+ * @see #getMemoryLogCapacity()
+ * @param record The result record to log.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void log(ResultRecord record)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the name of the current result log file.
+ * <p><code>null</code> means that no log file is configured: logging
+ * to file is disabled.
+ * </p>
+ * @return The name of the current result log file, or <code>null</code>
+ * if logging to file is disabled.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getLogFileName()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the whole content of the memory log. This cannot exceed
+ * {@link #getMemoryLogCapacity} records.
+ *
+ * @return the whole content of the memory log.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ResultRecord[] getMemoryLog()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the maximum number of records that can be logged in the
+ * memory log.
+ * <p>
+ * A non positive value - <code>0</code> or negative - means that
+ * logging in memory is disabled.
+ * </p>
+ * <p>The memory log is a FIFO: when its maximum capacity is reached, its
+ * head element is removed to make place for a new element at its tail.
+ * </p>
+ * @return The maximum number of records that can be logged in the
+ * memory log. A value {@code <= 0} means that logging in memory is
+ * disabled.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public int getMemoryLogCapacity()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Sets the maximum number of records that can be logged in the
+ * memory log.
+ * <p>The memory log is a FIFO: when its maximum capacity is reached, its
+ * head element is removed to make place for a new element at its tail.
+ * </p>
+ * @param size The maximum number of result records that can be logged in the memory log. <p>
+ * A non positive value - <code>0</code> or negative - means that
+ * logging in memory is disabled. It will also have the side
+ * effect of clearing the memory log.
+ * </p>
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void setMemoryLogCapacity(int size)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Sets the maximum number of records that can be logged in the result log
+ * file.
+ * <p>When that maximum number of
+ * records is reached the {@link ResultLogManager} will rename
+ * the result log file by appending a '~' to its name, and a new empty
+ * log file will be created.
+ * </p>
+ * <p>If logging to file is disabled calling this method
+ * is irrelevant.
+ * </p>
+ * @param maxRecord maximum number of records to log in the result log file.
+ * @see #getLogFileName()
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void setLogFileCapacity(long maxRecord)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the maximum number of records that can be logged in the result log
+ * file.
+ * <p>When that maximum number of
+ * records is reached the {@link ResultLogManager} will rename
+ * the result log file by appending a '~' to its name, and a new empty
+ * log file will be created.
+ * </p>
+ * @see #getLogFileName()
+ * @return The maximum number of records that can be logged in the result
+ * log file.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public long getLogFileCapacity()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets The number of records that have been logged in the
+ * current result log file. This will always be less than
+ * {@link #getLogFileCapacity()}.
+ * @return The number of records in the
+ * current result log file.
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public long getLoggedCount()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Clears the memory log and result log file.
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void clearLogs()
+ throws IOException, InstanceNotFoundException;
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java
new file mode 100644
index 0000000..f4bf1b6
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
+import javax.management.JMException;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationListener;
+
+/**
+ * <p>
+ * The <code>ScanDirAgent</code> is the Agent class for the <i>scandir</i>
+ * application.
+ * This class contains the {@link #main} method to start a standalone
+ * <i>scandir</i> application.
+ * </p>
+ * <p>
+ * The {@link #main main()} method simply registers a {@link
+ * ScanManagerMXBean} in the platform MBeanServer - see {@link #init init},
+ * and then waits for someone to call {@link ScanManagerMXBean#close close}
+ * on that MBean.
+ * </p>
+ * <p>
+ * When the {@link ScanManagerMXBean} state is switched to {@link
+ * ScanManagerMXBean.ScanState#CLOSED CLOSED}, {@link #cleanup cleanup} is
+ * called, the {@link ScanManagerMXBean} is unregistered, and the application
+ * terminates (i.e. the main thread completes).
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+public class ScanDirAgent {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ScanDirAgent.class.getName());
+
+ // Proxy to the ScanManagerMXBean - created by init();
+ //
+ private volatile ScanManagerMXBean proxy = null;
+
+ // A queue to put received Notifications.
+ //
+ private final BlockingQueue<Notification> queue;
+
+ // A listener that will put notifications into the queue.
+ //
+ private final NotificationListener listener;
+
+ /**
+ * Creates a new instance of ScanDirAgent
+ * You will need to call {@link #init()} later on in order to initialize
+ * the application.
+ * @see #main
+ **/
+ public ScanDirAgent() {
+ // Initialize the notification queue
+ queue = new LinkedBlockingQueue<Notification>();
+
+ // Creates the listener.
+ listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ // Just put the received notification in the queue.
+ // It will be consumed later on by 'waitForClose()'
+ //
+ LOG.finer("Queuing received notification "+notification);
+ queue.put(notification);
+ } catch (InterruptedException ex) {
+ // OK
+ }
+ }
+ };
+ }
+
+ /**
+ * Initialize the application by registering a ScanManagerMXBean in
+ * the platform MBeanServer
+ * @throws java.io.IOException Registration failed for communication-related reasons.
+ * @throws javax.management.JMException Registration failed for JMX-related reasons.
+ */
+ public void init() throws IOException, JMException {
+
+ // Registers the ScanManagerMXBean singleton in the
+ // platform MBeanServer
+ //
+ proxy = ScanManager.register();
+
+ // Registers a NotificationListener with the ScanManagerMXBean in
+ // order to receive state changed notifications.
+ //
+ ((NotificationEmitter)proxy).addNotificationListener(listener,null,null);
+ }
+
+ /**
+ * Cleanup after close: unregister the ScanManagerMXBean singleton.
+ * @throws java.io.IOException Cleanup failed for communication-related reasons.
+ * @throws javax.management.JMException Cleanup failed for JMX-related reasons.
+ */
+ public void cleanup() throws IOException, JMException {
+ try {
+ ((NotificationEmitter)proxy).
+ removeNotificationListener(listener,null,null);
+ } finally {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ }
+ }
+
+ /**
+ * Wait for someone to call 'close()' on the ScanManagerMXBean singleton.
+ * Every time its state changes, the ScanManagerMXBean emits a notification.
+ * We don't rely on the notification content (if we were using a remote
+ * connection, we could miss some notifications) - we simply use the
+ * state change notifications to react more quickly to state changes.
+ * We do so simply by polling the {@link BlockingQueue} in which our
+ * listener is pushing notifications, and checking the ScanManagerMXBean
+ * state every time that a notification is received.
+ * <p>
+ * We can do so because we know that once the ScanManagerMXBean state is
+ * switched to 'CLOSED', it will remain 'CLOSED' whatsoever. <br>
+ * Therefore we don't need to concern ourselves with the possibility of
+ * missing the window in which the ScanManagerMXBean state's will be
+ * CLOSED, because that particular window stays opened forever.
+ * <p>
+ * Had we wanted to wait for 'RUNNING', we would have needed to apply
+ * a different strategy - e.g. by taking into account the actual content
+ * of the state changed notifications we received.
+ * @throws java.io.IOException wait failed - a communication problem occurred.
+ * @throws javax.management.JMException wait failed - the MBeanServer threw an exception.
+ */
+ public void waitForClose() throws IOException, JMException {
+
+ // Wait until state is closed
+ while(proxy.getState() != ScanState.CLOSED ) {
+ try {
+ // Wake up at least every 30 seconds - if we missed a
+ // notification - we will at least get a chance to
+ // call getState(). 30 seconds is obviously quite
+ // arbitrary - if this were a real daemon - id'be tempted
+ // to wait 30 minutes - knowing that any incoming
+ // notification will wake me up anyway.
+ // Note: we simply use the state change notifications to
+ // react more quickly to state changes: see javadoc above.
+ //
+ queue.poll(30,TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ // OK
+ }
+ }
+ }
+
+ /**
+ * The agent's main: {@link #init registers} a {@link ScanManagerMXBean},
+ * {@link #waitForClose waits} until its state is {@link
+ * ScanManagerMXBean.ScanState#CLOSED CLOSED}, {@link #cleanup cleanup}
+ * and exits.
+ * @param args the command line arguments - ignored
+ * @throws java.io.IOException A communication problem occurred.
+ * @throws javax.management.JMException A JMX problem occurred.
+ */
+ public static void main(String[] args)
+ throws IOException, JMException {
+ System.out.println("Initializing ScanManager...");
+ final ScanDirAgent agent = new ScanDirAgent();
+ agent.init();
+ try {
+ System.out.println("Waiting for ScanManager to close...");
+ agent.waitForClose();
+ } finally {
+ System.out.println("Cleaning up...");
+ agent.cleanup();
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java
new file mode 100644
index 0000000..442a607
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.rmi.ssl.SslRMIClientSocketFactory;
+
+/**
+ * The ScanDirClient class is a very simple programmatic client example
+ * which is able to connect to a secured JMX <i>scandir</i> application.
+ * <p>The program initialize the connection environment map with the
+ * appropriate properties and credentials, and then connects to the
+ * secure JMX <i>scandir</i> daemon.</p>
+ * <p>It gets the application's current configuration and prints it on
+ * its <code>System.out</code>.</p>
+ * <p>The {@link #main main} method takes two arguments: the host on which
+ * the server is running (localhost), and the port number
+ * that was configured to start the server RMI Connector (4545).
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+public class ScanDirClient {
+
+ // This class has only a main.
+ private ScanDirClient() { }
+
+ /**
+ * The usage string for the ScanDirClient.
+ */
+ public static final String USAGE = ScanDirClient.class.getSimpleName() +
+ " <server-host> <rmi-port-number>";
+
+ /**
+ * Connects to a secured JMX <i>scandir</i> application.
+ * @param args The {@code main} method takes two parameters:
+ * <ul>
+ * <li>args[0] must be the server's host</li>
+ * <li>args[1] must be the rmi port number at which the
+ * JMX <i>scandir</i> daemon is listening for connections
+ * - that is, the port number of its JMX RMI Connector which
+ * was configured in {@code management.properties}
+ * </li>
+ * <ul>
+ **/
+ public static void main(String[] args) {
+ try {
+ // Check args
+ //
+ if (args==null || args.length!=2) {
+ System.err.println("Bad number of arguments: usage is: \n\t" +
+ USAGE);
+ System.exit(1);
+ }
+ try {
+ InetAddress.getByName(args[0]);
+ } catch (UnknownHostException x) {
+ System.err.println("No such host: " + args[0]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ } catch (Exception x) {
+ System.err.println("Bad address: " + args[0]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ }
+ try {
+ if (Integer.parseInt(args[1]) <= 0) {
+ System.err.println("Bad port value: " + args[1]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ }
+ } catch (Exception x) {
+ System.err.println("Bad argument: " + args[1]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ }
+
+ // Create an environment map to hold connection properties
+ // like credentials etc... We will later pass this map
+ // to the JMX Connector.
+ //
+ System.out.println("\nInitialize the environment map");
+ final Map<String,Object> env = new HashMap<String,Object>();
+
+ // Provide the credentials required by the server
+ // to successfully perform user authentication
+ //
+ final String[] credentials = new String[] { "guest" , "guestpasswd" };
+ env.put("jmx.remote.credentials", credentials);
+
+ // Provide the SSL/TLS-based RMI Client Socket Factory required
+ // by the JNDI/RMI Registry Service Provider to communicate with
+ // the SSL/TLS-protected RMI Registry
+ //
+ env.put("com.sun.jndi.rmi.factory.socket",
+ new SslRMIClientSocketFactory());
+
+ // Create the RMI connector client and
+ // connect it to the RMI connector server
+ // args[0] is the server's host - localhost
+ // args[1] is the secure server port - 4545
+ //
+ System.out.println("\nCreate the RMI connector client and " +
+ "connect it to the RMI connector server");
+ final JMXServiceURL url = new JMXServiceURL(
+ "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1] +
+ "/jmxrmi");
+
+ System.out.println("Connecting to: "+url);
+ final JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
+
+ // Get an MBeanServerConnection
+ //
+ System.out.println("\nGet the MBeanServerConnection");
+ final MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
+
+ // Create a proxy for the ScanManager MXBean
+ //
+ final ScanManagerMXBean proxy =
+ ScanManager.newSingletonProxy(mbsc);
+
+ // Get the ScanDirConfig MXBean from the scan manager
+ //
+ System.out.println(
+ "\nGet ScanDirConfigMXBean from ScanManagerMXBean");
+ final ScanDirConfigMXBean configMBean =
+ proxy.getConfigurationMBean();
+
+ // Print the scan dir configuration
+ //
+ System.out.println(
+ "\nGet 'Configuration' attribute on ScanDirConfigMXBean");
+ System.out.println("\nConfiguration:\n" +
+ configMBean.getConfiguration());
+
+ // Try to invoke the "close" method on the ScanManager MXBean.
+ //
+ // Should get a SecurityException as the user "guest" doesn't
+ // have readwrite access.
+ //
+ System.out.println("\nInvoke 'close' on ScanManagerMXBean");
+ try {
+ proxy.close();
+ } catch (SecurityException e) {
+ System.out.println("\nGot expected security exception: " + e);
+ }
+
+ // Close MBeanServer connection
+ //
+ System.out.println("\nClose the connection to the server");
+ jmxc.close();
+ System.out.println("\nBye! Bye!");
+ } catch (Exception e) {
+ System.out.println("\nGot unexpected exception: " + e);
+ e.printStackTrace();
+ System.exit(3);
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java
new file mode 100644
index 0000000..7ecd8a1
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManager.getNextSeqNumber;
+import static com.sun.jmx.examples.scandir.ScanDirConfigMXBean.SaveState.*;
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.FileMatch;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.management.*;
+import javax.xml.bind.JAXBException;
+
+/**
+ * <p>The <code>ScanDirConfig</code> MBean is in charge of the
+ * <i>scandir</i> application configuration.
+ * </p>
+ * <p>The <code>ScanDirConfig</code> MBean is able to
+ * load and save the <i>scandir</i> application configuration to and from an
+ * XML file.
+ * </p>
+ * <p>
+ * It will let you also interactively modify that configuration, which you
+ * can later save to the file, by calling {@link #save}, or discard, by
+ * reloading the file without saving - see {@link #load}.
+ * </p>
+ * <p>
+ * There can be as many <code>ScanDirConfigMXBean</code> registered
+ * in the MBeanServer as you like, but only one of them will be identified as
+ * the current configuration of the {@link ScanManagerMXBean}.
+ * You can switch to another configuration by calling {@link
+ * ScanManagerMXBean#setConfigurationMBean
+ * ScanManagerMXBean.setConfigurationMBean}.
+ * </p>
+ * <p>
+ * Once the current configuration has been loaded (by calling {@link #load})
+ * or modified (by calling one of {@link #addDirectoryScanner
+ * addDirectoryScanner}, {@link #removeDirectoryScanner removeDirectoryScanner}
+ * or {@link #setConfiguration setConfiguration}) it can be pushed
+ * to the {@link ScanManagerMXBean} by calling {@link
+ * ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration(true)} -
+ * <code>true</code> means that we apply the configuration from memory,
+ * without first reloading the file.
+ * </p>
+ * <p>
+ * The <code>ScanDirConfig</code> uses the XML annotated Java Beans defined
+ * in the {@link com.sun.jmx.examples.scandir.config} package.
+ * </p>
+ * <p>
+ * <u>Note:</u> The <code>ScanDirConfig</code> should probably use
+ * {@code java.nio.channels.FileLock} and lock its configuration file so that
+ * two <code>ScanDirConfig</code> object do not share the same file, but it
+ * doesn't. Feel free to improve the application in that way.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanDirConfig extends NotificationBroadcasterSupport
+ implements ScanDirConfigMXBean, MBeanRegistration {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ScanDirConfig.class.getName());
+
+ // We will emit a notification when the save state of this object
+ // chenges. We use directly the base notification class, with a
+ // notification type that indicates the new state at which the
+ // object has arrived.
+ //
+ // All these notification types will have the same prefix, which is
+ // 'com.sun.jmx.examples.scandir.config'.
+ //
+ private final static String NOTIFICATION_PREFIX =
+ ScanManagerConfig.class.getPackage().getName();
+
+ /**
+ * The <i>com.sun.jmx.examples.scandir.config.saved</i> notification
+ * indicates that the configuration data was saved.
+ **/
+ public final static String NOTIFICATION_SAVED =
+ NOTIFICATION_PREFIX+".saved";
+ /**
+ * The <i>com.sun.jmx.examples.scandir.config.loaded</i> notification
+ * indicates that the configuration data was loaded.
+ **/
+ public final static String NOTIFICATION_LOADED =
+ NOTIFICATION_PREFIX+".loaded";
+
+ /**
+ * The <i>com.sun.jmx.examples.scandir.config.modified</i> notification
+ * indicates that the configuration data was modified.
+ **/
+ public final static String NOTIFICATION_MODIFIED =
+ NOTIFICATION_PREFIX+".modified";
+
+ // The array of MBeanNotificationInfo that will be exposed in the
+ // ScanDirConfigMXBean MBeanInfo.
+ // We will pass this array to the NotificationBroadcasterSupport
+ // constructor.
+ //
+ private static MBeanNotificationInfo[] NOTIFICATION_INFO = {
+ new MBeanNotificationInfo(
+ new String[] {NOTIFICATION_SAVED},
+ Notification.class.getName(),
+ "Emitted when the configuration is saved"),
+ new MBeanNotificationInfo(
+ new String[] {NOTIFICATION_LOADED},
+ Notification.class.getName(),
+ "Emitted when the configuration is loaded"),
+ new MBeanNotificationInfo(
+ new String[] {NOTIFICATION_MODIFIED},
+ Notification.class.getName(),
+ "Emitted when the configuration is modified"),
+ };
+
+ // The ScanDirConfigMXBean configuration data.
+ private volatile ScanManagerConfig config;
+
+ // The name of the configuration file
+ private String filename = null;
+
+ // The name of this configuration. This is usually both equal to
+ // config.getName() and objectName.getKeyProperty(name).
+ private volatile String configname = null;
+
+ // This object save state. CREATED is the initial state.
+ //
+ private volatile SaveState status = CREATED;
+
+ /**
+ * Creates a new {@link ScanDirConfigMXBean}.
+ * <p>{@code ScanDirConfigMXBean} can be created by the {@link
+ * ScanManagerMXBean}, or directly by a remote client, using
+ * {@code createMBean} or {@code registerMBean}.
+ * </p>
+ * <p>{@code ScanDirConfigMXBean} created by the {@link
+ * ScanManagerMXBean} will be unregistered by the
+ * {@code ScanManagerMXBean}. {@code ScanDirConfigMXBean} created
+ * directly by a remote client will not be unregistered by the
+ * {@code ScanManagerMXBean} - this will remain to the responsibility of
+ * the code/client that created them.
+ * </p>
+ * <p>This object is created empty, you should call load() if you want it
+ * to load its data from the configuration file.
+ * </p>
+ * @param filename The configuration file used by this MBean.
+ * Can be null (in which case load() and save() will fail).
+ * Can point to a file that does not exists yet (in which case
+ * load() will fail if called before save(), and save() will
+ * attempt to create that file). Can point to an existing file,
+ * in which case load() will load that file and save() will save
+ * to that file.
+ *
+ **/
+ public ScanDirConfig(String filename) {
+ this(filename,null);
+ }
+
+ /**
+ * Create a new ScanDirConfig MBean with an initial configuration.
+ * @param filename The name of the configuration file.
+ * @param initialConfig an initial configuration.
+ **/
+ public ScanDirConfig(String filename, ScanManagerConfig initialConfig) {
+ super(NOTIFICATION_INFO);
+ this.filename = filename;
+ this.config = initialConfig;
+ }
+
+
+ // see ScanDirConfigMXBean
+ public void load() throws IOException {
+ if (filename == null)
+ throw new UnsupportedOperationException("load");
+
+ synchronized(this) {
+ config = new XmlConfigUtils(filename).readFromFile();
+ if (configname != null) config = config.copy(configname);
+ else configname = config.getName();
+
+ status=LOADED;
+ }
+ sendNotification(NOTIFICATION_LOADED);
+ }
+
+ // see ScanDirConfigMXBean
+ public void save() throws IOException {
+ if (filename == null)
+ throw new UnsupportedOperationException("load");
+ synchronized (this) {
+ new XmlConfigUtils(filename).writeToFile(config);
+ status = SAVED;
+ }
+ sendNotification(NOTIFICATION_SAVED);
+ }
+
+ // see ScanDirConfigMXBean
+ public ScanManagerConfig getConfiguration() {
+ synchronized (this) {
+ return XmlConfigUtils.xmlClone(config);
+ }
+ }
+
+
+ // sends a notification indicating the new save state.
+ private void sendNotification(String type) {
+ final Object source = (objectName==null)?this:objectName;
+ final Notification n = new Notification(type,source,
+ getNextSeqNumber(),
+ "The configuration is "+
+ type.substring(type.lastIndexOf('.')+1));
+ sendNotification(n);
+ }
+
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * registered in the MBean server. If the name of the MBean is not
+ * specified, the MBean can provide a name for its registration. If
+ * any exception is raised, the MBean will not be registered in the
+ * MBean server.
+ * @param server The MBean server in which the MBean will be registered.
+ * @param name The object name of the MBean. This name is null if the
+ * name parameter to one of the createMBean or registerMBean methods in
+ * the MBeanServer interface is null. In that case, this method will
+ * try to guess its MBean name by examining its configuration data.
+ * If its configuration data is null (nothing was provided in the
+ * constructor) or doesn't contain a name, this method returns {@code null},
+ * and registration will fail.
+ * <p>
+ * Otherwise, if {@code name} wasn't {@code null} or if a default name could
+ * be constructed, the name of the configuration will be set to
+ * the value of the ObjectName's {@code name=} key, and the configuration
+ * data will always be renamed to reflect this change.
+ * </p>
+ *
+ * @return The name under which the MBean is to be registered.
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public ObjectName preRegister(MBeanServer server, ObjectName name)
+ throws Exception {
+ if (name == null) {
+ if (config == null) return null;
+ if (config.getName() == null) return null;
+ name = ScanManager.
+ makeMBeanName(ScanDirConfigMXBean.class,config.getName());
+ }
+ objectName = name;
+ mbeanServer = server;
+ synchronized (this) {
+ configname = name.getKeyProperty("name");
+ if (config == null) config = new ScanManagerConfig(configname);
+ else config = config.copy(configname);
+ }
+ return name;
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having
+ * been registered in the MBean server or after the registration has
+ * failed.
+ * <p>This implementation does nothing</p>
+ * @param registrationDone Indicates whether or not the MBean has been
+ * successfully registered in the MBean server. The value false means
+ * that the registration has failed.
+ */
+ public void postRegister(Boolean registrationDone) {
+ // Nothing to do here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * unregistered by the MBean server.
+ * <p>This implementation does nothing</p>
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public void preDeregister() throws Exception {
+ // Nothing to do here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having been
+ * unregistered in the MBean server.
+ * <p>This implementation does nothing</p>
+ */
+ public void postDeregister() {
+ // Nothing to do here.
+ }
+
+ // see ScanDirConfigMXBean
+ public String getConfigFilename() {
+ return filename;
+ }
+
+ // see ScanDirConfigMXBean
+ public void setConfiguration(ScanManagerConfig config) {
+ synchronized (this) {
+ if (config == null) {
+ this.config = null;
+ return;
+ }
+
+ if (configname == null)
+ configname = config.getName();
+
+ this.config = config.copy(configname);
+ status = MODIFIED;
+ }
+ sendNotification(NOTIFICATION_MODIFIED);
+ }
+
+ // see ScanDirConfigMXBean
+ public DirectoryScannerConfig
+ addDirectoryScanner(String name, String dir, String filePattern,
+ long sizeExceedsMaxBytes, long sinceLastModified) {
+ final DirectoryScannerConfig scanner =
+ new DirectoryScannerConfig(name);
+ scanner.setRootDirectory(dir);
+ if (filePattern!=null||sizeExceedsMaxBytes>0||sinceLastModified>0) {
+ final FileMatch filter = new FileMatch();
+ filter.setFilePattern(filePattern);
+ filter.setSizeExceedsMaxBytes(sizeExceedsMaxBytes);
+ if (sinceLastModified > 0)
+ filter.setLastModifiedBefore(new Date(new Date().getTime()
+ -sinceLastModified));
+ scanner.addIncludeFiles(filter);
+ }
+ synchronized (this) {
+ config.putScan(scanner);
+ status = MODIFIED;
+ }
+ LOG.fine("config: "+config);
+ sendNotification(NOTIFICATION_MODIFIED);
+ return scanner;
+ }
+
+ // see ScanDirConfigMXBean
+ public DirectoryScannerConfig removeDirectoryScanner(String name)
+ throws IOException, InstanceNotFoundException {
+ final DirectoryScannerConfig scanner;
+ synchronized (this) {
+ scanner = config.removeScan(name);
+ if (scanner == null)
+ throw new IllegalArgumentException(name+": scanner not found");
+ status = MODIFIED;
+ }
+ sendNotification(NOTIFICATION_MODIFIED);
+ return scanner;
+ }
+
+ // see ScanDirConfigMXBean
+ public SaveState getSaveState() {
+ return status;
+ }
+
+ // These methods are used by ScanManager to guess a configuration name from
+ // a configuration filename.
+ //
+ static String DEFAULT = "DEFAULT";
+
+ private static String getBasename(String name) {
+ final int dot = name.indexOf('.');
+ if (dot<0) return name;
+ if (dot==0) return getBasename(name.substring(1));
+ return name.substring(0,dot);
+ }
+
+ static String guessConfigName(String configFileName,String defaultFile) {
+ try {
+ if (configFileName == null) return DEFAULT;
+ final File f = new File(configFileName);
+ if (f.canRead()) {
+ final String confname = XmlConfigUtils.read(f).getName();
+ if (confname != null && confname.length()>0) return confname;
+ }
+ final File f2 = new File(defaultFile);
+ if (f.equals(f2)) return DEFAULT;
+ final String guess = getBasename(f.getName());
+ if (guess == null) return DEFAULT;
+ if (guess.length()==0) return DEFAULT;
+ return guess;
+ } catch (Exception x) {
+ return DEFAULT;
+ }
+ }
+
+ // Set by preRegister()
+ private volatile MBeanServer mbeanServer;
+ private volatile ObjectName objectName;
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java
new file mode 100644
index 0000000..eb4f375
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.IOException;
+import javax.management.InstanceNotFoundException;
+
+/**
+ * <p>The <code>ScanDirConfigMXBean</code> is in charge of the
+ * <i>scandir</i> application configuration.
+ * </p>
+ * <p>The <code>ScanDirConfigMXBean</code> is an MBean which is able to
+ * load and save the <i>scandir</i> application configuration to and from an
+ * XML file.
+ * </p>
+ * <p>
+ * It will let you also interactively modify that configuration, which you
+ * can later save to the file, by calling {@link #save}, or discard, by
+ * reloading the file without saving - see {@link #load}.
+ * </p>
+ * <p>
+ * There can be as many <code>ScanDirConfigMXBean</code> registered
+ * in the MBeanServer as you like, but only one of them will be identified as
+ * the current configuration of the {@link ScanManagerMXBean}.
+ * You can switch to another configuration by calling {@link
+ * ScanManagerMXBean#setConfigurationMBean
+ * ScanManagerMXBean.setConfigurationMBean}.
+ * </p>
+ * <p>
+ * Once the current configuration has been loaded (by calling {@link #load})
+ * or modified (by calling one of {@link #addDirectoryScanner
+ * addDirectoryScanner}, {@link #removeDirectoryScanner removeDirectoryScanner}
+ * or {@link #setConfiguration setConfiguration}) it can be pushed
+ * to the {@link ScanManagerMXBean} by calling {@link
+ * ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration(true)} -
+ * <code>true</code> means that we apply the configuration from memory,
+ * without first reloading the file.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public interface ScanDirConfigMXBean {
+ /**
+ * This state tells whether the configuration reflected by the
+ * {@link ScanDirConfigMXBean} was loaded in memory, saved to the
+ * configuration file, or modified since last saved.
+ * Note that this state doesn't tell whether the configuration was
+ * applied by the {@link ScanManagerMXBean}.
+ **/
+ public enum SaveState {
+ /**
+ * Initial state: the {@link ScanDirConfigMXBean} is created, but
+ * neither {@link #load} or {@link #save} was yet called.
+ **/
+ CREATED,
+
+ /**
+ * The configuration reflected by the {@link ScanDirConfigMXBean} has
+ * been loaded, but not modified yet.
+ **/
+ LOADED,
+
+ /**
+ * The configuration was modified. The modifications are held in memory.
+ * Call {@link #save} to save them to the file, or {@link #load} to
+ * reload the file and discard them.
+ **/
+ MODIFIED,
+
+ /**
+ * The configuration was saved.
+ **/
+ SAVED
+ };
+
+ /**
+ * Loads the configuration from the {@link
+ * #getConfigFilename configuration file}.
+ * <p>Any unsaved modification will be lost. The {@link #getSaveState state}
+ * is switched to {@link SaveState#LOADED LOADED}.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @see #getSaveState()
+ * @throws IOException The configuration couldn't be loaded from the file,
+ * e.g. because the file doesn't exist or isn't
+ * readable.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void load()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Saves the configuration to the {@link
+ * #getConfigFilename configuration file}.
+ *
+ * <p>If the configuration file doesn't exists, this method will
+ * attempt to create it. Otherwise, the existing file will
+ * be renamed by appending a '~' to its name, and a new file
+ * will be created, in which the configuration will be saved.
+ * The {@link #getSaveState state}
+ * is switched to {@link SaveState#SAVED SAVED}.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean}.
+ * </p>
+ * @see #getSaveState()
+ *
+ * @throws IOException The configuration couldn't be saved to the file,
+ * e.g. because the file couldn't be created.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void save()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the name of the configuration file.
+ * <p>If the configuration file doesn't exists, {@link #load} will fail
+ * and {@link #save} will attempt to create the file.
+ * </p>
+ *
+ * @return The configuration file name for this MBean.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getConfigFilename()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the current configuration data.
+ * <p>
+ * This method returns the configuration data which is currently held
+ * in memory.
+ * </p>
+ * <p>Call {@link #load} to reload the data from the configuration
+ * file, and {@link #save} to save the data to the configuration
+ * file.
+ * </p>
+ * @see #getSaveState()
+ * @return The current configuration data in memory.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanManagerConfig getConfiguration()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Sets the current configuration data.
+ * <p>
+ * This method replaces the configuration data in memory.
+ * The {@link #getSaveState state} is switched to {@link
+ * SaveState#MODIFIED MODIFIED}.
+ * </p>
+ * <p>Calling {@link #load} will reload the data from the configuration
+ * file, and all modifications will be lost.
+ * Calling {@link #save} will save the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @param config The new configuration data.
+ * @see #getSaveState()
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void setConfiguration(ScanManagerConfig config)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Adds a new directory scanner to the current configuration data.
+ * <p>
+ * This method updates the configuration data in memory, adding
+ * a {@link DirectoryScannerConfig} to the {@link
+ * ScanManagerConfig#getScanList directory scanner list}.
+ * The {@link #getSaveState state} is switched to {@link
+ * SaveState#MODIFIED MODIFIED}.
+ * </p>
+ * <p>Calling {@link #load} will reload the data from the configuration
+ * file, and all modifications will be lost.
+ * Calling {@link #save} will save the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @param name A name for the new directory scanner. This is the value
+ * that will be later used in the {@link DirectoryScannerMXBean}
+ * ObjectName for the <code>name=</code> key.
+ * @param dir The root directory at which this scanner will start scanning.
+ * @param filePattern A {@link java.util.regex.Pattern regular expression}
+ * to match against a selected file name.
+ * @param sizeExceedsMaxBytes Only file whose size exceeds that limit will
+ * be selected. <code.0</code> or a
+ * negative value means no limit.
+ * @param sinceLastModified Select files which haven't been modified for
+ * that number of milliseconds - i.e.
+ * {@code sinceLastModified=3600000} will exclude files which
+ * have been modified in the last hour.
+ * The date of last modification is ignored if <code>0</code> or a
+ * negative value is provided.
+ * @see #getSaveState()
+ * @return The added <code>DirectoryScannerConfig</code>.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public DirectoryScannerConfig
+ addDirectoryScanner(String name, String dir, String filePattern,
+ long sizeExceedsMaxBytes, long sinceLastModified)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Removes a directory scanner from the current configuration data.
+ * <p>
+ * This method updates the configuration data in memory, removing
+ * a {@link DirectoryScannerConfig} from the {@link
+ * ScanManagerConfig#getScanList directory scanner list}.
+ * The {@link #getSaveState state} is switched to {@link
+ * SaveState#MODIFIED MODIFIED}.
+ * </p>
+ * <p>Calling {@link #load} will reload the data from the configuration
+ * file, and all modifications will be lost.
+ * Calling {@link #save} will save the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @param name The name of the new directory scanner. This is the value
+ * that is used in the {@link DirectoryScannerMXBean}
+ * ObjectName for the <code>name=</code> key.
+ * @return The removed <code>DirectoryScannerConfig</code>.
+ * @throws IllegalArgumentException if there's no directory scanner by
+ * that name in the current configuration data.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public DirectoryScannerConfig
+ removeDirectoryScanner(String name)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the save state of the current configuration data.
+ * <p>
+ * {@link SaveState#CREATED CREATED} means that the configuration data was just
+ * created. It has not been loaded from the configuration file.
+ * Calling {@link #load} will load the data from the configuration file.
+ * Calling {@link #save} will write the empty data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * {@link SaveState#LOADED LOADED} means that the configuration data
+ * was loaded from the configuration file.
+ * </p>
+ * <p>
+ * {@link SaveState#MODIFIED MODIFIED} means that the configuration data
+ * was modified since it was last loaded or saved.
+ * Calling {@link #load} will reload the data from the configuration file,
+ * and all modifications will be lost.
+ * Calling {@link #save} will write the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * {@link SaveState#SAVED SAVED} means that the configuration data
+ * was saved to the configuration file.
+ * </p>
+ * <p>
+ * This state doesn't indicate whether this MBean configuration data
+ * was {@link ScanManagerMXBean#applyConfiguration applied} by the
+ * {@link ScanManagerMXBean}.
+ * </p>
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ * @return The save state of the {@code ScanDirConfigMXBean}.
+ */
+ public SaveState getSaveState()
+ throws IOException, InstanceNotFoundException;
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java
new file mode 100644
index 0000000..e34b12a
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java
@@ -0,0 +1,1160 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.File;
+
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.management.AttributeChangeNotification;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMException;
+import javax.management.JMX;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+/**
+ * <p>
+ * The <code>ScanManager</code> is responsible for applying a configuration,
+ * starting and scheduling directory scans, and reporting application state.
+ * </p>
+ * <p>
+ * The ScanManager MBean is a singleton MBean which controls
+ * scan session. The ScanManager name is defined by
+ * {@link #SCAN_MANAGER_NAME ScanManager.SCAN_MANAGER_NAME}.
+ * </p>
+ * <p>
+ * The <code>ScanManager</code> MBean is the entry point of the <i>scandir</i>
+ * application management interface. It is from this MBean that all other MBeans
+ * will be created and registered.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanManager implements ScanManagerMXBean,
+ NotificationEmitter, MBeanRegistration {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ScanManager.class.getName());
+
+ /**
+ * The name of the ScanManager singleton MBean.
+ **/
+ public final static ObjectName SCAN_MANAGER_NAME =
+ makeSingletonName(ScanManagerMXBean.class);
+
+ /**
+ * Sequence number used for sending notifications. We use this
+ * sequence number throughout the application.
+ **/
+ private static long seqNumber=0;
+
+ /**
+ * The NotificationBroadcasterSupport object used to handle
+ * listener registration.
+ **/
+ private final NotificationBroadcasterSupport broadcaster;
+
+ /**
+ * The MBeanServer in which this MBean is registered. We obtain
+ * this reference by implementing the {@link MBeanRegistration}
+ * interface.
+ **/
+ private volatile MBeanServer mbeanServer;
+
+ /**
+ * A queue of pending notifications we are about to send.
+ * We're using a BlockingQueue in order to avoid sending
+ * notifications from within a synchronized block.
+ **/
+ private final BlockingQueue<Notification> pendingNotifs;
+
+ /**
+ * The state of the scan session.
+ **/
+ private volatile ScanState state = STOPPED;
+
+ /**
+ * The list of DirectoryScannerMBean that are run by a scan session.
+ **/
+ private final Map<ObjectName,DirectoryScannerMXBean> scanmap;
+
+ /**
+ * The list of ScanDirConfigMXBean that were created by this MBean.
+ **/
+ private final Map<ObjectName, ScanDirConfigMXBean> configmap;
+
+ // The ResultLogManager for this application.
+ private final ResultLogManager log;
+
+ /**
+ * We use a semaphore to ensure proper sequencing of exclusive
+ * action. The logic we have implemented is to fail - rather
+ * than block, if an exclusive action is already in progress.
+ **/
+ private final Semaphore sequencer = new Semaphore(1);
+
+ // A proxy to the current ScanDirConfigMXBean which holds the current
+ // configuration data.
+ //
+ private volatile ScanDirConfigMXBean config = null;
+
+ // Avoid to write parameters twices when creating a new ConcurrentHashMap.
+ //
+ private static <K, V> Map<K, V> newConcurrentHashMap() {
+ return new ConcurrentHashMap<K, V>();
+ }
+
+ // Avoid to write parameters twices when creating a new HashMap.
+ //
+ private static <K, V> Map<K, V> newHashMap() {
+ return new HashMap<K, V>();
+ }
+
+ /**
+ * Creates a default singleton ObjectName for a given class.
+ * @param clazz The interface class of the MBean for which we want to obtain
+ * a default singleton name, or its implementation class.
+ * Give one or the other depending on what you wish to see in
+ * the value of the key {@code type=}.
+ * @return A default singleton name for a singleton MBean class.
+ * @throws IllegalArgumentException if the name can't be created
+ * for some unfathomable reason (e.g. an unexpected
+ * exception was raised).
+ **/
+ public final static ObjectName makeSingletonName(Class clazz) {
+ try {
+ final Package p = clazz.getPackage();
+ final String packageName = (p==null)?null:p.getName();
+ final String className = clazz.getSimpleName();
+ final String domain;
+ if (packageName == null || packageName.length()==0) {
+ // We use a reference to ScanDirAgent.class to ease
+ // to keep track of possible class renaming.
+ domain = ScanDirAgent.class.getSimpleName();
+ } else {
+ domain = packageName;
+ }
+ final ObjectName name = new ObjectName(domain,"type",className);
+ return name;
+ } catch (Exception x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException(String.valueOf(clazz),x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Creates a default ObjectName with keys <code>type=</code> and
+ * <code>name=</code> for an instance of a given MBean interface class.
+ * @param clazz The interface class of the MBean for which we want to obtain
+ * a default name, or its implementation class.
+ * Give one or the other depending on what you wish to see in
+ * the value of the key {@code type=}.
+ * @param name The value of the <code>name=</code> key.
+ * @return A default name for an instance of the given MBean interface class.
+ * @throws IllegalArgumentException if the name can't be created.
+ * (e.g. an unexpected exception was raised).
+ **/
+ public static final ObjectName makeMBeanName(Class clazz, String name) {
+ try {
+ return ObjectName.
+ getInstance(makeSingletonName(clazz)
+ .toString()+",name="+name);
+ } catch (MalformedObjectNameException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException(String.valueOf(name),x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Return the ObjectName for a DirectoryScannerMXBean of that name.
+ * This is {@code makeMBeanName(DirectoryScannerMXBean.class,name)}.
+ * @param name The value of the <code>name=</code> key.
+ * @return the ObjectName for a DirectoryScannerMXBean of that name.
+ */
+ public static final ObjectName makeDirectoryScannerName(String name) {
+ return makeMBeanName(DirectoryScannerMXBean.class,name);
+ }
+
+ /**
+ * Return the ObjectName for a {@code ScanDirConfigMXBean} of that name.
+ * This is {@code makeMBeanName(ScanDirConfigMXBean.class,name)}.
+ * @param name The value of the <code>name=</code> key.
+ * @return the ObjectName for a {@code ScanDirConfigMXBean} of that name.
+ */
+ public static final ObjectName makeScanDirConfigName(String name) {
+ return makeMBeanName(ScanDirConfigMXBean.class,name);
+ }
+
+ /**
+ * Create and register a new singleton instance of the ScanManager
+ * MBean in the given {@link MBeanServerConnection}.
+ * @param mbs The MBeanServer in which the new singleton instance
+ * should be created.
+ * @throws JMException The MBeanServer connection raised an exception
+ * while trying to instantiate and register the singleton MBean
+ * instance.
+ * @throws IOException There was a connection problem while trying to
+ * communicate with the underlying MBeanServer.
+ * @return A proxy for the registered MBean.
+ **/
+ public static ScanManagerMXBean register(MBeanServerConnection mbs)
+ throws IOException, JMException {
+ final ObjectInstance moi =
+ mbs.createMBean(ScanManager.class.getName(),SCAN_MANAGER_NAME);
+ final ScanManagerMXBean proxy =
+ JMX.newMXBeanProxy(mbs,moi.getObjectName(),
+ ScanManagerMXBean.class,true);
+ return proxy;
+ }
+
+ /**
+ * Creates a new {@code ScanManagerMXBean} proxy over the given
+ * {@code MBeanServerConnection}. Does not check whether a
+ * {@code ScanManagerMXBean}
+ * is actually registered in that {@code MBeanServerConnection}.
+ * @return a new {@code ScanManagerMXBean} proxy.
+ * @param mbs The {@code MBeanServerConnection} which holds the
+ * {@code ScanManagerMXBean} to proxy.
+ */
+ public static ScanManagerMXBean
+ newSingletonProxy(MBeanServerConnection mbs) {
+ final ScanManagerMXBean proxy =
+ JMX.newMXBeanProxy(mbs,SCAN_MANAGER_NAME,
+ ScanManagerMXBean.class,true);
+ return proxy;
+ }
+
+ /**
+ * Creates a new {@code ScanManagerMXBean} proxy over the platform
+ * {@code MBeanServer}. This is equivalent to
+ * {@code newSingletonProxy(ManagementFactory.getPlatformMBeanServer())}.
+ * @return a new {@code ScanManagerMXBean} proxy.
+ **/
+ public static ScanManagerMXBean newSingletonProxy() {
+ return newSingletonProxy(ManagementFactory.getPlatformMBeanServer());
+ }
+
+ /**
+ * Create and register a new singleton instance of the ScanManager
+ * MBean in the given {@link MBeanServerConnection}.
+ * @throws JMException The MBeanServer connection raised an exception
+ * while trying to instantiate and register the singleton MBean
+ * instance.
+ * @throws IOException There was a connection problem while trying to
+ * communicate with the underlying MBeanServer.
+ * @return A proxy for the registered MBean.
+ **/
+ public static ScanManagerMXBean register()
+ throws IOException, JMException {
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ return register(mbs);
+ }
+
+ /**
+ * Create a new ScanManager MBean
+ **/
+ public ScanManager() {
+ broadcaster = new NotificationBroadcasterSupport();
+ pendingNotifs = new LinkedBlockingQueue<Notification>(100);
+ scanmap = newConcurrentHashMap();
+ configmap = newConcurrentHashMap();
+ log = new ResultLogManager();
+ }
+
+
+ // Creates a new DirectoryScannerMXBean, from the given configuration data.
+ DirectoryScannerMXBean createDirectoryScanner(DirectoryScannerConfig config) {
+ return new DirectoryScanner(config,log);
+ }
+
+ // Applies a configuration.
+ // throws IllegalStateException if lock can't be acquired.
+ // Unregisters all existing directory scanners, the create and registers
+ // new directory scanners according to the given config.
+ // Then pushes the log config to the result log manager.
+ //
+ private void applyConfiguration(ScanManagerConfig bean)
+ throws IOException, JMException {
+ if (bean == null) return;
+ if (!sequencer.tryAcquire()) {
+ throw new IllegalStateException("Can't acquire lock");
+ }
+ try {
+ unregisterScanners();
+ final DirectoryScannerConfig[] scans = bean.getScanList();
+ if (scans == null) return;
+ for (DirectoryScannerConfig scan : scans) {
+ addDirectoryScanner(scan);
+ }
+ log.setConfig(bean.getInitialResultLogConfig());
+ } finally {
+ sequencer.release();
+ }
+ }
+
+ // See ScanManagerMXBean
+ public void applyConfiguration(boolean fromMemory)
+ throws IOException, JMException {
+ if (fromMemory == false) config.load();
+ applyConfiguration(config.getConfiguration());
+ }
+
+ // See ScanManagerMXBean
+ public void applyCurrentResultLogConfig(boolean toMemory)
+ throws IOException, JMException {
+ final ScanManagerConfig bean = config.getConfiguration();
+ bean.setInitialResultLogConfig(log.getConfig());
+ config.setConfiguration(bean);
+ if (toMemory==false) config.save();
+ }
+
+ // See ScanManagerMXBean
+ public void setConfigurationMBean(ScanDirConfigMXBean config) {
+ this.config = config;
+ }
+
+ // See ScanManagerMXBean
+ public ScanDirConfigMXBean getConfigurationMBean() {
+ return config;
+ }
+
+ // Creates and registers a new directory scanner.
+ // Called by applyConfiguration.
+ // throws IllegalStateException if state is not STOPPED or COMPLETED
+ // (you cannot change the config while scanning is scheduled or running).
+ //
+ private DirectoryScannerMXBean addDirectoryScanner(
+ DirectoryScannerConfig bean)
+ throws JMException {
+ try {
+ final DirectoryScannerMXBean scanner;
+ final ObjectName scanName;
+ synchronized (this) {
+ if (state != STOPPED && state != COMPLETED)
+ throw new IllegalStateException(state.toString());
+ scanner = createDirectoryScanner(bean);
+ scanName = makeDirectoryScannerName(bean.getName());
+ }
+ LOG.fine("server: "+mbeanServer);
+ LOG.fine("scanner: "+scanner);
+ LOG.fine("scanName: "+scanName);
+ final ObjectInstance moi =
+ mbeanServer.registerMBean(scanner,scanName);
+ final ObjectName moiName = moi.getObjectName();
+ final DirectoryScannerMXBean proxy =
+ JMX.newMXBeanProxy(mbeanServer,moiName,
+ DirectoryScannerMXBean.class,true);
+ scanmap.put(moiName,proxy);
+ return proxy;
+ } catch (RuntimeException x) {
+ final String msg = "Operation failed: "+x;
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,msg,x);
+ else LOG.fine(msg);
+ throw x;
+ } catch (JMException x) {
+ final String msg = "Operation failed: "+x;
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,msg,x);
+ else LOG.fine(msg);
+ throw x;
+ }
+ }
+
+ // See ScanManagerMXBean
+ public ScanDirConfigMXBean createOtherConfigurationMBean(String name,
+ String filename)
+ throws JMException {
+ final ScanDirConfig profile = new ScanDirConfig(filename);
+ final ObjectName profName = makeScanDirConfigName(name);
+ final ObjectInstance moi = mbeanServer.registerMBean(profile,profName);
+ final ScanDirConfigMXBean proxy =
+ JMX.newMXBeanProxy(mbeanServer,profName,
+ ScanDirConfigMXBean.class,true);
+ configmap.put(moi.getObjectName(),proxy);
+ return proxy;
+ }
+
+
+ // See ScanManagerMXBean
+ public Map<String,DirectoryScannerMXBean> getDirectoryScanners() {
+ final Map<String,DirectoryScannerMXBean> proxyMap = newHashMap();
+ for (Entry<ObjectName,DirectoryScannerMXBean> item : scanmap.entrySet()){
+ proxyMap.put(item.getKey().getKeyProperty("name"),item.getValue());
+ }
+ return proxyMap;
+ }
+
+ // ---------------------------------------------------------------
+ // State Management
+ // ---------------------------------------------------------------
+
+ /**
+ * For each operation, this map stores a list of states from
+ * which the corresponding operation can be legally called.
+ * For instance, it is legal to call "stop" regardless of the
+ * application state. However, "schedule" can be called only if
+ * the application state is STOPPED, etc...
+ **/
+ private final static Map<String,EnumSet<ScanState>> allowedStates;
+ static {
+ allowedStates = newHashMap();
+ // You can always call stop
+ allowedStates.put("stop",EnumSet.allOf(ScanState.class));
+
+ // You can only call closed when stopped
+ allowedStates.put("close",EnumSet.of(STOPPED,COMPLETED,CLOSED));
+
+ // You can call schedule only when the current task is
+ // completed or stopped.
+ allowedStates.put("schedule",EnumSet.of(STOPPED,COMPLETED));
+
+ // switch reserved for background task: goes from SCHEDULED to
+ // RUNNING when it enters the run() method.
+ allowedStates.put("scan-running",EnumSet.of(SCHEDULED));
+
+ // switch reserved for background task: goes from RUNNING to
+ // SCHEDULED when it has completed but needs to reschedule
+ // itself for specified interval.
+ allowedStates.put("scan-scheduled",EnumSet.of(RUNNING));
+
+ // switch reserved for background task:
+ // goes from RUNNING to COMPLETED upon successful completion
+ allowedStates.put("scan-done",EnumSet.of(RUNNING));
+ }
+
+ // Get this object's state. No need to synchronize because
+ // state is volatile.
+ // See ScanManagerMXBean
+ public ScanState getState() {
+ return state;
+ }
+
+ /**
+ * Enqueue a state changed notification for the given states.
+ **/
+ private void queueStateChangedNotification(
+ long sequence,
+ long time,
+ ScanState old,
+ ScanState current) {
+ final AttributeChangeNotification n =
+ new AttributeChangeNotification(SCAN_MANAGER_NAME,sequence,time,
+ "ScanManager State changed to "+current,"State",
+ ScanState.class.getName(),old.toString(),current.toString());
+ // Queue the notification. We have created an unlimited queue, so
+ // this method should always succeed.
+ try {
+ if (!pendingNotifs.offer(n,2,TimeUnit.SECONDS)) {
+ LOG.fine("Can't queue Notification: "+n);
+ }
+ } catch (InterruptedException x) {
+ LOG.fine("Can't queue Notification: "+x);
+ }
+ }
+
+ /**
+ * Send all notifications present in the queue.
+ **/
+ private void sendQueuedNotifications() {
+ Notification n;
+ while ((n = pendingNotifs.poll()) != null) {
+ broadcaster.sendNotification(n);
+ }
+ }
+
+ /**
+ * Checks that the current state is allowed for the given operation,
+ * and if so, switch its value to the new desired state.
+ * This operation also enqueue the appropriate state changed
+ * notification.
+ **/
+ private ScanState switchState(ScanState desired,String forOperation) {
+ return switchState(desired,allowedStates.get(forOperation));
+ }
+
+ /**
+ * Checks that the current state is one of the allowed states,
+ * and if so, switch its value to the new desired state.
+ * This operation also enqueue the appropriate state changed
+ * notification.
+ **/
+ private ScanState switchState(ScanState desired,EnumSet<ScanState> allowed) {
+ final ScanState old;
+ final long timestamp;
+ final long sequence;
+ synchronized(this) {
+ old = state;
+ if (!allowed.contains(state))
+ throw new IllegalStateException(state.toString());
+ state = desired;
+ timestamp = System.currentTimeMillis();
+ sequence = getNextSeqNumber();
+ }
+ LOG.fine("switched state: "+old+" -> "+desired);
+ if (old != desired)
+ queueStateChangedNotification(sequence,timestamp,old,desired);
+ return old;
+ }
+
+
+ // ---------------------------------------------------------------
+ // schedule() creates a new SessionTask that will be executed later
+ // (possibly right away if delay=0) by a Timer thread.
+ // ---------------------------------------------------------------
+
+ // The timer used by this object. Lazzy evaluation. Cleaned in
+ // postDeregister()
+ //
+ private Timer timer = null;
+
+ // See ScanManagerMXBean
+ public void schedule(long delay, long interval) {
+ if (!sequencer.tryAcquire()) {
+ throw new IllegalStateException("Can't acquire lock");
+ }
+ try {
+ LOG.fine("scheduling new task: state="+state);
+ final ScanState old = switchState(SCHEDULED,"schedule");
+ final boolean scheduled =
+ scheduleSession(new SessionTask(interval),delay);
+ if (scheduled)
+ LOG.fine("new task scheduled: state="+state);
+ } finally {
+ sequencer.release();
+ }
+ sendQueuedNotifications();
+ }
+
+ // Schedule a SessionTask. The session task may reschedule
+ // a new identical task when it eventually ends.
+ // We use this logic so that the 'interval' time is measured
+ // starting at the end of the task that finishes, rather than
+ // at its beginning. Therefore if a repeated task takes x ms,
+ // it will be repeated every x+interval ms.
+ //
+ private synchronized boolean scheduleSession(SessionTask task, long delay) {
+ if (state == STOPPED) return false;
+ if (timer == null) timer = new Timer("ScanManager");
+ tasklist.add(task);
+ timer.schedule(task,delay);
+ return true;
+ }
+
+ // ---------------------------------------------------------------
+ // start() is equivalent to schedule(0,0)
+ // ---------------------------------------------------------------
+
+ // See ScanManagerMXBean
+ public void start() throws IOException, InstanceNotFoundException {
+ schedule(0,0);
+ }
+
+ // ---------------------------------------------------------------
+ // Methods used to implement stop() - stop() is asynchronous,
+ // and needs to notify any running background task that it needs
+ // to stop. It also needs to prevent scheduled task from being
+ // run.
+ // ---------------------------------------------------------------
+
+ // See ScanManagerMXBean
+ public void stop() {
+ if (!sequencer.tryAcquire())
+ throw new IllegalStateException("Can't acquire lock");
+ int errcount = 0;
+ final StringBuilder b = new StringBuilder();
+
+ try {
+ switchState(STOPPED,"stop");
+
+ errcount += cancelSessionTasks(b);
+ errcount += stopDirectoryScanners(b);
+ } finally {
+ sequencer.release();
+ }
+
+ sendQueuedNotifications();
+ if (errcount > 0) {
+ b.insert(0,"stop partially failed with "+errcount+" error(s):");
+ throw new RuntimeException(b.toString());
+ }
+ }
+
+ // See ScanManagerMXBean
+ public void close() {
+ switchState(CLOSED,"close");
+ sendQueuedNotifications();
+ }
+
+ // Appends exception to a StringBuilder message.
+ //
+ private void append(StringBuilder b,String prefix,Throwable t) {
+ final String first = (prefix==null)?"\n":"\n"+prefix;
+ b.append(first).append(String.valueOf(t));
+ Throwable cause = t;
+ while ((cause = cause.getCause())!=null) {
+ b.append(first).append("Caused by:").append(first);
+ b.append('\t').append(String.valueOf(cause));
+ }
+ }
+
+ // Cancels all scheduled session tasks
+ //
+ private int cancelSessionTasks(StringBuilder b) {
+ int errcount = 0;
+ // Stops scheduled tasks if any...
+ //
+ for (SessionTask task : tasklist) {
+ try {
+ task.cancel();
+ tasklist.remove(task);
+ } catch (Exception ex) {
+ errcount++;
+ append(b,"\t",ex);
+ }
+ }
+ return errcount;
+ }
+
+ // Stops all DirectoryScanners configured for this object.
+ //
+ private int stopDirectoryScanners(StringBuilder b) {
+ int errcount = 0;
+ // Stops directory scanners if any...
+ //
+ for (DirectoryScannerMXBean s : scanmap.values()) {
+ try {
+ s.stop();
+ } catch (Exception ex) {
+ errcount++;
+ append(b,"\t",ex);
+ }
+ }
+ return errcount;
+ }
+
+
+ // ---------------------------------------------------------------
+ // We start scanning in background in a Timer thread.
+ // The methods below implement that logic.
+ // ---------------------------------------------------------------
+
+ private void scanAllDirectories()
+ throws IOException, InstanceNotFoundException {
+
+ int errcount = 0;
+ final StringBuilder b = new StringBuilder();
+ for (ObjectName key : scanmap.keySet()) {
+ final DirectoryScannerMXBean s = scanmap.get(key);
+ try {
+ if (state == STOPPED) return;
+ s.scan();
+ } catch (Exception ex) {
+ LOG.log(Level.FINE,key + " failed to scan: "+ex,ex);
+ errcount++;
+ append(b,"\t",ex);
+ }
+ }
+ if (errcount > 0) {
+ b.insert(0,"scan partially performed with "+errcount+" error(s):");
+ throw new RuntimeException(b.toString());
+ }
+ }
+
+ // List of scheduled session task. Needed by stop() to cancel
+ // scheduled sessions. There's usually at most 1 session in
+ // this list (unless there's a bug somewhere ;-))
+ //
+ private final ConcurrentLinkedQueue<SessionTask> tasklist =
+ new ConcurrentLinkedQueue<SessionTask>();
+
+ // Used to give a unique id to session task - useful for
+ // debugging.
+ //
+ private volatile static long taskcount = 0;
+
+ /**
+ * A session task will be scheduled to run in background in a
+ * timer thread. There can be at most one session task running
+ * at a given time (this is ensured by using a timer - which is
+ * a single threaded object).
+ *
+ * If the session needs to be repeated, it will reschedule an
+ * identical session when it finishes to run. This ensure that
+ * two session runs are separated by the given interval time.
+ *
+ **/
+ private class SessionTask extends TimerTask {
+
+ /**
+ * Delay after which the next iteration of this task will
+ * start. This delay is measured starting at the end of
+ * the previous iteration.
+ **/
+ final long delayBeforeNext;
+
+ /**
+ * A unique id for this task.
+ **/
+ final long taskid;
+
+ /**
+ * Whether it's been cancelled by stop()
+ **/
+ volatile boolean cancelled=false;
+
+ /**
+ * create a new SessionTask.
+ **/
+ SessionTask(long scheduleNext) {
+ delayBeforeNext = scheduleNext;
+ taskid = taskcount++;
+ }
+
+ /**
+ * When run() begins, the state is switched to RUNNING.
+ * When run() ends then:
+ * If the task is repeated, the state will be switched
+ * to SCHEDULED (because a new task was scheduled).
+ * Otherwise the state will be switched to either
+ * STOPPED (if it was stopped before it could complete)
+ * or COMPLETED (if it completed gracefully)
+ * This method is used to switch to the desired state and
+ * send the appropriate notifications.
+ * When entering the method, we check whether the state is
+ * STOPPED. If so, we return false - and the SessionTask will
+ * stop. Otherwise, we switch the state to the desired value.
+ **/
+ private boolean notifyStateChange(ScanState newState,String condition) {
+ synchronized (ScanManager.this) {
+ if (state == STOPPED || state == CLOSED) return false;
+ switchState(newState,condition);
+ }
+ sendQueuedNotifications();
+ return true;
+ }
+
+ // Cancels this task.
+ public boolean cancel() {
+ cancelled=true;
+ return super.cancel();
+ }
+
+ /**
+ * Invoke all directories scanners in sequence. At each
+ * step, checks to see whether the task should stop.
+ **/
+ private boolean execute() {
+ final String tag = "Scheduled session["+taskid+"]";
+ try {
+ if (cancelled) {
+ LOG.finer(tag+" cancelled: done");
+ return false;
+ }
+ if (!notifyStateChange(RUNNING,"scan-running")) {
+ LOG.finer(tag+" stopped: done");
+ return false;
+ }
+ scanAllDirectories();
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST)) {
+ LOG.log(Level.FINEST,
+ tag+" failed to scan: "+x,x);
+ } else if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine(tag+" failed to scan: "+x);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Schedule an identical task for next iteration.
+ **/
+ private boolean scheduleNext() {
+ final String tag = "Scheduled session["+taskid+"]";
+
+ // We need now to reschedule a new task for after 'delayBeforeNext' ms.
+ try {
+ LOG.finer(tag+": scheduling next session for "+ delayBeforeNext + "ms");
+ if (cancelled || !notifyStateChange(SCHEDULED,"scan-scheduled")) {
+ LOG.finer(tag+" stopped: do not reschedule");
+ return false;
+ }
+ final SessionTask nextTask = new SessionTask(delayBeforeNext);
+ if (!scheduleSession(nextTask,delayBeforeNext)) return false;
+ LOG.finer(tag+": next session successfully scheduled");
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST)) {
+ LOG.log(Level.FINEST,tag+
+ " failed to schedule next session: "+x,x);
+ } else if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine(tag+" failed to schedule next session: "+x);
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * The run method:
+ * executes scanning logic, the schedule next iteration if needed.
+ **/
+ public void run() {
+ final String tag = "Scheduled session["+taskid+"]";
+ LOG.entering(SessionTask.class.getName(),"run");
+ LOG.finer(tag+" starting...");
+ try {
+ if (execute()==false) return;
+
+ LOG.finer(tag+" terminating - state is "+state+
+ ((delayBeforeNext >0)?(" next session is due in "+delayBeforeNext+" ms."):
+ " no additional session scheduled"));
+
+ // if delayBeforeNext <= 0 we are done, either because the session was
+ // stopped or because it successfully completed.
+ if (delayBeforeNext <= 0) {
+ if (!notifyStateChange(COMPLETED,"scan-done"))
+ LOG.finer(tag+" stopped: done");
+ else
+ LOG.finer(tag+" completed: done");
+ return;
+ }
+
+ // we need to reschedule a new session for 'delayBeforeNext' ms.
+ scheduleNext();
+
+ } finally {
+ tasklist.remove(this);
+ LOG.finer(tag+" finished...");
+ LOG.exiting(SessionTask.class.getName(),"run");
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // ---------------------------------------------------------------
+
+ // ---------------------------------------------------------------
+ // MBean Notification support
+ // The methods below are imported from {@link NotificationEmitter}
+ // ---------------------------------------------------------------
+
+ /**
+ * Delegates the implementation of this method to the wrapped
+ * {@code NotificationBroadcasterSupport} object.
+ **/
+ public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException {
+ broadcaster.addNotificationListener(listener, filter, handback);
+ }
+
+
+ /**
+ * We emit an {@code AttributeChangeNotification} when the {@code State}
+ * attribute changes.
+ **/
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return new MBeanNotificationInfo[] {
+ new MBeanNotificationInfo(new String[] {
+ AttributeChangeNotification.ATTRIBUTE_CHANGE},
+ AttributeChangeNotification.class.getName(),
+ "Emitted when the State attribute changes")
+ };
+ }
+
+ /**
+ * Delegates the implementation of this method to the wrapped
+ * {@code NotificationBroadcasterSupport} object.
+ **/
+ public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener);
+ }
+
+ /**
+ * Delegates the implementation of this method to the wrapped
+ * {@code NotificationBroadcasterSupport} object.
+ **/
+ public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener, filter, handback);
+ }
+
+ /**
+ * Returns and increment the sequence number used for
+ * notifications. We use the same sequence number throughout the
+ * application - this is why this method is only package protected.
+ * @return A unique sequence number for the next notification.
+ */
+ static synchronized long getNextSeqNumber() {
+ return seqNumber++;
+ }
+
+ // ---------------------------------------------------------------
+ // End of MBean Notification support
+ // ---------------------------------------------------------------
+
+ // ---------------------------------------------------------------
+ // MBeanRegistration support
+ // The methods below are imported from {@link MBeanRegistration}
+ // ---------------------------------------------------------------
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * registered in the MBean server. If the name of the MBean is not
+ * specified, the MBean can provide a name for its registration. If
+ * any exception is raised, the MBean will not be registered in the
+ * MBean server.
+ * <p>In this implementation, we check that the provided name is
+ * either {@code null} or equals to {@link #SCAN_MANAGER_NAME}. If it
+ * isn't then we throw an IllegalArgumentException, otherwise we return
+ * {@link #SCAN_MANAGER_NAME}.</p>
+ * <p>This ensures that there will be a single instance of ScanManager
+ * registered in a given MBeanServer, and that it will always be
+ * registered with the singleton's {@link #SCAN_MANAGER_NAME}.</p>
+ * <p>We do not need to check whether an MBean by that name is
+ * already registered because the MBeanServer will perform
+ * this check just after having called preRegister().</p>
+ * @param server The MBean server in which the MBean will be registered.
+ * @param name The object name of the MBean. This name is null if the
+ * name parameter to one of the createMBean or registerMBean methods in
+ * the MBeanServer interface is null. In that case, this method must
+ * return a non-null ObjectName for the new MBean.
+ * @return The name under which the MBean is to be registered. This value
+ * must not be null. If the name parameter is not null, it will usually
+ * but not necessarily be the returned value.
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
+ if (name != null) {
+ if (!SCAN_MANAGER_NAME.equals(name))
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+ mbeanServer = server;
+ return SCAN_MANAGER_NAME;
+ }
+
+ // Returns the default configuration filename
+ static String getDefaultConfigurationFileName() {
+ // This is a file calles 'jmx-scandir.xml' located
+ // in the user directory.
+ final String user = System.getProperty("user.home");
+ final String defconf = user+File.separator+"jmx-scandir.xml";
+ return defconf;
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having
+ * been registered in the MBean server or after the registration has
+ * failed.
+ * <p>
+ * If registration was not successful, the method returns immediately.
+ * <p>
+ * If registration is successful, register the {@link ResultLogManager}
+ * and default {@link ScanDirConfigMXBean}. If registering these
+ * MBean fails, the {@code ScanManager} state will be switched to
+ * {@link #close CLOSED}, and postRegister ends there.
+ * </p>
+ * <p>Otherwise the {@code ScanManager} will ask the
+ * {@link ScanDirConfigMXBean} to load its configuration.
+ * If it succeeds, the configuration will be {@link
+ * #applyConfiguration applied}. Otherwise, the method simply returns,
+ * assuming that the user will later create/update a configuration and
+ * apply it.
+ * @param registrationDone Indicates whether or not the MBean has been
+ * successfully registered in the MBean server. The value false means
+ * that the registration has failed.
+ */
+ public void postRegister(Boolean registrationDone) {
+ if (!registrationDone) return;
+ Exception test=null;
+ try {
+ mbeanServer.registerMBean(log,
+ ResultLogManager.RESULT_LOG_MANAGER_NAME);
+ final String defconf = getDefaultConfigurationFileName();
+ final String conf = System.getProperty("scandir.config.file",defconf);
+ final String confname = ScanDirConfig.guessConfigName(conf,defconf);
+ final ObjectName defaultProfileName =
+ makeMBeanName(ScanDirConfigMXBean.class,confname);
+ if (!mbeanServer.isRegistered(defaultProfileName))
+ mbeanServer.registerMBean(new ScanDirConfig(conf),
+ defaultProfileName);
+ config = JMX.newMXBeanProxy(mbeanServer,defaultProfileName,
+ ScanDirConfigMXBean.class,true);
+ configmap.put(defaultProfileName,config);
+ } catch (Exception x) {
+ LOG.config("Failed to populate MBeanServer: "+x);
+ close();
+ return;
+ }
+ try {
+ config.load();
+ } catch (Exception x) {
+ LOG.finest("No config to load: "+x);
+ test = x;
+ }
+ if (test == null) {
+ try {
+ applyConfiguration(config.getConfiguration());
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,"Failed to apply config: "+x,x);
+ LOG.config("Failed to apply config: "+x);
+ }
+ }
+ }
+
+ // Unregisters all created DirectoryScanners
+ private void unregisterScanners() throws JMException {
+ unregisterMBeans(scanmap);
+ }
+
+ // Unregisters all created ScanDirConfigs
+ private void unregisterConfigs() throws JMException {
+ unregisterMBeans(configmap);
+ }
+
+ // Unregisters all MBeans named by the given map
+ private void unregisterMBeans(Map<ObjectName,?> map) throws JMException {
+ for (ObjectName key : map.keySet()) {
+ if (mbeanServer.isRegistered(key))
+ mbeanServer.unregisterMBean(key);
+ map.remove(key);
+ }
+ }
+
+ // Unregisters the ResultLogManager.
+ private void unregisterResultLogManager() throws JMException {
+ final ObjectName name = ResultLogManager.RESULT_LOG_MANAGER_NAME;
+ if (mbeanServer.isRegistered(name)) {
+ mbeanServer.unregisterMBean(name);
+ }
+ }
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * unregistered by the MBean server.
+ * This implementation also unregisters all the MXBeans
+ * that were created by this object.
+ * @throws IllegalStateException if the lock can't be acquire, or if
+ * the MBean's state doesn't allow the MBean to be unregistered
+ * (e.g. because it's scheduled or running).
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public void preDeregister() throws Exception {
+ try {
+ close();
+ if (!sequencer.tryAcquire())
+ throw new IllegalStateException("can't acquire lock");
+ try {
+ unregisterScanners();
+ unregisterConfigs();
+ unregisterResultLogManager();
+ } finally {
+ sequencer.release();
+ }
+ } catch (Exception x) {
+ LOG.log(Level.FINEST,"Failed to unregister: "+x,x);
+ throw x;
+ }
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having been
+ * unregistered in the MBean server.
+ * Cancels the internal timer - if any.
+ */
+ public synchronized void postDeregister() {
+ if (timer != null) {
+ try {
+ timer.cancel();
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,"Failed to cancel timer",x);
+ else if (LOG.isLoggable(Level.FINE))
+ LOG.fine("Failed to cancel timer: "+x);
+ } finally {
+ timer = null;
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // End of MBeanRegistration support
+ // ---------------------------------------------------------------
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java
new file mode 100644
index 0000000..1f6d4ff
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.io.IOException;
+import java.util.Map;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMException;
+
+/**
+ * The <code>ScanManagerMXBean</code> is responsible for applying a
+ * configuration, starting and scheduling directory scans, and reporting
+ * application state.
+ * <p>
+ * The <code>ScanManagerMXBean</code> is a singleton MBean: there can be
+ * at most one instance of such an MBean registered in a given MBeanServer.
+ * The name of that MBean is a constant defined in
+ * {@link ScanManager#SCAN_MANAGER_NAME ScanManager.SCAN_MANAGER_NAME}.
+ * </p>
+ * <p>
+ * The <code>ScanManagerMXBean</code> is the entry point of the <i>scandir</i>
+ * application management interface. It is from this MBean that all other
+ * MBeans will be created and registered.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+public interface ScanManagerMXBean {
+ /**
+ * This state tells whether directory scans are running, scheduled,
+ * successfully completed, or stopped.
+ * <p>
+ * The {@link #CLOSED} state means
+ * that the {@link ScanManagerMXBean} was closed and is no longer usable.
+ * This state is used when the {@link ScanManagerMXBean} needs to be
+ * unregistered.
+ * </p>
+ **/
+ public enum ScanState {
+ /**
+ * Scanning of directories is in process.
+ **/
+ RUNNING,
+
+ /**
+ * Scanning of directories is not in process, but is scheduled
+ * for a later date.
+ **/
+ SCHEDULED,
+
+ /**
+ * Scanning is successfully completed.
+ **/
+ COMPLETED,
+
+ /**
+ * Scanning is stopped. No scanning is scheduled.
+ **/
+ STOPPED,
+
+ /**
+ * close() was called.
+ **/
+ CLOSED
+
+ }
+
+ /**
+ * Returns the current state of the application.
+ * @return the current state of the application.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanState getState()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Schedule a scan session for a later date.
+ * <p>
+ * A scan session is a background task that will sequentially call {@link
+ * DirectoryScannerMXBean#scan scan()} on every {@link
+ * DirectoryScannerMXBean} configured for this MBean.
+ * </p>
+ * @see #getDirectoryScanners
+ * @param delay The first scan session will be started after
+ * the given delay. 0 means start now.
+ * @param interval Scan session will be rescheduled periodically
+ * at the specified interval. The interval starts at the
+ * the end of the scan session: if a scan session takes
+ * on average x milliseconds to complete, then a scan session will
+ * be started on average every x+interval milliseconds.
+ * if (interval == 0) then scan session will not be
+ * rescheduled, and will run only once.
+ * @throws IllegalStateException if a scan session is already
+ * running or scheduled, or the MBean is closed.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void schedule(long delay, long interval)
+ throws IOException, InstanceNotFoundException;
+
+
+ /**
+ * Stops current running or scheduled scan sessions if any.
+ * <p>
+ * A scan session is a background task that will sequentially call {@link
+ * DirectoryScannerMXBean#scan scan()} on every {@link
+ * DirectoryScannerMXBean} configured for this MBean.
+ * </p>
+ * <p>
+ * Scan sessions are started/scheduled by calls to {@link #start start} or
+ * {@link #schedule schedule}.
+ * </p>
+ * After this method completes the state of the application will
+ * be {@link ScanState#STOPPED}.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void stop()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Switches the state to CLOSED.
+ * When closed, this MBean cannot be used any more.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void close()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Starts a scan session immediately.
+ * This is equivalent to {@link #schedule(long,long) schedule(0,0)}.
+ * @throws IllegalStateException if a scan session is already
+ * running or scheduled, or the MBean is closed.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void start()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the list of directory scanners configured for this MBean.
+ * @return A {@code Map<String,DirectoryScannerMXBean>} where the
+ * key in the map is the value of the <code>name=</code> key
+ * of the {@link DirectoryScannerMXBean} ObjectName.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ **/
+ public Map<String,DirectoryScannerMXBean> getDirectoryScanners()
+ throws IOException, JMException;
+
+ /**
+ * Apply the configuration handled by the {@link
+ * #getConfigurationMBean configuration MBean}.
+ * <p>
+ * When the configuration is applied, all the {@link DirectoryScannerMXBean}
+ * created by this MBean will be unregistered, and new {@link
+ * DirectoryScannerMXBean} will be created and registered from the
+ * new {@link ScanDirConfigMXBean#getConfiguration configuration data}.
+ * </p>
+ * <p>
+ * The initial result log configuration held by the {@link
+ * #getConfigurationMBean configuration MBean} will also be pushed to the
+ * {@link ResultLogManagerMXBean}. If you don't want to lose your current
+ * {@link ResultLogManagerMXBean} configuration, you should therefore call
+ * {@link #applyCurrentResultLogConfig
+ * applyCurrentResultLogConfig} before calling
+ * {@link #applyConfiguration applyConfiguration}
+ * </p>
+ * @param fromMemory if {@code true}, the configuration will be applied
+ * from memory. if {@code false}, the {@code ScanManagerMXBean} will
+ * ask the {@link
+ * #getConfigurationMBean configuration MBean} to {@link
+ * ScanDirConfigMXBean#load reload its configuration} before applying
+ * it.
+ * @throws IllegalStateException if a scan session is
+ * running or scheduled, or the MBean is closed.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ **/
+ public void applyConfiguration(boolean fromMemory)
+ throws IOException, JMException;
+ /**
+ * Replaces the {@link
+ * #getConfigurationMBean configuration MBean}'s {@link
+ * com.sun.jmx.examples.scandir.config.ScanManagerConfig#getInitialResultLogConfig
+ * initial result log configuration} with the current {@link
+ * ResultLogManagerMXBean}
+ * configuration. This prevents the <code>ResultLogManagerMXBean</code>
+ * current configuration from being reset when {@link #applyConfiguration
+ * applyConfiguration} is called.
+ * @param toMemory if {@code true} only replaces the initial result log
+ * configuration held in memory.
+ * if {@code false}, the {@link
+ * #getConfigurationMBean configuration MBean} will be asked to commit
+ * the whole configuration to the configuration file.
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ **/
+ public void applyCurrentResultLogConfig(boolean toMemory)
+ throws IOException, JMException;
+
+ /**
+ * Instruct the {@code ScanManagerMXBean} to use another {@link
+ * ScanDirConfigMXBean configuration MBean}.
+ * <p>This method doesn't {@link #applyConfiguration apply} the new
+ * configuration. If you want to apply the new configuration, you should
+ * additionally call {@link #applyConfiguration
+ * applyConfiguration(true|false)}. Note that you cannot apply a
+ * configuration as long as a scan session is scheduled or running.
+ * In that case you will need to wait for that session to complete
+ * or call {@link #stop} to stop it.
+ * </p>
+ * @param config A proxy to the {@link ScanDirConfigMXBean} that holds
+ * the new configuration for the application.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void setConfigurationMBean(ScanDirConfigMXBean config)
+ throws IOException, InstanceNotFoundException;
+ /**
+ * Gets the current configuration MBean.
+ * @return A proxy to the current configuration MBean.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanDirConfigMXBean getConfigurationMBean()
+ throws IOException, InstanceNotFoundException;
+ /**
+ * This method creates a new alternate {@link ScanDirConfigMXBean}.
+ *
+ * <p>You will need to call {@link #setConfigurationMBean
+ * setConfigurationMBean} if you
+ * want this new {@link ScanDirConfigMXBean} to become the
+ * current configuration MBean.
+ * </p>
+ * <p>
+ * This new {@link ScanDirConfigMXBean} will be unregistered automatically
+ * by the {@code ScanManagerMXBean} when the {@code ScanManagerMXBean}
+ * is unregistered.
+ * </p>
+ * @param name The short name for the new {@link ScanDirConfigMXBean}.
+ * This name will be used in the ObjectName <code>name=</code> key
+ * of the new {@link ScanDirConfigMXBean}.
+ * @param filename The path of the file from which the new {@link
+ * ScanDirConfigMXBean} can {@link ScanDirConfigMXBean#load load} or
+ * {@link ScanDirConfigMXBean#save save} its configuration data.
+ * Note that even if the file exists and contain a valid
+ * configuration, you will still need to call {@link
+ * ScanDirConfigMXBean#load load} to make the {@link
+ * ScanDirConfigMXBean} load its configuration data.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ * @return A proxy to the created {@link ScanDirConfigMXBean}.
+ */
+ public ScanDirConfigMXBean createOtherConfigurationMBean(String name,
+ String filename)
+ throws JMException, IOException;
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java
new file mode 100644
index 0000000..b3f8e9f
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Logger;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * The <code>DirectoryScannerConfig</code> Java Bean is used to model
+ * the configuration of a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean}.
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="DirectoryScanner",
+ namespace=XmlConfigUtils.NAMESPACE)
+public class DirectoryScannerConfig {
+
+ //
+ // A logger for this class.
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(DirectoryScannerConfig.class.getName());
+
+ /**
+ * This enumeration is used to model the actions that a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean
+ * DirectoryScannerMXBean} should take when a file matches its set
+ * of matching criteria.
+ **/
+ public enum Action {
+ /**
+ * Indicates that the {@code DirectoryScannerMXBean} should
+ * emit a {@code Notification} when a matching file is found.
+ */
+ NOTIFY,
+ /**
+ * Indicates that the {@code DirectoryScannerMXBean} should
+ * delete the matching files.
+ */
+ DELETE,
+ /**
+ * Indicates that the {@code DirectoryScannerMXBean} should
+ * log the actions that were taken on the matching files.
+ */
+ LOGRESULT };
+
+ // A short name for the Directory Scanner
+ // This name is used for the value of the {@code name=} key in the
+ // {@code DirectoryScannerMXBean} ObjectName.
+ private String name;
+
+ // The root directory of the Directory Scanner
+ private String rootDirectory;
+
+ // List of filters identifying files that should be selected.
+ // A file is selected if at least one filter matches.
+ //
+ private final List<FileMatch> includeFiles =
+ new ArrayList<FileMatch>();
+
+ // List of filters identifying files that should be excluded.
+ // A file is excluded if at least one filter matches.
+ //
+ private final List<FileMatch> excludeFiles =
+ new ArrayList<FileMatch>();
+
+
+ // The actions that this Directory Scanner should carry out when a
+ // file is selected. Default is NOTIFY and LOGRESULT.
+ //
+ private Action[] actions = { Action.NOTIFY, Action.LOGRESULT };
+
+ /**
+ * Creates a new instance of {@code DirectoryScannerConfig}.
+ * We keep this empty constructor to make XML binding easier.
+ * You shouldn't use this constructor directly:
+ * use {@link #DirectoryScannerConfig(String)
+ * DirectoryScannerConfig(String name)} instead.
+ * @deprecated <p>Tagged deprecated so that a compiler warning is issued.
+ * Use {@link #DirectoryScannerConfig(String)
+ * DirectoryScannerConfig(String name)} instead.
+ * </p>
+ **/
+ public DirectoryScannerConfig() {
+ this(null);
+ }
+
+ /**
+ * Creates a new instance of {@code DirectoryScannerConfig}.
+ * @param name A short name for the Directory Scanner. This name is used for
+ * the value of the {@code name=} key in the
+ * {@code DirectoryScannerMXBean} ObjectName.
+ **/
+ public DirectoryScannerConfig(String name) {
+ this.name = name;
+ rootDirectory = null;
+ }
+
+ /**
+ * Gets the root directory configured for that Directory Scanner.
+ * @return the root directory at which the directory scanner should start
+ * scanning.
+ **/
+ @XmlElement(name="RootDirectory",namespace=XmlConfigUtils.NAMESPACE)
+ public String getRootDirectory() {
+ return rootDirectory;
+ }
+
+ /**
+ * Configures a root directory for that Directory Scanner.
+ * @param root The root directory at which the directory scanner should
+ * start scanning.
+ **/
+ public void setRootDirectory(String root) {
+ rootDirectory=root;
+ }
+
+
+ /**
+ * Gets the short name of this directory scanner.
+ *
+ * <p>
+ * This name is used for the value of the {@code name=} key in the
+ * {@code DirectoryScannerMXBean} ObjectName.
+ * </p>
+ *
+ * @return the short name of this directory scanner.
+ **/
+ @XmlAttribute(name="name",required=true)
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Setter for property {@link #getName() name}.
+ * Once set its value cannot change.
+ * @param name New value of property name.
+ * @throws IllegalArgumentException if {@code name} is already set to a
+ * different non null value.
+ */
+ public void setName(String name) {
+ if (this.name == null)
+ this.name = name;
+ else if (name == null)
+ throw new IllegalArgumentException("name=null");
+ else if (!name.equals(this.name))
+ throw new IllegalArgumentException("name="+name);
+ }
+
+ /**
+ * Getter for property includeFiles.
+ * This is an array of filters identifying files that should be selected.
+ * A file is selected if at least one filter matches.
+ * @return Value of property includeFiles.
+ */
+ @XmlElementWrapper(name="IncludeFiles",
+ namespace=XmlConfigUtils.NAMESPACE)
+ @XmlElementRef
+ public FileMatch[] getIncludeFiles() {
+ synchronized(includeFiles) {
+ return includeFiles.toArray(new FileMatch[0]);
+ }
+ }
+
+ /**
+ * Adds a filter to the includeFiles property.
+ * A file is selected if at least one filter matches.
+ * @param include A filter identifying files that should be selected.
+ */
+ public void addIncludeFiles(FileMatch include) {
+ if (include == null)
+ throw new IllegalArgumentException("null");
+ synchronized (includeFiles) {
+ includeFiles.add(include);
+ }
+ }
+
+ /**
+ * Setter for property includeFiles.
+ * @param includeFiles New value of property includeFiles.
+ * This is an array of filters identifying files
+ * that should be selected. A file is selected if at least
+ * one filter matches.
+ */
+ public void setIncludeFiles(FileMatch[] includeFiles) {
+ synchronized (this.includeFiles) {
+ this.includeFiles.clear();
+ if (includeFiles == null) return;
+ this.includeFiles.addAll(Arrays.asList(includeFiles));
+ }
+ }
+
+ /**
+ * Getter for property excludeFiles.
+ * This is an array of filters identifying files that should be excluded.
+ * A file is excluded if at least one filter matches.
+ * @return Value of property excludeFiles.
+ */
+ @XmlElementWrapper(name="ExcludeFiles",
+ namespace=XmlConfigUtils.NAMESPACE)
+ @XmlElementRef
+ public FileMatch[] getExcludeFiles() {
+ synchronized(excludeFiles) {
+ return excludeFiles.toArray(new FileMatch[0]);
+ }
+ }
+
+ /**
+ * Setter for property excludeFiles.
+ * @param excludeFiles New value of property excludeFiles.
+ * This is an array of filters identifying files
+ * that should be excluded. A file is excluded if at least
+ * one filter matches.
+ */
+ public void setExcludeFiles(FileMatch[] excludeFiles) {
+ synchronized (this.excludeFiles) {
+ this.excludeFiles.clear();
+ if (excludeFiles == null) return;
+ this.excludeFiles.addAll(Arrays.asList(excludeFiles));
+ }
+ }
+
+ /**
+ * Adds a filter to the excludeFiles property.
+ * A file is excluded if at least one filter matches.
+ * @param exclude A filter identifying files that should be excluded.
+ */
+ public void addExcludeFiles(FileMatch exclude) {
+ if (exclude == null)
+ throw new IllegalArgumentException("null");
+ synchronized (excludeFiles) {
+ this.excludeFiles.add(exclude);
+ }
+ }
+
+ /**
+ * Gets the list of actions that this Directory Scanner should carry
+ * out when a file is selected. Default is NOTIFY and LOGRESULT.
+
+ * @return The list of actions that this Directory Scanner should carry
+ * out when a file is selected.
+ */
+ @XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
+ @XmlList
+ public Action[] getActions() {
+ return (actions == null)?null:actions.clone();
+ }
+
+ /**
+ * Sets the list of actions that this Directory Scanner should carry
+ * out when a file is selected. Default is NOTIFY and LOGRESULT.
+
+ * @param actions The list of actions that this Directory Scanner should
+ * carry out when a file is selected.
+ */
+ public void setActions(Action[] actions) {
+ this.actions = (actions == null)?null:actions.clone();
+ }
+
+ /**
+ * Builds a {@code FileFilter} from the {@link #getIncludeFiles
+ * includeFiles} and {@link #getExcludeFiles excludeFiles} lists.
+ * A file will be accepted if it is selected by at least one of
+ * the filters in {@link #getIncludeFiles includeFiles}, and is
+ * not excluded by any of the filters in {@link
+ * #getExcludeFiles excludeFiles}. If there's no filter in
+ * {@link #getIncludeFiles includeFiles}, then a file is accepted
+ * simply if it is not excluded by any of the filters in {@link
+ * #getExcludeFiles excludeFiles}.
+ *
+ * @return A new {@code FileFilter} created from the current snapshot
+ * of the {@link #getIncludeFiles
+ * includeFiles} and {@link #getExcludeFiles excludeFiles} lists.
+ * Later modification of these lists will not affect the
+ * returned {@code FileFilter}.
+ **/
+ public FileFilter buildFileFilter() {
+ final FileFilter[] ins = getIncludeFiles();
+ final FileFilter[] outs = getExcludeFiles();
+ final FileFilter filter = new FileFilter() {
+ public boolean accept(File f) {
+ boolean result = false;
+ // If no include filter, all files are included.
+ if (ins != null) {
+ for (FileFilter in: ins) {
+ // if one filter accepts it, file is included
+ if (!in.accept(f)) continue;
+
+ // file is accepted, include it
+ result=true;
+ break;
+ }
+ } else result= true;
+ if (result == false) return false;
+
+ // The file is in the include list. Let's see if it's not
+ // in the exclude list...
+ //
+ if (outs != null) {
+ for (FileFilter out: outs) {
+ // if one filter accepts it, file is excluded
+ if (!out.accept(f)) continue;
+
+ // file is accepted, exclude it.
+ result=false;
+ break;
+ }
+ }
+ return result;
+ }
+ };
+ return filter;
+ }
+
+ // Used for equality - see equals().
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ name,rootDirectory,actions,excludeFiles,includeFiles
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof DirectoryScannerConfig)) return false;
+ final DirectoryScannerConfig other = (DirectoryScannerConfig)o;
+ final Object[] thisconfig = toArray();
+ final Object[] otherconfig = other.toArray();
+ return Arrays.deepEquals(thisconfig,otherconfig);
+ }
+
+ @Override
+ public int hashCode() {
+ final String key = name;
+ if (key == null) return 0;
+ else return key.hashCode();
+ }
+
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java
new file mode 100644
index 0000000..31f44ce
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.logging.Logger;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * The <code>FileMatch</code> Java Bean is used to model
+ * the configuration of a {@link FileFilter} which
+ * matches {@link File files} against a set of criteria.
+ * <p>
+ * The <code>FileMatch</code> class also implements
+ * {@link FileFilter} - applying an {@code AND} on all
+ * its conditions. {@code OR} conditions can be obtained
+ * by supplying several instances of <code>FileMatch</code>
+ * to the encapsulating {@link DirectoryScannerConfig}, which
+ * respectively applies an {@code OR} on all its
+ * {@code <FileFilter>} elements.
+ * </p>
+ *
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="FileFilter",
+ namespace=XmlConfigUtils.NAMESPACE)
+public class FileMatch implements FileFilter {
+
+ //
+ // A logger for this class.
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(FileMatch.class.getName());
+
+ /**
+ * A regular expression against which directory names should be matched.
+ */
+ private String directoryPattern;
+
+ /**
+ * A regular expression against which file names should be matched.
+ */
+ private String filePattern;
+
+ /**
+ * File whose size in bytes exceeds this limit will be selected.
+ */
+ private long sizeExceedsMaxBytes;
+
+ /**
+ * A file which will be selected only if it was last modified after
+ * this date
+ */
+ private Date lastModifiedAfter;
+
+ /**
+ * A file which will be selected only if it was last modified before
+ * this date
+ */
+ private Date lastModifiedBefore;
+
+ /**
+ * Creates a new instance of FileMatch
+ */
+ public FileMatch() {
+ }
+
+ /**
+ * Getter for property directoryPattern. This is a regular expression
+ * against which directory names should be matched.
+ * Applies only to directory, and tells whether a directory should be
+ * included or excluded from the search.
+ * <p>If File.isDirectory() && directoryPattern!=null &&
+ * File.getName().matches(directoryPattern),
+ * then File matches this filter.<br>
+ * If File.isDirectory() && directoryPattern!=null &&
+ * File.getName().matches(directoryPattern)==false,
+ * then File doesn't match this filter.<br>
+ * </p>
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ * @return Value of property directoryPattern.
+ */
+ @XmlElement(name="DirectoryPattern",namespace=XmlConfigUtils.NAMESPACE)
+ public String getDirectoryPattern() {
+ return this.directoryPattern;
+ }
+
+ /**
+ * Setter for property directoryPattern.
+ * @param directoryPattern New value of property directoryPattern.
+ * This is a regular expression
+ * against which directory names should be {@link #getDirectoryPattern
+ * matched}.
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ */
+ public void setDirectoryPattern(String directoryPattern) {
+ this.directoryPattern = directoryPattern;
+ }
+
+ /**
+ * Getter for property filePattern. This is a regular expression
+ * against which file names should be matched.
+ * Applies only to files.
+ * <p>
+ * If File.isDirectory()==false && filePattern!=null &&
+ * File.getName().matches(filePattern)==false,
+ * then File doesn't match this filter.
+ * </p>
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ * @return Value of property filePatern.
+ */
+ @XmlElement(name="FilePattern",namespace=XmlConfigUtils.NAMESPACE)
+ public String getFilePattern() {
+ return this.filePattern;
+ }
+
+ /**
+ * Setter for property filePattern.
+ * @param filePattern New value of property filePattern.
+ * This is a regular expression
+ * against which file names should be {@link #getFilePattern matched}.
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ */
+ public void setFilePattern(String filePattern) {
+ this.filePattern = filePattern;
+ }
+
+ /**
+ * Getter for property sizeExceedsMaxBytes.
+ * Ignored if 0 or negative. Otherwise, files whose size in bytes does
+ * not exceed this limit will be excluded by this filter.
+ *
+ * @return Value of property sizeExceedsMaxBytes.
+ */
+ @XmlElement(name="SizeExceedsMaxBytes",namespace=XmlConfigUtils.NAMESPACE)
+ public long getSizeExceedsMaxBytes() {
+ return this.sizeExceedsMaxBytes;
+ }
+
+ /**
+ * Setter for property sizeExceedsMaxBytes.
+ * @param sizeLimitInBytes New value of property sizeExceedsMaxBytes.
+ * Ignored if 0 or negative. Otherwise, files whose size in bytes does
+ * not exceed this limit will be excluded by this filter.
+ *
+ */
+ public void setSizeExceedsMaxBytes(long sizeLimitInBytes) {
+ this.sizeExceedsMaxBytes = sizeLimitInBytes;
+ }
+
+ /**
+ * Getter for property {@code lastModifiedAfter}.
+ * A file will be selected only if it was last modified after
+ * {@code lastModifiedAfter}.
+ * <br>This condition is ignored if {@code lastModifiedAfter} is
+ * {@code null}.
+ * @return Value of property {@code lastModifiedAfter}.
+ */
+ @XmlElement(name="LastModifiedAfter",namespace=XmlConfigUtils.NAMESPACE)
+ public Date getLastModifiedAfter() {
+ return (lastModifiedAfter==null)?null:(Date)lastModifiedAfter.clone();
+ }
+
+ /**
+ * Setter for property {@code lastModifiedAfter}.
+ * @param lastModifiedAfter A file will be selected only if it was
+ * last modified after {@code lastModifiedAfter}.
+ * <br>This condition is ignored if {@code lastModifiedAfter} is
+ * {@code null}.
+ */
+ public void setLastModifiedAfter(Date lastModifiedAfter) {
+ this.lastModifiedAfter =
+ (lastModifiedAfter==null)?null:(Date)lastModifiedAfter.clone();
+ }
+
+ /**
+ * Getter for property {@code lastModifiedBefore}.
+ * A file will be selected only if it was last modified before
+ * {@code lastModifiedBefore}.
+ * <br>This condition is ignored if {@code lastModifiedBefore} is
+ * {@code null}.
+ * @return Value of property {@code lastModifiedBefore}.
+ */
+ @XmlElement(name="LastModifiedBefore",namespace=XmlConfigUtils.NAMESPACE)
+ public Date getLastModifiedBefore() {
+ return (lastModifiedBefore==null)?null:(Date)lastModifiedBefore.clone();
+ }
+
+ /**
+ * Setter for property {@code lastModifiedBefore}.
+ * @param lastModifiedBefore A file will be selected only if it was
+ * last modified before {@code lastModifiedBefore}.
+ * <br>This condition is ignored if {@code lastModifiedBefore} is
+ * {@code null}.
+ */
+ public void setLastModifiedBefore(Date lastModifiedBefore) {
+ this.lastModifiedBefore =
+ (lastModifiedBefore==null)?null:(Date)lastModifiedBefore.clone();
+ }
+
+ // Accepts or rejects a file with regards to the values of the fields
+ // configured in this bean. The accept() method is the implementation
+ // of FileFilter.accept(File);
+ //
+ /**
+ * A file is accepted when all the criteria that have been set
+ * are matched.
+ * @param f The file to match against the configured criteria.
+ * @return {@code true} if the file matches all criteria,
+ * {@code false} otherwise.
+ */
+ public boolean accept(File f) {
+
+ // Directories are accepted if they match against the directory pattern.
+ //
+ if (f.isDirectory()) {
+ if (directoryPattern != null
+ && !f.getName().matches(directoryPattern))
+ return false;
+ else return true;
+ }
+
+ // If we reach here, the f is not a directory.
+ //
+ // Files are accepted if they match all other conditions.
+
+ // Check whether f matches filePattern
+ if (filePattern != null
+ && !f.getName().matches(filePattern))
+ return false;
+
+ // Check whether f exceeeds size limit
+ if (sizeExceedsMaxBytes > 0 && f.length() <= sizeExceedsMaxBytes)
+ return false;
+
+ // Check whether f was last modified after lastModifiedAfter
+ if (lastModifiedAfter != null &&
+ lastModifiedAfter.after(new Date(f.lastModified())))
+ return false;
+
+ // Check whether f was last modified before lastModifiedBefore
+ if (lastModifiedBefore != null &&
+ lastModifiedBefore.before(new Date(f.lastModified())))
+ return false;
+
+ // All conditions were met: accept file.
+ return true;
+ }
+
+ // used by equals()
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ directoryPattern, filePattern, lastModifiedAfter,
+ lastModifiedBefore, sizeExceedsMaxBytes
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof FileMatch)) return false;
+ final FileMatch other = (FileMatch)o;
+ final Object[] thisconfig = toArray();
+ final Object[] otherconfig = other.toArray();
+ return Arrays.deepEquals(thisconfig,otherconfig);
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.deepHashCode(toArray());
+ }
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java
new file mode 100644
index 0000000..5f3d668
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.util.Arrays;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * The <code>ResultLogConfig</code> Java Bean is used to model
+ * the initial configuration of the {@link
+ * com.sun.jmx.examples.scandir.ResultLogManagerMXBean}.
+ *
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="ResultLogConfig",
+ namespace=XmlConfigUtils.NAMESPACE)
+public class ResultLogConfig {
+
+ //
+ // A logger for this class.
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(ResultLogConfig.class.getName());
+
+ /**
+ * The path to the result log file. {@code null} means that logging to
+ * file is disabled.
+ */
+ private String logFileName;
+
+ /**
+ * Maximum number of record that will be logged in the log file before
+ * switching to a new log file.
+ */
+ private long logFileMaxRecords;
+
+ /**
+ * The maximum number of records that can be contained in the memory log.
+ * When this number is reached, the memory log drops its eldest record
+ * to make way for the new one.
+ */
+ private int memoryMaxRecords;
+
+ /**
+ * Creates a new instance of ResultLogConfig
+ */
+ public ResultLogConfig() {
+ }
+
+ /**
+ * Gets the path to the result log file. {@code null} means that logging to
+ * file is disabled.
+ * @return the path to the result log file.
+ */
+ @XmlElement(name="LogFileName",namespace=XmlConfigUtils.NAMESPACE)
+ public String getLogFileName() {
+ return this.logFileName;
+ }
+
+ /**
+ * Sets the path to the result log file. {@code null} means that
+ * logging to file is disabled.
+ * @param logFileName the path to the result log file.
+ */
+ public void setLogFileName(String logFileName) {
+ this.logFileName = logFileName;
+ }
+
+ /**
+ * Gets the maximum number of record that will be logged in the log file
+ * before switching to a new log file.
+ * A 0 or negative value means no limit.
+ * @return the maximum number of record that will be logged in the log file.
+ */
+ @XmlElement(name="LogFileMaxRecords",namespace=XmlConfigUtils.NAMESPACE)
+ public long getLogFileMaxRecords() {
+ return this.logFileMaxRecords;
+ }
+
+ /**
+ * Sets the maximum number of record that will be logged in the log file
+ * before switching to a new log file.
+ * A 0 or negative value means no limit.
+ * @param logFileMaxRecords the maximum number of record that will be
+ * logged in the log file.
+ */
+ public void setLogFileMaxRecords(long logFileMaxRecords) {
+ this.logFileMaxRecords = logFileMaxRecords;
+ }
+
+ /**
+ * Gets the maximum number of records that can be contained in the memory
+ * log.
+ * When this number is reached, the memory log drops its eldest record
+ * to make way for the new one.
+ * @return the maximum number of records that can be contained in the
+ * memory log.
+ */
+ @XmlElement(name="MemoryMaxRecords",namespace=XmlConfigUtils.NAMESPACE)
+ public int getMemoryMaxRecords() {
+ return this.memoryMaxRecords;
+ }
+
+ /**
+ * Sets the maximum number of records that can be contained in the memory
+ * log.
+ * When this number is reached, the memory log drops its eldest record
+ * to make way for the new one.
+ * @param memoryMaxRecords the maximum number of records that can be
+ * contained in the memory log.
+ */
+ public void setMemoryMaxRecords(int memoryMaxRecords) {
+ this.memoryMaxRecords = memoryMaxRecords;
+ }
+
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ memoryMaxRecords,logFileMaxRecords,logFileName
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof ResultLogConfig)) return false;
+ final ResultLogConfig other = (ResultLogConfig)o;
+ return Arrays.deepEquals(toArray(),other.toArray());
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.deepHashCode(toArray());
+ }
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java
new file mode 100644
index 0000000..5e3188a
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.util.Date;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlRootElement;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action;
+import java.io.File;
+import java.util.Arrays;
+
+/**
+ * The <code>ResultRecord</code> Java Bean is used to write the
+ * results of a directory scan to a result log.
+ *
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="ResultRecord",namespace=XmlConfigUtils.NAMESPACE)
+public class ResultRecord {
+
+ /**
+ * The name of the file for which this result record is built.
+ */
+ private String filename;
+
+ /**
+ * The Date at which this result was obtained.
+ */
+ private Date date;
+
+ /**
+ * The short name of the directory scanner which performed the operation.
+ * @see DirectoryScannerConfig#getName()
+ */
+ private String directoryScanner;
+
+ /**
+ * The list of actions that were successfully carried out.
+ */
+ private Action[] actions;
+
+ /**
+ * Creates a new empty instance of ResultRecord.
+ */
+ public ResultRecord() {
+ }
+
+ /**
+ * Creates a new instance of ResultRecord.
+ * @param scan The DirectoryScannerConfig for which this result was
+ * obtained.
+ * @param actions The list of actions that were successfully carried out.
+ * @param f The file for which these actions were successfully carried out.
+ */
+ public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
+ File f) {
+ directoryScanner = scan.getName();
+ this.actions = actions;
+ date = new Date();
+ filename = f.getAbsolutePath();
+ }
+
+ /**
+ * Gets the name of the file for which this result record is built.
+ * @return The name of the file for which this result record is built.
+ */
+ @XmlElement(name="Filename",namespace=XmlConfigUtils.NAMESPACE)
+ public String getFilename() {
+ return this.filename;
+ }
+
+ /**
+ * Sets the name of the file for which this result record is being built.
+ * @param filename the name of the file for which this result record is
+ * being built.
+ */
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ /**
+ * Gets the Date at which this result was obtained.
+ * @return the Date at which this result was obtained.
+ */
+ @XmlElement(name="Date",namespace=XmlConfigUtils.NAMESPACE)
+ public Date getDate() {
+ synchronized(this) {
+ return (date==null)?null:(new Date(date.getTime()));
+ }
+ }
+
+ /**
+ * Sets the Date at which this result was obtained.
+ * @param date the Date at which this result was obtained.
+ */
+ public void setDate(Date date) {
+ synchronized (this) {
+ this.date = (date==null)?null:(new Date(date.getTime()));
+ }
+ }
+
+ /**
+ * Gets the short name of the directory scanner which performed the
+ * operation.
+ * @see DirectoryScannerConfig#getName()
+ * @return the short name of the directory scanner which performed the
+ * operation.
+ */
+ @XmlElement(name="DirectoryScanner",namespace=XmlConfigUtils.NAMESPACE)
+ public String getDirectoryScanner() {
+ return this.directoryScanner;
+ }
+
+ /**
+ * Sets the short name of the directory scanner which performed the
+ * operation.
+ * @see DirectoryScannerConfig#getName()
+ * @param directoryScanner the short name of the directory scanner which
+ * performed the operation.
+ */
+ public void setDirectoryScanner(String directoryScanner) {
+ this.directoryScanner = directoryScanner;
+ }
+
+ /**
+ * Gets the list of actions that were successfully carried out.
+ * @return the list of actions that were successfully carried out.
+ */
+ @XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
+ @XmlList
+ public Action[] getActions() {
+ return (actions == null)?null:actions.clone();
+ }
+
+ /**
+ * Sets the list of actions that were successfully carried out.
+ * @param actions the list of actions that were successfully carried out.
+ */
+ public void setActions(Action[] actions) {
+ this.actions = (actions == null)?null:actions.clone();
+ }
+
+ // Used for equality
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ filename, date, directoryScanner, actions
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ResultRecord)) return false;
+ return Arrays.deepEquals(toArray(),((ResultRecord)o).toArray());
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.deepHashCode(toArray());
+ }
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java
new file mode 100644
index 0000000..e1afcce
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+/**
+ * The <code>ScanManagerConfig</code> Java Bean is used to model
+ * the configuration of the {@link
+ * com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean}.
+ *
+ * The {@link
+ * com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean} will
+ * use this configuration to initialize the {@link
+ * com.sun.jmx.examples.scandir.ResultLogManagerMXBean ResultLogManagerMXBean}
+ * and create the {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean DirectoryScannerMXBeans}
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+@XmlRootElement(name="ScanManager",
+ namespace="jmx:com.sun.jmx.examples.scandir.config")
+public class ScanManagerConfig {
+
+ // A logger for this class
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(ScanManagerConfig.class.getName());
+
+ /**
+ * A set of DirectoryScannerConfig objects indexed by their names.
+ **/
+ private final Map<String, DirectoryScannerConfig> directoryScanners;
+
+ /**
+ * The initial Result Log configuration.
+ */
+ private ResultLogConfig initialResultLogConfig;
+
+ /**
+ * Holds value of property name. The name of the configuration
+ * usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ **/
+ private String name;
+
+ /**
+ * Creates a new instance of ScanManagerConfig.
+ * <p>You should not use this constructor directly, but use
+ * {@link #ScanManagerConfig(String)} instead.
+ * </p>
+ * <p>This constructor is tagged deprecated so that the compiler
+ * will generate a warning if it is used by mistake.
+ * </p>
+ * @deprecated Use {@link #ScanManagerConfig(String)} instead. This
+ * constructor is used through reflection by the XML
+ * binding framework.
+ */
+ public ScanManagerConfig() {
+ this(null,true);
+ }
+
+ /**
+ * Creates a new instance of ScanManagerConfig.
+ * @param name The name of the configuration which usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ **/
+ public ScanManagerConfig(String name) {
+ this(name,false);
+ }
+
+ // Our private constructor...
+ private ScanManagerConfig(String name, boolean allowsNull) {
+ if (name == null && allowsNull==false)
+ throw new IllegalArgumentException("name=null");
+ this.name = name;
+ directoryScanners = new LinkedHashMap<String,DirectoryScannerConfig>();
+ this.initialResultLogConfig = new ResultLogConfig();
+ this.initialResultLogConfig.setMemoryMaxRecords(1024);
+ }
+
+ // Creates an array for deep equality.
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ name,directoryScanners,initialResultLogConfig
+ };
+ return thisconfig;
+ }
+
+ // equals
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof ScanManagerConfig)) return false;
+ final ScanManagerConfig other = (ScanManagerConfig)o;
+ if (this.directoryScanners.size() != other.directoryScanners.size())
+ return false;
+ return Arrays.deepEquals(toArray(),other.toArray());
+ }
+
+ @Override
+ public int hashCode() {
+ final String key = name;
+ if (key == null) return 0;
+ else return key.hashCode();
+ }
+
+ /**
+ * Gets the name of this configuration. The name of the configuration
+ * usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ * @return The name of this configuration.
+ */
+ @XmlAttribute(name="name",required=true)
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Sets the name of this configuration. The name of the configuration
+ * usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ * <p>Once set this value cannot change.</p>
+ * @param name The name of this configuration.
+ */
+ public void setName(String name) {
+ if (this.name == null)
+ this.name = name;
+ else if (name == null)
+ throw new IllegalArgumentException("name=null");
+ else if (!name.equals(this.name))
+ throw new IllegalArgumentException("name="+name);
+ }
+
+ /**
+ * Gets the list of Directory Scanner configured by this
+ * configuration. From each element in this list, the
+ * {@link com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean}
+ * will create, initialize, and register a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean}.
+ * @return The list of Directory Scanner configured by this configuration.
+ */
+ @XmlElementWrapper(name="DirectoryScannerList",
+ namespace=XmlConfigUtils.NAMESPACE)
+ @XmlElementRef
+ public DirectoryScannerConfig[] getScanList() {
+ return directoryScanners.values().toArray(new DirectoryScannerConfig[0]);
+ }
+
+ /**
+ * Sets the list of Directory Scanner configured by this
+ * configuration. From each element in this list, the
+ * {@link com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean}
+ * will create, initialize, and register a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean}.
+ * @param scans The list of Directory Scanner configured by this configuration.
+ */
+ public void setScanList(DirectoryScannerConfig[] scans) {
+ directoryScanners.clear();
+ for (DirectoryScannerConfig scan : scans)
+ directoryScanners.put(scan.getName(),scan);
+ }
+
+ /**
+ * Get a directory scanner by its name.
+ *
+ * @param name The name of the directory scanner. This is the
+ * value returned by {@link
+ * DirectoryScannerConfig#getName()}.
+ * @return The named {@code DirectoryScannerConfig}
+ */
+ public DirectoryScannerConfig getScan(String name) {
+ return directoryScanners.get(name);
+ }
+
+ /**
+ * Adds a directory scanner to the list.
+ * <p>If a directory scanner
+ * configuration by that name already exists in the list, it will
+ * be replaced by the given <var>scan</var>.
+ * </p>
+ * @param scan The {@code DirectoryScannerConfig} to add to the list.
+ * @return The replaced {@code DirectoryScannerConfig}, or {@code null}
+ * if there was no {@code DirectoryScannerConfig} by that name
+ * in the list.
+ */
+ public DirectoryScannerConfig putScan(DirectoryScannerConfig scan) {
+ return this.directoryScanners.put(scan.getName(),scan);
+ }
+
+ // XML value of this object.
+ public String toString() {
+ return XmlConfigUtils.toString(this);
+ }
+
+ /**
+ * Removes the named directory scanner from the list.
+ *
+ * @param name The name of the directory scanner. This is the
+ * value returned by {@link
+ * DirectoryScannerConfig#getName()}.
+ * @return The removed {@code DirectoryScannerConfig}, or {@code null}
+ * if there was no directory scanner by that name in the list.
+ */
+ public DirectoryScannerConfig removeScan(String name) {
+ return this.directoryScanners.remove(name);
+ }
+
+ /**
+ * Gets the initial Result Log Configuration.
+ * @return The initial Result Log Configuration.
+ */
+ @XmlElement(name="InitialResultLogConfig",namespace=XmlConfigUtils.NAMESPACE)
+ public ResultLogConfig getInitialResultLogConfig() {
+ return this.initialResultLogConfig;
+ }
+
+ /**
+ * Sets the initial Result Log Configuration.
+ * @param initialLogConfig The initial Result Log Configuration.
+ */
+ public void setInitialResultLogConfig(ResultLogConfig initialLogConfig) {
+ this.initialResultLogConfig = initialLogConfig;
+ }
+
+ /**
+ * Creates a copy of this object, with the specified name.
+ * @param newname the name of the copy.
+ * @return A copy of this object.
+ **/
+ public ScanManagerConfig copy(String newname) {
+ return copy(newname,this);
+ }
+
+ // Copy by XML cloning, then change the name.
+ //
+ private static ScanManagerConfig
+ copy(String newname, ScanManagerConfig other) {
+ ScanManagerConfig newbean = XmlConfigUtils.xmlClone(other);
+ newbean.name = newname;
+ return newbean;
+ }
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java
new file mode 100644
index 0000000..a3e663d
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Logger;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+/**
+ * The class XmlConfigUtils is used to deal with XML serialization
+ * and XML files.
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class XmlConfigUtils {
+
+ /**
+ * A URI for our XML configuration namespace. This doesn't start with
+ * http:// because we are not going to publish this private schema
+ * anywhere.
+ **/
+ public static final String NAMESPACE =
+ "jmx:com.sun.jmx.examples.scandir.config";
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(XmlConfigUtils.class.getName());
+
+ // Our JAXBContext.
+ private static JAXBContext context;
+
+ // The file name of the XML file in which an instance of this object
+ // will read and write XML data.
+ final String file;
+
+ /**
+ * Creates a new instance of XmlConfigUtils.
+ * @param file The file name of the XML file in which an instance of this
+ * object will read and write XML data.
+ */
+ public XmlConfigUtils(String file) {
+ this.file = file;
+ }
+
+ /**
+ * Write the given bean to the XML file.
+ * <p>
+ * Performs an atomic write, first writing in {@code <file>.new}, then
+ * renaming {@code <file>} to {@code <file>~}, then renaming
+ * renaming {@code <file>.new} to {@code <file>}.
+ * </p>
+ * @param bean The configuration to write in the XML file.
+ * @throws IOException if write to file failed.
+ **/
+ public synchronized void writeToFile(ScanManagerConfig bean)
+ throws IOException {
+
+ // Creates a new file named <file>.new
+ final File f = newXmlTmpFile(file);
+ try {
+ final FileOutputStream out = new FileOutputStream(f);
+ boolean failed = true;
+ try {
+ // writes to <file>.new
+ write(bean,out,false);
+
+ // no exception: set failed=false for finaly {} block.
+ failed = false;
+ } finally {
+ out.close();
+ // An exception was raised: delete temporary file.
+ if (failed == true) f.delete();
+ }
+
+ // rename <file> to <file>~ and <file>.new to <file>
+ commit(file,f);
+ } catch (JAXBException x) {
+ final IOException io =
+ new IOException("Failed to write SessionConfigBean to " +
+ file+": "+x,x);
+ throw io;
+ }
+ }
+
+ /**
+ * Creates an XML string representation of the given bean.
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XMLbinding context.
+ * @return An XML string representation of the given bean.
+ **/
+ public static String toString(Object bean) {
+ try {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final Marshaller m = createMarshaller();
+ m.setProperty(m.JAXB_FRAGMENT,Boolean.TRUE);
+ m.marshal(bean, baos);
+ return baos.toString();
+ } catch (JAXBException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException(
+ "Failed to write SessionConfigBean: "+x,x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Creates an XML clone of the given bean.
+ * <p>
+ * In other words, this method XML-serializes the given bean, and
+ * XML-deserializes a copy of that bean.
+ * </p>
+ * @return A deep-clone of the given bean.
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XML binding context.
+ * @param bean The bean to clone.
+ */
+ public static ScanManagerConfig xmlClone(ScanManagerConfig bean) {
+ final Object clone = copy(bean);
+ return (ScanManagerConfig)clone;
+ }
+
+ /**
+ * Creates an XML clone of the given bean.
+ * <p>
+ * In other words, this method XML-serializes the given bean, and
+ * XML-deserializes a copy of that bean.
+ * </p>
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XML binding context.
+ * @return A deep-clone of the given bean.
+ **/
+ private static Object copy(Object bean) {
+ try {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final Marshaller m = createMarshaller();
+ m.marshal(bean, baos);
+ final ByteArrayInputStream bais =
+ new ByteArrayInputStream(baos.toByteArray());
+ return createUnmarshaller().unmarshal(bais);
+ } catch (JAXBException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException("Failed to write SessionConfigBean: "+x,x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Creates an XML clone of the given bean.
+ * <p>
+ * In other words, this method XML-serializes the given bean, and
+ * XML-deserializes a copy of that bean.
+ * </p>
+ * @return A deep-clone of the given bean.
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XML binding context.
+ * @param bean The bean to clone.
+ */
+ public static DirectoryScannerConfig xmlClone(DirectoryScannerConfig bean) {
+ final Object clone = copy(bean);
+ return (DirectoryScannerConfig)clone;
+ }
+
+ /**
+ * Reads the configuration from the XML configuration file.
+ * @throws IOException if it fails to read the configuration.
+ * @return A {@code ScanManagerConfig} bean read from the
+ * XML configuration file.
+ **/
+ public synchronized ScanManagerConfig readFromFile() throws IOException {
+ final File f = new File(file);
+ if (!f.exists())
+ throw new IOException("No such file: "+file);
+ if (!f.canRead())
+ throw new IOException("Can't read file: "+file);
+ try {
+ return read(f);
+ } catch (JAXBException x) {
+ final IOException io =
+ new IOException("Failed to read SessionConfigBean from " +
+ file+": "+x,x);
+ throw io;
+ }
+ }
+
+ /**
+ * Reads the configuration from the given XML configuration file.
+ * @param f the file to read from.
+ * @return A {@code ScanManagerConfig} bean read from the
+ * XML configuration file.
+ * @throws javax.xml.bind.JAXBException if it fails to read the configuration.
+ */
+ public static ScanManagerConfig read(File f)
+ throws JAXBException {
+ final Unmarshaller u = createUnmarshaller();
+ return (ScanManagerConfig) u.unmarshal(f);
+
+ }
+
+ /**
+ * Writes the given bean to the given output stream.
+ * @param bean the bean to write.
+ * @param os the output stream to write to.
+ * @param fragment whether the {@code <?xml ... ?>} header should be
+ * included. The header is not included if the bean is just an
+ * XML fragment encapsulated in a higher level XML element.
+ * @throws JAXBException An XML Binding exception occurred.
+ **/
+ public static void write(ScanManagerConfig bean, OutputStream os,
+ boolean fragment)
+ throws JAXBException {
+ writeXml((Object)bean,os,fragment);
+ }
+
+ /**
+ * Writes the given bean to the given output stream.
+ * @param bean the bean to write.
+ * @param os the output stream to write to.
+ * @param fragment whether the {@code <?xml ... ?>} header should be
+ * included. The header is not included if the bean is just an
+ * XML fragment encapsulated in a higher level XML element.
+ * @throws JAXBException An XML Binding exception occurred.
+ **/
+ public static void write(ResultRecord bean, OutputStream os, boolean fragment)
+ throws JAXBException {
+ writeXml((Object)bean,os,fragment);
+ }
+
+ /**
+ * Writes the given bean to the given output stream.
+ * @param bean the bean to write.
+ * @param os the output stream to write to.
+ * @param fragment whether the {@code <?xml ... ?>} header should be
+ * included. The header is not included if the bean is just an
+ * XML fragment encapsulated in a higher level XML element.
+ * @throws JAXBException An XML Binding exception occurred.
+ **/
+ private static void writeXml(Object bean, OutputStream os, boolean fragment)
+ throws JAXBException {
+ final Marshaller m = createMarshaller();
+ if (fragment) m.setProperty(m.JAXB_FRAGMENT,Boolean.TRUE);
+ m.marshal(bean,os);
+ }
+
+ // Creates a JAXB Unmarshaller.
+ private static Unmarshaller createUnmarshaller() throws JAXBException {
+ return getContext().createUnmarshaller();
+ }
+
+ // Creates a JAXB Marshaller - for nicely XML formatted output.
+ private static Marshaller createMarshaller() throws JAXBException {
+ final Marshaller m = getContext().createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
+ return m;
+ }
+
+ // Creates a JAXBContext if needed, and returns it.
+ // The JAXBContext instance we create will be able to handle the
+ // ScanManagerConfig and ResultRecord classes, plus all the property
+ // classes they reference (DirectoryScannerBean etc...).
+ //
+ private static synchronized JAXBContext getContext() throws JAXBException {
+ if (context == null)
+ context = JAXBContext.newInstance(ScanManagerConfig.class,
+ ResultRecord.class);
+ return context;
+ }
+
+
+ // Creates a new XML temporary file called <basename>.new
+ // This method is used to implement atomic writing to file.
+ // The usual sequence is:
+ //
+ // Final tmp = newXmlTmpFile(basename);
+ // boolean failed = true;
+ // try {
+ // ... write to 'tmp' ...
+ // // no exception: set failed=false for finaly {} block.
+ // failed = false;
+ // } finally
+ // // failed==true means there was an exception and
+ // // commit won't be called...
+ // if (failed==true) tmp.delete();
+ // }
+ // commit(tmp,basename)
+ //
+ private static File newXmlTmpFile(String basename) throws IOException {
+ final File f = new File(basename+".new");
+ if (!f.createNewFile())
+ throw new IOException("file "+f.getName()+" already exists");
+
+ try {
+ final OutputStream newStream = new FileOutputStream(f);
+ try {
+ final String decl =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
+ newStream.write(decl.getBytes("UTF-8"));
+ newStream.flush();
+ } finally {
+ newStream.close();
+ }
+ } catch (IOException x) {
+ f.delete();
+ throw x;
+ }
+ return f;
+ }
+
+ // Commit the temporary file by renaming <basename> to <baesname>~
+ // and tmpFile to <basename>.
+ private static File commit(String basename, File tmpFile)
+ throws IOException {
+ try {
+ final String backupName = basename+"~";
+ final File desired = new File(basename);
+ final File backup = new File(backupName);
+ backup.delete();
+ if (desired.exists()) {
+ if (!desired.renameTo(new File(backupName)))
+ throw new IOException("can't rename to "+backupName);
+ }
+ if (!tmpFile.renameTo(new File(basename)))
+ throw new IOException("can't rename to "+basename);
+ } catch (IOException x) {
+ tmpFile.delete();
+ throw x;
+ }
+ return new File(basename);
+ }
+
+ /**
+ * Creates a new committed XML file for {@code <basename>}, containing only
+ * the {@code <?xml ...?>} header.
+ * <p>This method will rename {@code <basename>} to {@code <basename>~},
+ * if it exists.
+ * </p>
+ * @return A newly created XML file containing the regular
+ * {@code <?xml ...?>} header.
+ * @param basename The name of the new file.
+ * @throws IOException if the new XML file couldn't be created.
+ */
+ public static File createNewXmlFile(String basename) throws IOException {
+ return commit(basename,newXmlTmpFile(basename));
+ }
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html
new file mode 100644
index 0000000..5390c29
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+ <head>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+ <title>com.sun.jmx.examples.scandir.config</title>
+ </head>
+ <body>
+ <p>
+ This package defines plain Java Beans, annotated for
+ XML bindings, and used to store and model the scandir
+ application configuration.
+ </p>
+ <p>All the Java Beans defined in this package have been
+ designed to be <i>naturally serialized</i> by JAXB.
+ Their bean properties were designed to minimize
+ the number of XML annotation required, as well as
+ making them transparently convertible by the
+ JMX MXBean framework.
+ </p>
+ <p>The {@link com.sun.jmx.examples.scandir.config.ScanManagerConfig}
+ bean corresponds to the root element of the application's configuration.
+ From an instance of this element, the
+ {@link com.sun.jmx.examples.scandir.ScanManagerMXBean} will be
+ able to initialize the
+ {@link com.sun.jmx.examples.scandir.ResultLogManagerMXBean} and will
+ create, register and initialize
+ {@link com.sun.jmx.examples.scandir.DirectoryScannerMXBean DirectoryScannerMXBeans}
+ </p>
+ <p>The {@link com.sun.jmx.examples.scandir.config.XmlConfigUtils} class is a simple utility
+ classes used to deal with XML and XML configuration files.
+ </p>
+ <p>The {@link com.sun.jmx.examples.scandir.config.ResultRecord ResultRecords}
+ are used to store the results of directory scans in the result logs
+ managed by the {@link com.sun.jmx.examples.scandir.ResultLogManagerMXBean}
+ </p>
+ </body>
+</html>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html
new file mode 100644
index 0000000..54d3172
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+ <head>
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+ <title>com.sun.jmx.examples.scandir</title>
+ </head>
+ <body>
+ <p>
+ This package defines the set of MBeans which compose the
+ management interface of the scandir application.
+ </p>
+
+ </body>
+</html>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/access.properties b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/access.properties
new file mode 100644
index 0000000..c8286ed
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/access.properties
@@ -0,0 +1,51 @@
+######################################################################
+# Default Access Control File for Remote JMX(TM) Monitoring
+######################################################################
+#
+# Access control file for Remote JMX API access to monitoring.
+# This file defines the allowed access for different roles. The
+# password file (jmxremote.password by default) defines the roles and their
+# passwords. To be functional, a role must have an entry in
+# both the password and the access files.
+#
+# Default location of this file is $JRE/lib/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# (See that file for details)
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# Typical access file has multiple lines, where each line is blank,
+# a comment (like this one), or an access control entry.
+#
+# An access control entry consists of a role name, and an
+# associated access level. The role name is any string that does not
+# itself contain spaces or tabs. It corresponds to an entry in the
+# password file (jmxremote.password). The access level is one of the
+# following:
+# "readonly" grants access to read attributes of MBeans.
+# For monitoring, this means that a remote client in this
+# role can read measurements but cannot perform any action
+# that changes the environment of the running program.
+# "readwrite" grants access to read and write attributes of MBeans,
+# to invoke operations on them, and to create or remove them.
+# This access should be granted to only trusted clients,
+# since they can potentially interfere with the smooth
+# operation of a running program
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last
+# access entry is used.
+#
+#
+# Default access control entries:
+# o The "monitorRole" role has readonly access.
+# o The "controlRole" role has readwrite access.
+#
+# monitorRole readonly
+# controlRole readwrite
+
+guest readonly
+admin readwrite
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/management.properties b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/management.properties
new file mode 100644
index 0000000..5035139
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/management.properties
@@ -0,0 +1,273 @@
+#####################################################################
+# Default Configuration File for Java Platform Management
+#####################################################################
+#
+# The Management Configuration file (in java.util.Properties format)
+# will be read if one of the following system properties is set:
+# -Dcom.sun.management.jmxremote.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.config.file=<this-file>
+#
+# The default Management Configuration file is:
+#
+# $JRE/lib/management/management.properties
+#
+# Another location for the Management Configuration File can be specified
+# by the following property on the Java command line:
+#
+# -Dcom.sun.management.config.file=<this-file>
+#
+# If -Dcom.sun.management.config.file=<this-file> is set, the port
+# number for the management agent can be specified in the config file
+# using the following lines:
+#
+# ################ Management Agent Port #########################
+#
+# For setting the JMX RMI agent port use the following line
+com.sun.management.jmxremote.port=4545
+#
+# For setting the SNMP agent port use the following line
+# com.sun.management.snmp.port=<port-number>
+
+#####################################################################
+# Optional Instrumentation
+#####################################################################
+#
+# By default only the basic instrumentation with low overhead is on.
+# The following properties allow to selectively turn on optional
+# instrumentation which are off by default and may have some
+# additional overhead.
+#
+# com.sun.management.enableThreadContentionMonitoring
+#
+# This option enables thread contention monitoring if the
+# Java virtual machine supports such instrumentation.
+# Refer to the specification for the java.lang.management.ThreadMBean
+# interface - see isThreadContentionMonitoringSupported() method.
+#
+
+# To enable thread contention monitoring, uncomment the following line
+# com.sun.management.enableThreadContentionMonitoring
+
+#####################################################################
+# SNMP Management Properties
+#####################################################################
+#
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# is set then
+# - The SNMP agent (with the Java virtual machine MIB) is started
+# that listens on the specified port for incoming SNMP requests.
+# - the following properties for read for SNMP management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to the above system property (e.g. via setProperty method), this
+# config file, or the ACL file has no effect to the running SNMP agent.
+#
+
+#
+# ##################### SNMP Trap Port #########################
+#
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+# Specifies the remote port number at which managers are expected
+# to listen for trap. For each host defined in the ACL file,
+# the SNMP agent will send traps at <host>:<trap-destination-port-number>
+# Default for this property is 162.
+#
+
+# To set port for sending traps to a different port use the following line
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+
+#
+# ################ SNMP listen interface #########################
+#
+# com.sun.management.snmp.interface=<InetAddress>
+# Specifies the local interface on which the SNMP agent will bind.
+# This is usefull when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+# Default for this property is "localhost".
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
+
+# For restricting the port on which SNMP agent listens use the following line
+# com.sun.management.snmp.interface=<InetAddress>
+
+#
+# #################### SNMP ACL file #########################
+#
+# com.sun.management.snmp.acl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then the ACL file
+# is not checked: all manager hosts are allowed all access.
+#
+
+# For SNMP without checking ACL file uncomment the following line
+# com.sun.management.snmp.acl=false
+
+#
+# com.sun.management.snmp.acl.file=filepath
+# Specifies location for ACL file
+# This is optional - default location is
+# $JRE/lib/management/snmp.acl
+#
+# If the property "com.sun.management.snmp.acl" is set to false,
+# then this property and the ACL file are ignored.
+# Otherwise the ACL file must exist and be in the valid format.
+# If the ACL file is empty or non existent then no access is allowed.
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
+# agents which read that ACL file at startup.
+#
+
+# For a non-default acl file location use the following line
+# com.sun.management.snmp.acl.file=filepath
+
+#####################################################################
+# RMI Management Properties
+#####################################################################
+#
+# If system property -Dcom.sun.management.jmxremote.port=<port-number>
+# is set then
+# - A MBean server is started
+# - JRE Platform MBeans are registered in the MBean server
+# - RMI connector is published in a private readonly registry at
+# specified port using a well known name, "jmxrmi"
+# - the following properties are read for JMX remote management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to above system property (e.g. via setProperty method),
+# this config file, the password file, or the access file have no effect to the
+# running MBean server, the connector, or the registry.
+#
+
+#
+# ###################### RMI SSL #############################
+#
+# com.sun.management.jmxremote.ssl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then SSL is not used.
+#
+
+# For RMI monitoring without SSL use the following line
+# com.sun.management.jmxremote.ssl=false
+
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites=<cipher-suites>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS cipher suites to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS cipher suites are enabled
+# for use by accepted connections. If this property is not specified then
+# the SSL/TLS RMI Server Socket Factory uses the SSL/TLS cipher suites that
+# are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.enabled.protocols=<protocol-versions>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS protocol versions to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS protocol versions are
+# enabled for use by accepted connections. If this property is not
+# specified then the SSL/TLS RMI Server Socket Factory uses the SSL/TLS
+# protocol versions that are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.need.client.auth=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true in conjunction with the previous
+# property "com.sun.management.jmxremote.ssl" then the SSL/TLS RMI Server
+# Socket Factory will require client authentication.
+#
+
+# For RMI monitoring with SSL client authentication use the following line
+com.sun.management.jmxremote.ssl.need.client.auth=true
+
+# com.sun.management.jmxremote.registry.ssl=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true then the RMI registry used
+# to bind the RMIServer remote object is protected with SSL/TLS
+# RMI Socket Factories that can be configured with the properties:
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites
+# com.sun.management.jmxremote.ssl.enabled.protocols
+# com.sun.management.jmxremote.ssl.need.client.auth
+# If the two properties below are true at the same time, i.e.
+# com.sun.management.jmxremote.ssl=true
+# com.sun.management.jmxremote.registry.ssl=true
+# then the RMIServer remote object and the RMI registry are
+# both exported with the same SSL/TLS RMI Socket Factories.
+#
+
+# For using an SSL/TLS protected RMI registry use the following line
+com.sun.management.jmxremote.registry.ssl=true
+
+#
+# ################ RMI User authentication ################
+#
+# com.sun.management.jmxremote.authenticate=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then no authentication is
+# performed and all users are allowed all access.
+#
+
+# For RMI monitoring without any checking use the following line
+# com.sun.management.jmxremote.authenticate=false
+
+#
+# ################ RMI Login configuration ###################
+#
+# com.sun.management.jmxremote.login.config=<config-name>
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
+#
+# Setting this property is optional - the default login configuration
+# specifies a file-based authentication that uses the password file.
+#
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
+# by JAAS. In addition, the login module(s) specified in the configuration
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
+# javax.security.auth.callback package for more details.
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+#
+
+# For a non-default login configuration use the following line
+# com.sun.management.jmxremote.login.config=<config-name>
+
+#
+# ################ RMI Password file location ##################
+#
+# com.sun.management.jmxremote.password.file=filepath
+# Specifies location for password file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise the password file must exist and be in the valid format.
+# If the password file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+com.sun.management.jmxremote.password.file=src/etc/password.properties
+
+#
+# ################ RMI Access file location #####################
+#
+# com.sun.management.jmxremote.access.file=filepath
+# Specifies location for access file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise, the access file must exist and be in the valid format.
+# If the access file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+com.sun.management.jmxremote.access.file=src/etc/access.properties
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/password.properties b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/password.properties
new file mode 100644
index 0000000..d90c8c8
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/password.properties
@@ -0,0 +1,55 @@
+##############################################################
+# Password File for Remote JMX Monitoring
+##############################################################
+#
+# Password file for Remote JMX API access to monitoring. This
+# file defines the different roles and their passwords. The access
+# control file (jmxremote.access by default) defines the allowed
+# access for each role. To be functional, a role must have an entry
+# in both the password and the access files.
+#
+# Default location of this file is $JRE/lib/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# or by specifying a system property (See that file for details).
+
+
+##############################################################
+# File permissions of the jmxremote.password file
+##############################################################
+# Since there are cleartext passwords stored in this file,
+# this file must be readable by ONLY the owner,
+# otherwise the program will exit with an error.
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# Typical password file has multiple lines, where each line is blank,
+# a comment (like this one), or a password entry.
+#
+#
+# A password entry consists of a role name and an associated
+# password. The role name is any string that does not itself contain
+# spaces or tabs. The password is again any string that does not
+# contain spaces or tabs. Note that passwords appear in the clear in
+# this file, so it is a good idea not to use valuable passwords.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last one
+# is used.
+#
+# In a typical installation, this file can be read by anybody on the
+# local machine, and possibly by people on other machines.
+# For # security, you should either restrict the access to this file,
+# or specify another, less accessible file in the management config file
+# as described above.
+#
+# Following are two commented-out entries. The "measureRole" role has
+# password "QED". The "controlRole" role has password "R&D".
+#
+# monitorRole QED
+# controlRole R&D
+
+guest guestpasswd
+admin adminpasswd
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml
new file mode 100644
index 0000000..cf0fece
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<ScanManager xmlns="jmx:com.sun.jmx.examples.scandir.config" name="testconfig">
+ <InitialResultLogConfig>
+ <LogFileMaxRecords>2048</LogFileMaxRecords>
+ <LogFileName>build/scandir.log</LogFileName>
+ <MemoryMaxRecords>128</MemoryMaxRecords>
+ </InitialResultLogConfig>
+ <DirectoryScannerList>
+ <DirectoryScanner name="scan-build">
+ <Actions>NOTIFY LOGRESULT</Actions>
+ <ExcludeFiles/>
+ <IncludeFiles>
+ <FileFilter>
+ <FilePattern>.*\.class</FilePattern>
+ <SizeExceedsMaxBytes>4096</SizeExceedsMaxBytes>
+ </FileFilter>
+ </IncludeFiles>
+ <RootDirectory>build</RootDirectory>
+ </DirectoryScanner>
+ </DirectoryScannerList>
+</ScanManager>
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java
new file mode 100644
index 0000000..06d1559
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.util.LinkedList;
+import java.util.concurrent.BlockingQueue;
+import junit.framework.*;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import com.sun.jmx.examples.scandir.ScanManagerTest.Call;
+import java.util.EnumSet;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import javax.management.AttributeChangeNotification;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+
+import static com.sun.jmx.examples.scandir.ScanManagerTest.*;
+import static com.sun.jmx.examples.scandir.TestUtils.*;
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.util.List;
+
+/**
+ * Unit tests for {@code DirectoryScanner}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class DirectoryScannerTest extends TestCase {
+
+ public DirectoryScannerTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(DirectoryScannerTest.class);
+
+ return suite;
+ }
+
+ private void doTestOperation(
+ DirectoryScannerMXBean proxy,
+ Call op,
+ EnumSet<ScanState> after,
+ String testName)
+ throws Exception {
+ System.out.println("doTestOperation: "+testName);
+
+ final LinkedBlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+
+ NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ queue.put(notification);
+ } catch (Exception x) {
+ System.err.println("Failed to queue notif: "+x);
+ }
+ }
+ };
+ NotificationFilter filter = null;
+ Object handback = null;
+ final ScanState before;
+ final NotificationEmitter emitter = (NotificationEmitter)
+ makeNotificationEmitter(proxy,DirectoryScannerMXBean.class);
+ emitter.addNotificationListener(listener, filter, handback);
+ before = proxy.getState();
+ op.call();
+ try {
+ final Notification notification =
+ queue.poll(3000,TimeUnit.MILLISECONDS);
+ assertEquals(AttributeChangeNotification.ATTRIBUTE_CHANGE,
+ notification.getType());
+ assertEquals(AttributeChangeNotification.class,
+ notification.getClass());
+ assertEquals(getObjectName(proxy),
+ notification.getSource());
+ AttributeChangeNotification acn =
+ (AttributeChangeNotification)notification;
+ assertEquals("State",acn.getAttributeName());
+ assertEquals(ScanState.class.getName(),acn.getAttributeType());
+ assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
+ assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
+ emitter.removeNotificationListener(listener,filter,handback);
+ } finally {
+ try {
+ op.cancel();
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+
+ /**
+ * Test of getRootDirectory method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testGetRootDirectory() throws Exception {
+ System.out.println("getRootDirectory");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ final String tmpdir = System.getProperty("java.io.tmpdir");
+ final ScanDirConfigMXBean config = manager.getConfigurationMBean();
+ System.err.println("Configuration MXBean is: " + config);
+ final DirectoryScannerConfig bean =
+ config.addDirectoryScanner("test",tmpdir,".*",0,0);
+ final String root = bean.getRootDirectory();
+ if (root == null)
+ throw new NullPointerException("bean.getRootDirectory()");
+ if (config.getConfiguration().getScan("test").getRootDirectory() == null)
+ throw new NullPointerException("config.getConfig().getScan(\"test\").getRootDirectory()");
+ manager.applyConfiguration(true);
+ final DirectoryScannerMXBean proxy =
+ manager.getDirectoryScanners().get("test");
+ final File tmpFile = new File(tmpdir);
+ final File rootFile = new File(proxy.getRootDirectory());
+ assertEquals(tmpFile,rootFile);
+ } catch (Exception x) {
+ x.printStackTrace();
+ throw x;
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+
+ /**
+ * Test of scan method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testScan() throws Exception {
+ System.out.println("scan");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ final String tmpdir = System.getProperty("java.io.tmpdir");
+ final ScanDirConfigMXBean config = manager.getConfigurationMBean();
+ final DirectoryScannerConfig bean =
+ config.addDirectoryScanner("test1",tmpdir,".*",0,0);
+ config.addDirectoryScanner("test2",tmpdir,".*",0,0);
+ config.addDirectoryScanner("test3",tmpdir,".*",0,0);
+ manager.applyConfiguration(true);
+ final DirectoryScannerMXBean proxy =
+ manager.getDirectoryScanners().get("test1");
+ final Call op = new Call() {
+ public void call() throws Exception {
+ final BlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+ final NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ queue.put(notification);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+ manager.start();
+ while(true) {
+ final Notification n = queue.poll(10,TimeUnit.SECONDS);
+ if (n == null) break;
+ final AttributeChangeNotification at =
+ (AttributeChangeNotification) n;
+ if (RUNNING == ScanState.valueOf((String)at.getNewValue()))
+ break;
+ else {
+ System.err.println("New state: "+(String)at.getNewValue()
+ +" isn't "+RUNNING);
+ }
+ }
+ assertContained(EnumSet.of(SCHEDULED,RUNNING,COMPLETED),
+ proxy.getState());
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ doTestOperation(proxy,op,
+ EnumSet.of(RUNNING,SCHEDULED,COMPLETED),
+ "scan");
+ } catch (Exception x) {
+ x.printStackTrace();
+ throw x;
+ } finally {
+ try {
+ manager.stop();
+ } catch (Exception x) {
+ System.err.println("Failed to stop: "+x);
+ }
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of getState method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testGetState() {
+ System.out.println("getState");
+
+ final DirectoryScannerConfig bean =
+ new DirectoryScannerConfig("test");
+ bean.setRootDirectory(System.getProperty("java.io.tmpdir"));
+ final ResultLogManager log = new ResultLogManager();
+ DirectoryScanner instance =
+ new DirectoryScanner(bean,log);
+
+ ScanState expResult = STOPPED;
+ ScanState result = instance.getState();
+ assertEquals(STOPPED, result);
+ instance.scan();
+ result = instance.getState();
+ assertEquals(COMPLETED, result);
+ }
+
+ /**
+ * Test of addNotificationListener method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testAddNotificationListener() throws Exception {
+ System.out.println("addNotificationListener");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.start();
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ try {
+ final String tmpdir = System.getProperty("java.io.tmpdir");
+ final ScanDirConfigMXBean config = manager.getConfigurationMBean();
+ final DirectoryScannerConfig bean =
+ config.addDirectoryScanner("test1",tmpdir,".*",0,0);
+ manager.applyConfiguration(true);
+ final DirectoryScannerMXBean proxy =
+ manager.getDirectoryScanners().get("test1");
+ doTestOperation(proxy,op,
+ EnumSet.of(RUNNING,SCHEDULED),
+ "scan");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java
new file mode 100644
index 0000000..c7e9599
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.FileMatch;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import junit.framework.*;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.File;
+import java.util.concurrent.BlockingQueue;
+import javax.management.*;
+
+/**
+ * Unit tests for {@code ScanDirConfig}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanDirConfigTest extends TestCase {
+
+ public ScanDirConfigTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ScanDirConfigTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testLoad() throws Exception {
+ System.out.println("load");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testLoad");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ bean.putScan(dir);
+ XmlConfigUtils.write(bean,new FileOutputStream(file),false);
+ instance.load();
+
+ assertEquals(bean,instance.getConfiguration());
+ bean.removeScan(dir.getName());
+ XmlConfigUtils.write(bean,new FileOutputStream(file),false);
+
+ assertNotSame(bean,instance.getConfiguration());
+
+ instance.load();
+
+ assertEquals(bean,instance.getConfiguration());
+
+ }
+
+ /**
+ * Test of save method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testSave() throws Exception {
+ System.out.println("save");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ final ScanManagerMXBean manager = ScanManager.register(mbs);
+
+ try {
+ final ScanDirConfigMXBean instance =
+ manager.createOtherConfigurationMBean("testSave",file.getAbsolutePath());
+ assertTrue(mbs.isRegistered(
+ ScanManager.makeScanDirConfigName("testSave")));
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testSave");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ bean.putScan(dir);
+ instance.setConfiguration(bean);
+ instance.save();
+ final ScanManagerConfig loaded =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded);
+ assertEquals(bean,loaded);
+
+ instance.getConfiguration().removeScan("tmp");
+ instance.save();
+ assertNotSame(loaded,instance.getConfiguration());
+ final ScanManagerConfig loaded2 =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded2);
+ } finally {
+ manager.close();
+ mbs.unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ }
+ final ObjectName all =
+ new ObjectName(ScanManager.SCAN_MANAGER_NAME.getDomain()+":*");
+ assertEquals(0,mbs.queryNames(all,null).size());
+ }
+
+ /**
+ * Test of saveTo method, of class com.sun.jmx.examples.scandir.ScanProfile.
+ */
+ /*
+ public void testSaveTo() throws Exception {
+ System.out.println("saveTo");
+
+ String filename = "";
+ ScanDirConfig instance = null;
+
+ instance.saveTo(filename);
+
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+ */
+
+ /**
+ * Test of getXmlConfigString method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testGetXmlConfigString() throws Exception {
+ System.out.println("getXmlConfigString");
+
+ try {
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testGetXmlConfigString");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ bean.putScan(dir);
+ instance.setConfiguration(bean);
+ System.out.println("Expected: " + XmlConfigUtils.toString(bean));
+ System.out.println("Received: " +
+ instance.getConfiguration().toString());
+ assertEquals(XmlConfigUtils.toString(bean),
+ instance.getConfiguration().toString());
+ } catch (Exception x) {
+ x.printStackTrace();
+ throw x;
+ }
+ }
+
+
+ /**
+ * Test of addNotificationListener method, of class
+ * com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testAddNotificationListener() throws Exception {
+ System.out.println("addNotificationListener");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ final ScanManagerMXBean manager = ScanManager.register(mbs);
+
+ try {
+ final ScanDirConfigMXBean instance =
+ TestUtils.makeNotificationEmitter(
+ manager.createOtherConfigurationMBean("testSave",
+ file.getAbsolutePath()),
+ ScanDirConfigMXBean.class);
+ assertTrue(mbs.isRegistered(
+ ScanManager.makeScanDirConfigName("testSave")));
+ DirectoryScannerConfig dir =
+ instance.addDirectoryScanner("tmp",file.getParent(),".*",0,0);
+
+ final BlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+ final NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ queue.add(notification);
+ }
+ };
+ NotificationFilter filter = null;
+ Object handback = null;
+
+ ((NotificationEmitter)instance).addNotificationListener(listener,
+ filter, handback);
+
+ instance.save();
+ final ScanManagerConfig loaded =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded);
+
+ final ScanManagerConfig newConfig =
+ instance.getConfiguration();
+ newConfig.removeScan("tmp");
+ instance.setConfiguration(newConfig);
+ instance.save();
+ assertNotSame(loaded,instance.getConfiguration());
+ final ScanManagerConfig loaded2 =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded2);
+ instance.load();
+ for (int i=0;i<4;i++) {
+ final Notification n = queue.poll(3,TimeUnit.SECONDS);
+ assertNotNull(n);
+ assertEquals(TestUtils.getObjectName(instance),n.getSource());
+ switch(i) {
+ case 0: case 2:
+ assertEquals(ScanDirConfig.NOTIFICATION_SAVED,n.getType());
+ break;
+ case 1:
+ assertEquals(ScanDirConfig.NOTIFICATION_MODIFIED,n.getType());
+ break;
+ case 3:
+ assertEquals(ScanDirConfig.NOTIFICATION_LOADED,n.getType());
+ break;
+ default: break;
+ }
+ }
+ } finally {
+ manager.close();
+ mbs.unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ }
+ final ObjectName all =
+ new ObjectName(ScanManager.SCAN_MANAGER_NAME.getDomain()+":*");
+ assertEquals(0,mbs.queryNames(all,null).size());
+ }
+
+ /**
+ * Test of getConfigFilename method, of class
+ * com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testGetConfigFilename() throws Exception {
+ System.out.println("getConfigFilename");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+
+ String result = instance.getConfigFilename();
+ assertEquals(file.getAbsolutePath(), new File(result).getAbsolutePath());
+
+ }
+
+ /**
+ * Test of addDirectoryScanner method, of class
+ * com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testAddDirectoryScanner() throws IOException {
+ System.out.println("addDirectoryScanner");
+
+ System.out.println("save");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testSave");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ FileMatch filter = new FileMatch();
+ filter.setFilePattern(".*");
+ dir.setIncludeFiles(new FileMatch[] {
+ filter
+ });
+ instance.setConfiguration(bean);
+ instance.addDirectoryScanner(dir.getName(),
+ dir.getRootDirectory(),
+ filter.getFilePattern(),
+ filter.getSizeExceedsMaxBytes(),
+ 0);
+ instance.save();
+ final ScanManagerConfig loaded =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertNotNull(loaded.getScan(dir.getName()));
+ assertEquals(dir,loaded.getScan(dir.getName()));
+ assertEquals(instance.getConfiguration(),loaded);
+ assertEquals(instance.getConfiguration().getScan(dir.getName()),dir);
+ }
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java
new file mode 100644
index 0000000..94e3c98
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import javax.management.InstanceNotFoundException;
+import javax.management.Notification;
+import junit.framework.*;
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.logging.Logger;
+import javax.management.AttributeChangeNotification;
+import javax.management.JMException;
+import javax.management.JMX;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+
+/**
+ * Unit tests for {@code ScanManager}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanManagerTest extends TestCase {
+
+ public ScanManagerTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ScanManagerTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of makeSingletonName method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testMakeSingletonName() {
+ System.out.println("makeSingletonName");
+
+ Class clazz = ScanManagerMXBean.class;
+
+ ObjectName expResult = ScanManager.SCAN_MANAGER_NAME;
+ ObjectName result = ScanManager.makeSingletonName(clazz);
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of register method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testRegister() throws Exception {
+ System.out.println("register");
+
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+
+
+ ScanManagerMXBean result = ScanManager.register(mbs);
+ try {
+ assertEquals(STOPPED,result.getState());
+ } finally {
+ try {
+ mbs.unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+
+ }
+
+ public interface Call {
+ public void call() throws Exception;
+ public void cancel() throws Exception;
+ }
+
+ /**
+ * Test of addNotificationListener method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testAddNotificationListener() throws Exception {
+ System.out.println("addNotificationListener");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.schedule(100000,0);
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ try {
+ doTestOperation(manager,op,
+ EnumSet.of(RUNNING,SCHEDULED),
+ "schedule");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of addNotificationListener method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ private void doTestOperation(
+ ScanManagerMXBean proxy,
+ Call op,
+ EnumSet<ScanState> after,
+ String testName)
+ throws Exception {
+ System.out.println("doTestOperation: "+testName);
+
+ final LinkedBlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+
+ NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ queue.put(notification);
+ } catch (Exception x) {
+ System.err.println("Failed to queue notif: "+x);
+ }
+ }
+ };
+ NotificationFilter filter = null;
+ Object handback = null;
+ final ScanState before;
+ final NotificationEmitter emitter = (NotificationEmitter)proxy;
+ emitter.addNotificationListener(listener, filter, handback);
+ before = proxy.getState();
+ op.call();
+ try {
+ final Notification notification =
+ queue.poll(3000,TimeUnit.MILLISECONDS);
+ assertEquals(AttributeChangeNotification.ATTRIBUTE_CHANGE,
+ notification.getType());
+ assertEquals(AttributeChangeNotification.class,
+ notification.getClass());
+ assertEquals(ScanManager.SCAN_MANAGER_NAME,
+ notification.getSource());
+ AttributeChangeNotification acn =
+ (AttributeChangeNotification)notification;
+ assertEquals("State",acn.getAttributeName());
+ assertEquals(ScanState.class.getName(),acn.getAttributeType());
+ assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
+ assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
+ emitter.removeNotificationListener(listener,filter,handback);
+ } finally {
+ try {
+ op.cancel();
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of preRegister method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testPreRegister() throws Exception {
+ System.out.println("preRegister");
+
+ MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ ObjectName name = new ObjectName("DownUnder:type=Wombat");
+ ScanManager instance = new ScanManager();
+
+ ObjectName expResult = ScanManager.SCAN_MANAGER_NAME;
+ ObjectName result;
+ try {
+ result = instance.preRegister(server, name);
+ throw new RuntimeException("bad name accepted!");
+ } catch (IllegalArgumentException x) {
+ // OK!
+ result = instance.preRegister(server, null);
+ }
+ assertEquals(expResult, result);
+ result = instance.preRegister(server, ScanManager.SCAN_MANAGER_NAME);
+ assertEquals(expResult, result);
+ }
+
+
+ /**
+ * Test of getState method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testGetState() throws IOException, InstanceNotFoundException {
+ System.out.println("getState");
+
+ ScanManager instance = new ScanManager();
+
+ ScanState expResult = ScanState.STOPPED;
+ ScanState result = instance.getState();
+ assertEquals(expResult, result);
+ instance.start();
+ final ScanState afterStart = instance.getState();
+ assertContained(EnumSet.of(RUNNING,SCHEDULED,COMPLETED),afterStart);
+ instance.stop();
+ assertEquals(STOPPED,instance.getState());
+ instance.schedule(1000000L,1000000L);
+ assertEquals(SCHEDULED,instance.getState());
+ instance.stop();
+ assertEquals(STOPPED,instance.getState());
+ }
+
+ /**
+ * Test of schedule method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testSchedule() throws Exception {
+ System.out.println("schedule");
+
+ final long delay = 10000L;
+ final long interval = 10000L;
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.schedule(delay,interval);
+ assertEquals(SCHEDULED,manager.getState());
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ try {
+ doTestOperation(manager,op,EnumSet.of(SCHEDULED),
+ "schedule");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ public static void assertContained(EnumSet<ScanState> allowed,
+ ScanState state) {
+ final String msg = String.valueOf(state) + " is not one of " + allowed;
+ assertTrue(msg,allowed.contains(state));
+ }
+
+ /**
+ * Test of stop method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testStop() throws Exception {
+ System.out.println("stop");
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ manager.schedule(1000000,0);
+ assertContained(EnumSet.of(SCHEDULED),manager.getState());
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.stop();
+ assertEquals(STOPPED,manager.getState());
+ }
+ public void cancel() throws Exception {
+ if (manager.getState() != STOPPED)
+ manager.stop();
+ }
+ };
+ doTestOperation(manager,op,EnumSet.of(STOPPED),"stop");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of start method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testStart() throws Exception {
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ final Call op = new Call() {
+ public void call() throws Exception {
+ assertEquals(STOPPED,manager.getState());
+ manager.start();
+ assertContained(EnumSet.of(RUNNING,SCHEDULED,COMPLETED),
+ manager.getState());
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ doTestOperation(manager,op,EnumSet.of(RUNNING,SCHEDULED,COMPLETED),
+ "start");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java
new file mode 100644
index 0000000..4832949
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.logging.Logger;
+import javax.management.JMX;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.NotificationEmitter;
+import javax.management.ObjectName;
+
+/**
+ * A utility class defining static methods used by our tests.
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class TestUtils {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(TestUtils.class.getName());
+
+ /** Creates a new instance of TestUtils */
+ private TestUtils() {
+ }
+
+ /**
+ * Returns the ObjectName of the MBean that a proxy object
+ * is proxying.
+ **/
+ public static ObjectName getObjectName(Object proxy) {
+ if (!(proxy instanceof Proxy))
+ throw new IllegalArgumentException("not a "+Proxy.class.getName());
+ final Proxy p = (Proxy) proxy;
+ final InvocationHandler handler =
+ Proxy.getInvocationHandler(proxy);
+ if (handler instanceof MBeanServerInvocationHandler)
+ return ((MBeanServerInvocationHandler)handler).getObjectName();
+ throw new IllegalArgumentException("not a JMX Proxy");
+ }
+
+ /**
+ * Transfroms a proxy implementing T in a proxy implementing T plus
+ * NotificationEmitter
+ *
+ **/
+ public static <T> T makeNotificationEmitter(T proxy,
+ Class<T> mbeanInterface) {
+ if (proxy instanceof NotificationEmitter)
+ return proxy;
+ if (proxy == null) return null;
+ if (!(proxy instanceof Proxy))
+ throw new IllegalArgumentException("not a "+Proxy.class.getName());
+ final Proxy p = (Proxy) proxy;
+ final InvocationHandler handler =
+ Proxy.getInvocationHandler(proxy);
+ if (!(handler instanceof MBeanServerInvocationHandler))
+ throw new IllegalArgumentException("not a JMX Proxy");
+ final MBeanServerInvocationHandler h =
+ (MBeanServerInvocationHandler)handler;
+ final ObjectName name = h.getObjectName();
+ final MBeanServerConnection mbs = h.getMBeanServerConnection();
+ final boolean isMXBean = h.isMXBean();
+ final T newProxy;
+ if (isMXBean)
+ newProxy = JMX.newMXBeanProxy(mbs,name,mbeanInterface,true);
+ else
+ newProxy = JMX.newMBeanProxy(mbs,name,mbeanInterface,true);
+ return newProxy;
+ }
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java
new file mode 100644
index 0000000..e4cea49
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import junit.framework.*;
+import java.io.File;
+
+/**
+ * Unit tests for {@code XmlConfigUtils}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class XmlConfigUtilsTest extends TestCase {
+
+ public XmlConfigUtilsTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(XmlConfigUtilsTest.class);
+
+ return suite;
+ }
+
+
+ /**
+ * Test of writeToFile method, of class XmlConfigUtils.
+ */
+ public void testWriteToFile() throws Exception {
+ System.out.println("writeToFile");
+
+ final File file = File.createTempFile("test",".xml");
+ file.deleteOnExit();
+
+ final String tmp = System.getProperty("java.io.tmpdir");
+
+ DirectoryScannerConfig dir1 =
+ new DirectoryScannerConfig("scan2");
+ dir1.setRootDirectory(tmp);
+ ScanManagerConfig bean = new ScanManagerConfig("session2");
+ bean.putScan(dir1);
+ XmlConfigUtils instance = new XmlConfigUtils(file.getPath());
+
+ instance.writeToFile(bean);
+ }
+
+ /**
+ * Test of readFromFile method, of class com.sun.jmx.examples.scandir.config.XmlConfigUtils.
+ */
+ public void testReadFromFile() throws Exception {
+ System.out.println("readFromFile");
+
+ final String tmp = System.getProperty("java.io.tmpdir");
+ final File file = File.createTempFile("test",".xml");
+ file.deleteOnExit();
+
+ DirectoryScannerConfig dir1 =
+ new DirectoryScannerConfig("scan1");
+ dir1.setRootDirectory(tmp);
+ ScanManagerConfig bean = new ScanManagerConfig("session1");
+ bean.putScan(dir1);
+ XmlConfigUtils instance = new XmlConfigUtils(file.getPath());
+
+ instance.writeToFile(bean);
+
+ ScanManagerConfig expResult = bean;
+ ScanManagerConfig result = instance.readFromFile();
+ System.out.println(result);
+ assertEquals(expResult, result);
+
+
+ }
+
+}
diff --git a/staging/darwin-x86/sample/jmx/jmx-scandir/truststore b/staging/darwin-x86/sample/jmx/jmx-scandir/truststore
new file mode 100644
index 0000000..2f5ba34
--- /dev/null
+++ b/staging/darwin-x86/sample/jmx/jmx-scandir/truststore
Binary files differ
diff --git a/staging/darwin-x86/sample/lambda/BulkDataOperations/index.html b/staging/darwin-x86/sample/lambda/BulkDataOperations/index.html
new file mode 100644
index 0000000..5a16695
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/BulkDataOperations/index.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bulk Data Operations Demo</title>
+</head>
+<body>
+<h2>Bulk Data Operations Demo</h2>
+
+<p>
+ This demo shows how to use bulk data operations with the new JDK8
+ Collections API.
+ The demo also demonstrates new features of JDK8 such as lambda expressions
+ and method/constructor references.
+</p>
+
+<ul>
+ <li><h3>CSV Processor</h3>
+
+ <p>
+ Analyzes a CSV file, finds and collects useful information, computes
+ different statistics. For more information, see the source file.
+ </p>
+ Source: <a href="src/CSVProcessor.java">src/CSVProcessor.java</a>
+ <li><h3>Grep</h3>
+
+ <p>
+ Behaves like the standard Linux tool Grep. For more information, see
+ the source file.
+ </p>
+ Source: <a href="src/Grep.java">src/Grep.java</a>
+ <li><h3>PasswordGenerator</h3>
+
+ <p>
+ Produces a password of desired length. For more information see
+ source file.
+ </p>
+ Source: <a
+ href="src/PasswordGenerator.java">src/PasswordGenerator.java</a>
+ <li><h3>WC</h3>
+
+ <p>
+ Counts newlines, words, characters, and the maximum line length of a
+ text file. For more information, see the source
+ file.
+ </p>
+ Source: <a href="src/WC.java">src/WC.java</a>
+</ul>
+</body>
+</html> \ No newline at end of file
diff --git a/staging/darwin-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java
new file mode 100644
index 0000000..ded9030
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.function.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+
+import static java.lang.Double.parseDouble;
+import static java.util.stream.Collectors.*;
+
+/**
+ * CSVProcessor is a tool for processing CSV files. There are several
+ * command-line options. Consult the {@link #printUsageAndExit} method for
+ * instructions and command line parameters. This sample shows examples of the
+ * following features:
+ * <ul>
+ * <li>Lambda and bulk operations. Working with streams: map(...), filter(...),
+ * sorted(...) methods. The collect(...) method with different collectors:
+ * Collectors.maxBy(...), Collectors.minBy(...), Collectors.toList(),
+ * Collectors.toCollection(...), Collectors.groupingBy(...),
+ * Collectors.toDoubleSummaryStatistics(...), and a custom Collector.</li>
+ * <li>Static method reference for printing values.</li>
+ * <li>Try-with-resources feature for closing files.</li>
+ * <li>Switch by String feature.</li>
+ * <li>Other new APIs: Pattern.asPredicate(), BinaryOperator
+ * BufferedReader.lines(), Collection.forEach(...), Comparator.comparing(...),
+ * Comparator.reversed(), Arrays.stream(...).</li>
+ * </ul>
+ *
+ */
+public class CSVProcessor {
+
+ //Number of characters that may be read
+ private static final int READ_AHEAD_LIMIT = 100_000_000;
+
+ /**
+ * The main method for the CSVProcessor program. Run the program with an
+ * empty argument list to see possible arguments.
+ *
+ * @param args the argument list for CSVProcessor.
+ */
+ public static void main(String[] args) {
+ if (args.length < 2) {
+ printUsageAndExit();
+ }
+ try (BufferedReader br = new BufferedReader(
+ Files.newBufferedReader(Paths.get(args[args.length - 1])))) {
+ //Assume that the first line contains column names.
+ List<String> header = Arrays.stream(br.readLine().split(","))
+ .map(String::trim).collect(toList());
+ //Calculate an index of the column in question.
+ int column = getColumnNumber(header, args[1]);
+ switch (args[0]) {
+ case "sort":
+ verifyArgumentNumber(args, 4);
+ //Define the sort order.
+ boolean isAsc;
+ switch (args[2].toUpperCase()) {
+ case "ASC":
+ isAsc = true;
+ break;
+ case "DESC":
+ isAsc = false;
+ break;
+ default:
+ printUsageAndExit("Illegal argument" + args[2]);
+ return;//Should not be reached.
+ }
+ /*
+ * Create a comparator that compares lines by comparing
+ * values in the specified column.
+ */
+ Comparator<String> cmp
+ = Comparator.comparing(str -> getCell(str, column),
+ String.CASE_INSENSITIVE_ORDER);
+ /*
+ * sorted(...) is used to sort records.
+ * forEach(...) is used to output sorted records.
+ */
+ br.lines().sorted(isAsc ? cmp : cmp.reversed())
+ .forEach(System.out::println);
+ break;
+ case "search":
+ verifyArgumentNumber(args, 4);
+ /*
+ * Records are filtered by a regex.
+ * forEach(...) is used to output filtered records.
+ */
+ Predicate<String> pattern
+ = Pattern.compile(args[2]).asPredicate();
+ br.lines().filter(str -> pattern.test(getCell(str, column)))
+ .forEach(System.out::println);
+ break;
+ case "groupby":
+ verifyArgumentNumber(args, 3);
+ /*
+ * Group lines by values in the column with collect(...), and
+ * print with forEach(...) for every distinct value within
+ * the column.
+ */
+ br.lines().collect(
+ Collectors.groupingBy(str -> getCell(str, column),
+ toCollection(TreeSet::new)))
+ .forEach((str, set) -> {
+ System.out.println(str + ":");
+ set.forEach(System.out::println);
+ });
+ break;
+ case "stat":
+ verifyArgumentNumber(args, 3);
+
+ /*
+ * BufferedReader will be read several times.
+ * Mark this point to return here after each pass.
+ * BufferedReader will be read right after the headers line
+ * because it is already read.
+ */
+ br.mark(READ_AHEAD_LIMIT);
+
+ /*
+ * Statistics can be collected by a custom collector in one
+ * pass. One pass is preferable.
+ */
+ System.out.println(
+ br.lines().collect(new Statistics(column)));
+
+ /*
+ * Alternatively, statistics can be collected
+ * by a built-in API in several passes.
+ * This method demonstrates how separate operations can be
+ * implemented using a built-in API.
+ */
+ br.reset();
+ statInSeveralPasses(br, column);
+ break;
+ default:
+ printUsageAndExit("Illegal argument" + args[0]);
+ }
+ } catch (IOException e) {
+ printUsageAndExit(e.toString());
+ }
+ }
+
+ private static void statInSeveralPasses(BufferedReader br, int column)
+ throws IOException {
+ System.out.println("#-----Statistics in several passes-------#");
+ //Create a comparator to compare records by the column.
+ Comparator<String> comparator
+ = Comparator.comparing(
+ (String str) -> parseDouble(getCell(str, column)));
+ //Find max record by using Collectors.maxBy(...)
+ System.out.println(
+ "Max: " + br.lines().collect(maxBy(comparator)).get());
+ br.reset();
+ //Find min record by using Collectors.minBy(...)
+ System.out.println(
+ "Min: " + br.lines().collect(minBy(comparator)).get());
+ br.reset();
+ //Compute the average value and sum with
+ //Collectors.toDoubleSummaryStatistics(...)
+ DoubleSummaryStatistics doubleSummaryStatistics
+ = br.lines().collect(summarizingDouble(
+ str -> parseDouble(getCell(str, column))));
+ System.out.println("Average: " + doubleSummaryStatistics.getAverage());
+ System.out.println("Sum: " + doubleSummaryStatistics.getSum());
+ }
+
+ private static void verifyArgumentNumber(String[] args, int n) {
+ if (args.length != n) {
+ printUsageAndExit("Expected " + n + " arguments but was "
+ + args.length);
+ }
+ }
+
+ private static int getColumnNumber(List<String> header, String name) {
+ int column = header.indexOf(name);
+ if (column == -1) {
+ printUsageAndExit("There is no column with name " + name);
+ }
+ return column;
+ }
+
+ private static String getCell(String record, int column) {
+ return record.split(",")[column].trim();
+ }
+
+ private static void printUsageAndExit(String... str) {
+ System.out.println("Usages:");
+
+ System.out.println("CSVProcessor sort COLUMN_NAME ASC|DESC FILE");
+ System.out.println("Sort lines by column COLUMN_NAME in CSV FILE\n");
+
+ System.out.println("CSVProcessor search COLUMN_NAME REGEX FILE");
+ System.out.println("Search for REGEX in column COLUMN_NAME in CSV FILE\n");
+
+ System.out.println("CSVProcessor groupby COLUMN_NAME FILE");
+ System.out.println("Split lines into different groups according to column "
+ + "COLUMN_NAME value\n");
+
+ System.out.println("CSVProcessor stat COLUMN_NAME FILE");
+ System.out.println("Compute max/min/average/sum statistics by column "
+ + "COLUMN_NAME\n");
+
+ Arrays.asList(str).forEach(System.err::println);
+ System.exit(1);
+ }
+
+ /*
+ * This is a custom implementation of the Collector interface.
+ * Statistics are objects gather max,min,sum,average statistics.
+ */
+ private static class Statistics
+ implements Collector<String, Statistics, Statistics> {
+
+
+ /*
+ * This implementation does not need to be thread safe because
+ * the parallel implementation of
+ * {@link java.util.stream.Stream#collect Stream.collect()}
+ * provides the necessary partitioning and isolation for safe parallel
+ * execution.
+ */
+ private String maxRecord;
+ private String minRecord;
+
+ private double sum;
+ private int lineCount;
+ private final BinaryOperator<String> maxOperator;
+ private final BinaryOperator<String> minOperator;
+ private final int column;
+
+ public Statistics(int column) {
+ this.column = column;
+ Comparator<String> cmp = Comparator.comparing(
+ (String str) -> parseDouble(getCell(str, column)));
+ maxOperator = BinaryOperator.maxBy(cmp);
+ minOperator = BinaryOperator.minBy(cmp);
+ }
+
+ /*
+ * Process line.
+ */
+ public Statistics accept(String line) {
+ maxRecord = maxRecord == null
+ ? line : maxOperator.apply(maxRecord, line);
+ minRecord = minRecord == null
+ ? line : minOperator.apply(minRecord, line);
+
+ sum += parseDouble(getCell(line, column));
+ lineCount++;
+ return this;
+ }
+
+
+ /*
+ * Merge two Statistics.
+ */
+ public Statistics combine(Statistics stat) {
+ maxRecord = maxOperator.apply(maxRecord, stat.getMaxRecord());
+ minRecord = minOperator.apply(minRecord, stat.getMinRecord());
+ sum += stat.getSum();
+ lineCount += stat.getLineCount();
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("#------Statistics------#\n");
+ sb.append("Max: ").append(getMaxRecord()).append("\n");
+ sb.append("Min: ").append(getMinRecord()).append("\n");
+ sb.append("Sum = ").append(getSum()).append("\n");
+ sb.append("Average = ").append(average()).append("\n");
+ sb.append("#------Statistics------#\n");
+ return sb.toString();
+ }
+
+ @Override
+ public Supplier<Statistics> supplier() {
+ return () -> new Statistics(column);
+ }
+
+ @Override
+ public BiConsumer<Statistics, String> accumulator() {
+ return Statistics::accept;
+ }
+
+ @Override
+ public BinaryOperator<Statistics> combiner() {
+ return Statistics::combine;
+
+ }
+
+ @Override
+ public Function<Statistics, Statistics> finisher() {
+ return stat -> stat;
+ }
+
+ @Override
+ public Set<Characteristics> characteristics() {
+ return EnumSet.of(Characteristics.IDENTITY_FINISH);
+ }
+
+ private String getMaxRecord() {
+ return maxRecord;
+ }
+
+ private String getMinRecord() {
+ return minRecord;
+ }
+
+ private double getSum() {
+ return sum;
+ }
+
+ private double average() {
+ return sum / lineCount;
+ }
+
+ private int getLineCount() {
+ return lineCount;
+ }
+
+ }
+
+}
diff --git a/staging/darwin-x86/sample/lambda/BulkDataOperations/src/Grep.java b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/Grep.java
new file mode 100644
index 0000000..cb4bdf7
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/Grep.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Grep prints lines matching a regex. See {@link #printUsageAndExit(String...)}
+ * method for instructions and command line parameters. This sample shows
+ * examples of using next features:
+ * <ul>
+ * <li>Lambda and bulk operations. Working with streams:
+ * map(...),filter(...),flatMap(...),limit(...) methods.</li>
+ * <li>Static method reference for printing values.</li>
+ * <li>New Collections API forEach(...) method.</li>
+ * <li>Try-with-resources feature.</li>
+ * <li>new Files.walk(...), Files.lines(...) API.</li>
+ * <li>Streams that need to be closed.</li>
+ * </ul>
+ *
+ */
+public class Grep {
+
+ private static void printUsageAndExit(String... str) {
+ System.out.println("Usage: " + Grep.class.getSimpleName()
+ + " [OPTION]... PATTERN FILE...");
+ System.out.println("Search for PATTERN in each FILE. "
+ + "If FILE is a directory then whole file tree of the directory"
+ + " will be processed.");
+ System.out.println("Example: grep -m 100 'hello world' menu.h main.c");
+ System.out.println("Options:");
+ System.out.println(" -m NUM: stop analysis after NUM matches");
+ Arrays.asList(str).forEach(System.err::println);
+ System.exit(1);
+ }
+
+ /**
+ * The main method for the Grep program. Run program with empty argument
+ * list to see possible arguments.
+ *
+ * @param args the argument list for Grep.
+ * @throws java.io.IOException If an I/O error occurs.
+ */
+ public static void main(String[] args) throws IOException {
+ long maxCount = Long.MAX_VALUE;
+ if (args.length < 2) {
+ printUsageAndExit();
+ }
+ int i = 0;
+ //parse OPTIONS
+ while (args[i].startsWith("-")) {
+ switch (args[i]) {
+ case "-m":
+ try {
+ maxCount = Long.parseLong(args[++i]);
+ } catch (NumberFormatException ex) {
+ printUsageAndExit(ex.toString());
+ }
+ break;
+ default:
+ printUsageAndExit("Unexpected option " + args[i]);
+ }
+ i++;
+ }
+ //parse PATTERN
+ Pattern pattern = Pattern.compile(args[i++]);
+ if (i == args.length) {
+ printUsageAndExit("There are no files for input");
+ }
+
+ try {
+ /*
+ * First obtain the list of all paths.
+ * For a small number of arguments there is little to be gained
+ * by producing this list in parallel. For one argument
+ * there will be no parallelism.
+ *
+ * File names are converted to paths. If a path is a directory then
+ * Stream is populated with whole file tree of the directory by
+ * flatMap() method. Files are filtered from directories.
+ */
+ List<Path> files = Arrays.stream(args, i, args.length)
+ .map(Paths::get)
+ // flatMap will ensure each I/O-based stream will be closed
+ .flatMap(Grep::getPathStream)
+ .filter(Files::isRegularFile)
+ .collect(toList());
+ /*
+ * Then operate on that list in parallel.
+ * This is likely to give a more even distribution of work for
+ * parallel execution.
+ *
+ * Lines are extracted from files. Lines are filtered by pattern.
+ * Stream is limited by number of matches. Each remaining string is
+ * displayed in std output by method reference System.out::println.
+ */
+ files.parallelStream()
+ // flatMap will ensure each I/O-based stream will be closed
+ .flatMap(Grep::path2Lines)
+ .filter(pattern.asPredicate())
+ .limit(maxCount)
+ .forEachOrdered(System.out::println);
+ } catch (UncheckedIOException ioe) {
+ printUsageAndExit(ioe.toString());
+ }
+ }
+
+ /**
+ * Flattens file system hierarchy into a stream. This code is not inlined
+ * for the reason of Files.walk() throwing a checked IOException that must
+ * be caught.
+ *
+ * @param path - the file or directory
+ * @return Whole file tree starting from path, a stream with one element -
+ * the path itself - if it is a file.
+ */
+ private static Stream<Path> getPathStream(Path path) {
+ try {
+ return Files.walk(path);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ /**
+ * Produces a stream of lines from a file. The result is a stream in order
+ * to close it later. This code is not inlined for the reason of
+ * Files.lines() throwing a checked IOException that must be caught.
+ *
+ * @param path - the file to read
+ * @return stream of lines from the file
+ */
+ private static Stream<String> path2Lines(Path path) {
+ try {
+ return Files.lines(path);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java
new file mode 100644
index 0000000..e467798
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.IntStream;
+
+/**
+ * Generates password of desired length. See {@link #usage} method
+ * for instructions and command line parameters. This sample shows usages of:
+ * <ul>
+ * <li>Method references.</li>
+ * <li>Lambda and bulk operations. A stream of random integers is mapped to
+ * chars, limited by desired length and printed in standard output as password
+ * string.</li>
+ * </ul>
+ *
+ */
+public class PasswordGenerator {
+
+ private static void usage() {
+ System.out.println("Usage: PasswordGenerator LENGTH");
+ System.out.println(
+ "Password Generator produces password of desired LENGTH.");
+ }
+
+ private static final List<Integer> PASSWORD_CHARS = new ArrayList<>();
+
+ //Valid symbols.
+ static {
+ IntStream.rangeClosed('0', '9').forEach(PASSWORD_CHARS::add); // 0-9
+ IntStream.rangeClosed('A', 'Z').forEach(PASSWORD_CHARS::add); // A-Z
+ IntStream.rangeClosed('a', 'z').forEach(PASSWORD_CHARS::add); // a-z
+ }
+
+ /**
+ * The main method for the PasswordGenerator program. Run program with empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for PasswordGenerator.
+ */
+ public static void main(String[] args) {
+
+ if (args.length != 1) {
+ usage();
+ return;
+ }
+
+ long passwordLength;
+ try {
+ passwordLength = Long.parseLong(args[0]);
+ if (passwordLength < 1) {
+ printMessageAndUsage("Length has to be positive");
+ return;
+ }
+ } catch (NumberFormatException ex) {
+ printMessageAndUsage("Unexpected number format" + args[0]);
+ return;
+ }
+ /*
+ * Stream of random integers is created containing Integer values
+ * in range from 0 to PASSWORD_CHARS.size().
+ * The stream is limited by passwordLength.
+ * Valid chars are selected by generated index.
+ */
+ new SecureRandom().ints(passwordLength, 0, PASSWORD_CHARS.size())
+ .map(PASSWORD_CHARS::get)
+ .forEach(i -> System.out.print((char) i));
+ }
+
+ private static void printMessageAndUsage(String message) {
+ System.err.println(message);
+ usage();
+ }
+
+}
diff --git a/staging/darwin-x86/sample/lambda/BulkDataOperations/src/WC.java b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/WC.java
new file mode 100644
index 0000000..c724f15
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/BulkDataOperations/src/WC.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.function.Consumer;
+import java.util.regex.Pattern;
+
+/**
+ * WC - Prints newline, word, and character counts for each file. See
+ * the {@link #usage} method for instructions and command line parameters. This
+ * sample shows usages of:
+ * <ul>
+ * <li>Lambda and bulk operations. Shows how to create a custom collector to
+ * gather custom statistics. Implements the collection of statistics using a
+ * built-in API.</li>
+ * <li>Constructor reference.</li>
+ * <li>Try-with-resources feature.</li>
+ * </ul>
+ *
+ */
+public class WC {
+
+ //The number of characters that may be read.
+ private static final int READ_AHEAD_LIMIT = 100_000_000;
+
+ //The pattern for splitting strings by non word characters to get words.
+ private static final Pattern nonWordPattern = Pattern.compile("\\W");
+
+ /**
+ * The main method for the WC program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for WC
+ * @throws java.io.IOException If an input exception occurred.
+ */
+ public static void main(String[] args) throws IOException {
+
+ if (args.length != 1) {
+ usage();
+ return;
+ }
+
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(args[0]))) {
+ reader.mark(READ_AHEAD_LIMIT);
+ /*
+ * Statistics can be gathered in four passes using a built-in API.
+ * The method demonstrates how separate operations can be
+ * implemented using a built-in API.
+ */
+ collectInFourPasses(reader);
+ /*
+ * Usage of several passes to collect data is not the best way.
+ * Statistics can be gathered by a custom collector in one pass.
+ */
+ reader.reset();
+ collectInOnePass(reader);
+ } catch (FileNotFoundException e) {
+ usage();
+ System.err.println(e);
+ }
+ }
+
+ private static void collectInFourPasses(BufferedReader reader)
+ throws IOException {
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is turned into a stream of chars by the flatMapToInt(...)
+ * method.
+ * Length of the stream is counted by count().
+ */
+ System.out.println("Character count = "
+ + reader.lines().flatMapToInt(String::chars).count());
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is split by nonWordPattern into words by flatMap(...)
+ * method.
+ * Empty lines are removed by the filter(...) method.
+ * Length of the stream is counted by count().
+ */
+ reader.reset();
+ System.out.println("Word count = "
+ + reader.lines()
+ .flatMap(nonWordPattern::splitAsStream)
+ .filter(str -> !str.isEmpty()).count());
+
+ reader.reset();
+ System.out.println("Newline count = " + reader.lines().count());
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is mapped to its length.
+ * Maximum of the lengths is calculated.
+ */
+ reader.reset();
+ System.out.println("Max line length = "
+ + reader.lines().mapToInt(String::length).max().getAsInt());
+ }
+
+ private static void collectInOnePass(BufferedReader reader) {
+ /*
+ * The collect() method has three parameters:
+ * The first parameter is the {@code WCStatistic} constructor reference.
+ * collect() will create {@code WCStatistics} instances, where
+ * statistics will be aggregated.
+ * The second parameter shows how {@code WCStatistics} will process
+ * String.
+ * The third parameter shows how to merge two {@code WCStatistic}
+ * instances.
+ *
+ * Also {@code Collector} can be used, which would be more reusable
+ * solution. See {@code CSVProcessor} example for how {@code Collector}
+ * can be implemented.
+ *
+ * Note that the any performance increase when going parallel will
+ * depend on the size of the input (lines) and the cost per-element.
+ */
+ WCStatistics wc = reader.lines().parallel()
+ .collect(WCStatistics::new,
+ WCStatistics::accept,
+ WCStatistics::combine);
+ System.out.println(wc);
+ }
+
+ private static void usage() {
+ System.out.println("Usage: " + WC.class.getSimpleName() + " FILE");
+ System.out.println("Print newline, word,"
+ + " character counts and max line length for FILE.");
+ }
+
+ private static class WCStatistics implements Consumer<String> {
+ /*
+ * @implNote This implementation does not need to be thread safe because
+ * the parallel implementation of
+ * {@link java.util.stream.Stream#collect Stream.collect()}
+ * provides the necessary partitioning and isolation for safe parallel
+ * execution.
+ */
+
+ private long characterCount;
+ private long lineCount;
+ private long wordCount;
+ private long maxLineLength;
+
+
+ /*
+ * Processes line.
+ */
+ @Override
+ public void accept(String line) {
+ characterCount += line.length();
+ lineCount++;
+ wordCount += nonWordPattern.splitAsStream(line)
+ .filter(str -> !str.isEmpty()).count();
+ maxLineLength = Math.max(maxLineLength, line.length());
+ }
+
+ /*
+ * Merges two WCStatistics.
+ */
+ public void combine(WCStatistics stat) {
+ wordCount += stat.wordCount;
+ lineCount += stat.lineCount;
+ characterCount += stat.characterCount;
+ maxLineLength = Math.max(maxLineLength, stat.maxLineLength);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("#------WCStatistic------#\n");
+ sb.append("Character count = ").append(characterCount).append('\n');
+ sb.append("Word count = ").append(wordCount).append('\n');
+ sb.append("Newline count = ").append(lineCount).append('\n');
+ sb.append("Max line length = ").append(maxLineLength).append('\n');
+ return sb.toString();
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/lambda/DefaultMethods/ArrayIterator.java b/staging/darwin-x86/sample/lambda/DefaultMethods/ArrayIterator.java
new file mode 100644
index 0000000..2eca801
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/DefaultMethods/ArrayIterator.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * The code sample illustrates the usage of default methods in the JDK 8. Most
+ * implementations of {@link Iterator} don't provide a useful
+ * {@link Iterator#remove()} method, however,
+ * they still have to implement this method to throw
+ * an UnsupportedOperationException. With the default method, the same
+ * default behavior in interface Iterator itself can be provided.
+ */
+public class ArrayIterator {
+
+ /** Close the constructor because ArrayIterator is part of the utility
+ * class.
+ */
+ protected ArrayIterator() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns an iterator that goes over the elements in the array.
+ *
+ * @param <E> type of an array element
+ * @param array source array to iterate over it
+ * @return an iterator that goes over the elements in the array
+ */
+ public static <E> Iterator<E> iterator(final E[] array) {
+ return new Iterator<E>() {
+ /**
+ * Index of the current position
+ *
+ */
+ private int index = 0;
+
+ /**
+ * Returns the next element in the iteration
+ *
+ * @return the next element in the iteration
+ * @throws NoSuchElementException if the iteration has no more
+ * elements
+ */
+ @Override
+ public boolean hasNext() {
+ return (index < array.length);
+ }
+
+ /**
+ * Returns {@code true} if the iteration has more elements. (In
+ * other words, returns {@code true} if {@link #next} returns
+ * an element, rather than throwing an exception.)
+ *
+ * @return {@code true} if the iteration has more elements
+ */
+ @Override
+ public E next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ return array[index++];
+ }
+
+ /**
+ * This method does not need to be overwritten in JDK 8.
+ */
+ //@Override
+ //public void remove() {
+ // throw UnsupportedOperationException(
+ // "Arrays don't support remove.")
+ //}
+ };
+ }
+
+ /**
+ * Sample usage of the ArrayIterator
+ *
+ * @param args command-line arguments
+ */
+ public static void main(final String[] args) {
+ Iterator<String> it = ArrayIterator.iterator(
+ new String[]{"one", "two", "three"});
+
+ while (it.hasNext()) {
+ System.out.println(it.next());
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/lambda/DefaultMethods/DiamondInheritance.java b/staging/darwin-x86/sample/lambda/DefaultMethods/DiamondInheritance.java
new file mode 100644
index 0000000..9214d58
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/DefaultMethods/DiamondInheritance.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/**
+ * This sample diamond interface inheritance with <b>default methods</b>.
+ * If there's not already a unique method implementation to inherit,
+ * you must provide it. The inheritance diagram is similar to the following:
+ * <pre>
+ * Animal
+ * / \
+ * Horse Bird
+ * \ /
+ * Pegasus
+ * </pre>
+ *
+ * Both {@link Horse} and {@link Bird} interfaces implements the <code>go</code>
+ * method. The {@link Pegasus} class have to overrides the
+ * <code>go</code> method.
+ *
+ * The new syntax of super-call is used here:
+ * <pre>
+ * &lt;interface_name&gt;.super.&lt;method&gt;(...);
+ * For example: Horse.super.go();
+ * </pre> So, Pegasus moves like a horse.
+ */
+public class DiamondInheritance {
+
+ /**
+ * Base interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the "go" action for concrete animal
+ *
+ * @return string representation of the "go" action for concrete animal
+ */
+ String go();
+ }
+
+ /**
+ * Interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Horse extends Animal {
+
+ /**
+ * Return string representation of the "go" action for horse
+ *
+ * @return string representation of the "go" action for horse
+ */
+ @Override
+ default String go() {
+ return this.getClass().getSimpleName() + " walks on four legs";
+ }
+ }
+
+ /**
+ * Interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Bird extends Animal {
+
+ /**
+ * Return string representation of the "go" action for bird
+ *
+ * @return string representation of the "go" action for bird
+ */
+ @Override
+ default String go() {
+ return this.getClass().getSimpleName() + " walks on two legs";
+ }
+
+ /**
+ * Return string representation of the "fly" action for bird
+ *
+ * @return string representation of the "fly" action for bird
+ */
+ default String fly() {
+ return "I can fly";
+ }
+ }
+
+ /**
+ * Class to illustrate the diamond inheritance. Pegasus must mix horse and
+ * bird behavior.
+ *
+ * @see DiamondInheritance
+ */
+ public static class Pegasus implements Horse, Bird {
+
+ /**
+ * Return string representation of the "go" action for the fictitious
+ * creature Pegasus
+ *
+ * @return string representation of the "go" action for the fictitious
+ * creature Pegasus
+ */
+ @Override
+ public String go() {
+ return Horse.super.go();
+ }
+ }
+
+ /**
+ * Illustrate the behavior of the {@link Pegasus} class
+ *
+ * @param args command line arguments
+ */
+ public static void main(final String[] args) {
+ System.out.println(new Pegasus().go());
+ }
+}
diff --git a/staging/darwin-x86/sample/lambda/DefaultMethods/Inheritance.java b/staging/darwin-x86/sample/lambda/DefaultMethods/Inheritance.java
new file mode 100644
index 0000000..961de2c
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/DefaultMethods/Inheritance.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/**
+ * The sample illustrates rules to resolve conflicts between inheritance
+ * candidates with <b>default methods</b>. There are two simple rules:
+ * <ul>
+ * <li>Class wins. If the superclass has a concrete or abstract declaration of
+ * this method, then it is preferred over all defaults.</li>
+ * <li>Subtype wins. If an interface extends another interface, and both provide
+ * a default, then the more specific interface wins. </li>
+ * </ul>
+ */
+public class Inheritance {
+
+ /**
+ * The behavior of an creature that can swim
+ */
+ public interface Swimable {
+
+ /**
+ * Return string representation of the swim action for a creature that
+ * can swim
+ *
+ * @return string representation of the swim action for a creature
+ * that can swim
+ */
+ default String swim() {
+ return "I can swim.";
+ }
+ }
+
+ /**
+ * The abstract class that overrides {@link #swim} method
+ */
+ public abstract static class Fish implements Swimable {
+
+ /**
+ * Return string representation of the swim action for a fish
+ *
+ * @return string representation of the swim action for a fish
+ */
+ @Override
+ public String swim() {
+ return this.getClass().getSimpleName() + " swims under water";
+ }
+ }
+
+ /**
+ * This class is used for the illustration rule of 1. See the source code
+ * of the {@link #main} method.
+ * <pre>
+ * System.out.println(new Tuna().swim()); //"Tuna swims under water" output is suspected here
+ * </pre>
+ */
+ public static class Tuna extends Fish implements Swimable {
+ }
+
+ /**
+ * The behavior of an creature that can dive: the interface that overrides
+ * {@link #swim} method (subtype of {@link Swimable})
+ */
+ public interface Diveable extends Swimable {
+
+ /**
+ * Return string representation of the swim action for a creature that
+ * can dive
+ *
+ * @return string representation of the swim action for a creature
+ * that can dive
+ */
+ @Override
+ default String swim() {
+ return "I can swim on the surface of the water.";
+ }
+
+ /**
+ * Return string representation of the dive action for a creature that
+ * can dive
+ *
+ * @return string representation of the dive action for a creature
+ * that can dive
+ */
+ default String dive() {
+ return "I can dive.";
+ }
+ }
+
+ /**
+ * This class is used for the illustration of rule 2. See the source code
+ * of the {@link #main} method
+ * <pre>
+ * //"I can swim on the surface of the water." output is suspected here
+ * System.out.println(new Duck().swim());
+ * </pre>
+ */
+ public static class Duck implements Swimable, Diveable {
+ }
+
+ /**
+ * Illustrate behavior of the classes: {@link Tuna} and {@link Duck}
+ *
+ * @param args command line arguments
+ */
+ public static void main(final String[] args) {
+ // Illustrates rule 1. The Fish.swim() implementation wins
+ //"Tuna swims under water" is output
+ System.out.println(new Tuna().swim());
+
+ // Illustrates rule 2. The Diveable.swim() implementation wins
+ //"I can swim on the surface of the water." is output
+ System.out.println(new Duck().swim());
+ }
+}
diff --git a/staging/darwin-x86/sample/lambda/DefaultMethods/MixIn.java b/staging/darwin-x86/sample/lambda/DefaultMethods/MixIn.java
new file mode 100644
index 0000000..d9ed81d
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/DefaultMethods/MixIn.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+/**
+ * The example illustrates how to use the default method for mixin.
+ * @see BuildType
+ * @see Debuggable
+ */
+public class MixIn {
+
+ /**
+ * Implement this interface for a class that must be in debug print
+ */
+ public interface Debuggable {
+
+ /**
+ * Print the class name and all fields to a string. Uses reflection to
+ * obtain and access fields of this object.
+ *
+ * @return the string formatted like the following: <pre>
+ * State of the: &lt;Class Name&gt;
+ * &lt;member name&gt; : &lt;value&gt;
+ * ...
+ * </pre>
+ */
+ default String toDebugString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("State of the: ").append(
+ this.getClass().getSimpleName()).append("\n");
+ for (Class cls = this.getClass();
+ cls != null;
+ cls = cls.getSuperclass()) {
+ for (Field f : cls.getDeclaredFields()) {
+ try {
+ f.setAccessible(true);
+ sb.append(f.getName()).append(" : ").
+ append(f.get(this)).append("\n");
+ } catch (IllegalAccessException e) {
+ }
+ }
+ }
+ return sb.toString();
+ }
+ }
+
+ /**
+ * Sample exception class to demonstrate mixin. This enum inherits the
+ * behavior of the {@link Debuggable}
+ */
+ public static enum BuildType implements Debuggable {
+
+ BUILD(0, "-build"),
+ PLAN(0, "-plan"),
+ EXCLUDE(1, "-exclude"),
+ TOTAL(2, "-total");
+
+ private final int compareOrder;
+ private final String pathSuffix;
+
+ private BuildType(int compareOrder, String pathSuffix) {
+ this.compareOrder = compareOrder;
+ this.pathSuffix = pathSuffix;
+ }
+
+ public int getCompareOrder() {
+ return compareOrder;
+ }
+
+ public String getPathSuffix() {
+ return pathSuffix;
+ }
+ }
+
+ /**
+ * Illustrate the behavior of the MixClass
+ *
+ * @param args command-line arguments
+ * @throws java.io.IOException internal demo error
+ */
+ public static void main(final String[] args) throws IOException {
+ System.out.println(BuildType.BUILD.toDebugString());
+ }
+}
diff --git a/staging/darwin-x86/sample/lambda/DefaultMethods/Reflection.java b/staging/darwin-x86/sample/lambda/DefaultMethods/Reflection.java
new file mode 100644
index 0000000..78424a2
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/DefaultMethods/Reflection.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+/**
+ * The code sample illustrates changes in the reflection API linked
+ * <b>default methods</b>. Since Java SE 8, a new method is added into the class
+ * <b><code>java.lang.reflect.Method</code></b>, with which you can reflectively
+ * determine whether or not a default method provided by an interface
+ * (<b><code>Method.isDefault()</code></b>).
+ */
+public class Reflection {
+
+ /**
+ * Base interface to illustrate the new reflection API.
+ *
+ * @see Dog
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the eat action for Animal
+ *
+ * @return string representation of the eat action for Animal
+ */
+ default String eat() {
+ return this.getClass().getSimpleName()
+ + " eats like an ordinary animal";
+ }
+
+ /**
+ * Return string representation of the sleep action for Animal
+ *
+ * @return string representation of the sleep action for Animal
+ */
+ default String sleep() {
+ return this.getClass().getSimpleName()
+ + " sleeps like an ordinary animal";
+ }
+
+ /**
+ * Return string representation of the go action for Animal
+ *
+ * @return string representation of the go action for Animal
+ */
+ String go();
+ }
+
+ /**
+ * Dog class to illustrate the new reflection API. You can see that:
+ * <ul>
+ * <li> the {@link #go} and {@link #sleep} methods are not default.
+ * {@link #go} is not the default implementation and the {@link #sleep}
+ * method implementation wins as subtype (according with {@link Inheritance}
+ * rule. 2) </li>
+ * <li> the {@link #eat} is a simple default method that is not overridden
+ * in this class.
+ * </li>
+ * </ul>
+ */
+ public static class Dog implements Animal {
+
+ /**
+ * Return string representation of the go action for Dog
+ *
+ * @return string representation of the go action for Dog
+ */
+ @Override
+ public String go() {
+ return "Dog walks on four legs";
+ }
+
+ /**
+ * Return string representation of the sleep action for Dog
+ *
+ * @return string representation of the sleep action for Dog
+ */
+ @Override
+ public String sleep() {
+ return "Dog sleeps";
+ }
+ }
+
+ /**
+ * Illustrate the usage of the method java.lang.reflect.Method.isDefault()
+ *
+ * @param args command-line arguments
+ * @throws NoSuchMethodException internal demo error
+ */
+ public static void main(final String[] args) throws NoSuchMethodException {
+ Dog dog = new Dog();
+ Stream.of(Dog.class.getMethod("eat"), Dog.class.getMethod("go"), Dog.class.getMethod("sleep"))
+ .forEach((m) -> {
+ System.out.println("Method name: " + m.getName());
+ System.out.println(" isDefault: " + m.isDefault());
+ System.out.print(" invoke: ");
+ try {
+ m.invoke(dog);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ }
+ System.out.println();
+ });
+ }
+}
diff --git a/staging/darwin-x86/sample/lambda/DefaultMethods/SimplestUsage.java b/staging/darwin-x86/sample/lambda/DefaultMethods/SimplestUsage.java
new file mode 100644
index 0000000..a971858
--- /dev/null
+++ b/staging/darwin-x86/sample/lambda/DefaultMethods/SimplestUsage.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/**
+ * The sample illustrates the simplest use case of the <b>default methods</b>.
+ */
+public class SimplestUsage {
+
+ /**
+ * The Animal interface provides the default implementation
+ * of the {@link #eat} method.
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the eat action for Animal
+ *
+ * @return string representation of the eat action for Animal
+ */
+ default String eat() {
+ return this.getClass().getSimpleName()
+ + " eats like an ordinary animal";
+ }
+ }
+
+ /**
+ * The Dog class doesn't have its own implementation of the {@link #eat}
+ * method and uses the default implementation.
+ */
+ public static class Dog implements Animal {
+ }
+
+ /**
+ * The Mosquito class implements {@link #eat} method, its own implementation
+ * overrides the default implementation.
+ *
+ */
+ public static class Mosquito implements Animal {
+
+ /**
+ * Return string representation of the eat action for Mosquito
+ *
+ * @return string representation of the eat action for Mosquito
+ */
+ @Override
+ public String eat() {
+ return "Mosquito consumes blood";
+ }
+ }
+
+ /**
+ * Illustrate behavior of the classes: {@link Dog} and {@link Mosquito}
+ *
+ * @param args command-line arguments
+ */
+ public static void main(String[] args) {
+ // "Dog eats like an ordinary animal" is output
+ System.out.println(new Dog().eat());
+
+ // "Mosquito consumes blood" is output
+ System.out.println(new Mosquito().eat());
+ }
+}
diff --git a/staging/darwin-x86/sample/nbproject/project.xml b/staging/darwin-x86/sample/nbproject/project.xml
new file mode 100644
index 0000000..8417326
--- /dev/null
+++ b/staging/darwin-x86/sample/nbproject/project.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>JDK Samples</name>
+ <view>
+ <items/>
+ </view>
+ <subprojects>
+ <project>jmx/jmx-scandir</project>
+ <project>scripting/scriptpad</project>
+ <project>webservices/EbayClient</project>
+ <project>webservices/EbayServer</project>
+ </subprojects>
+ </general-data>
+ </configuration>
+</project>
diff --git a/staging/darwin-x86/sample/nio/chatserver/ChatServer.java b/staging/darwin-x86/sample/nio/chatserver/ChatServer.java
new file mode 100644
index 0000000..f807aa1
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/chatserver/ChatServer.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.StandardSocketOptions;
+import java.nio.channels.*;
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Implements a chat server, this class holds the list of {@code clients} connected to the server.
+ * It sets up a server socket using AsynchronousServerSocketChannel listening to a specified port.
+ */
+public class ChatServer implements Runnable {
+ private final List<Client> connections = Collections.synchronizedList(new ArrayList<Client>());
+ private int port;
+ private final AsynchronousServerSocketChannel listener;
+ private final AsynchronousChannelGroup channelGroup;
+
+ /**
+ *
+ * @param port to listen to
+ * @throws java.io.IOException when failing to start the server
+ */
+ public ChatServer(int port) throws IOException {
+ channelGroup = AsynchronousChannelGroup.withFixedThreadPool(Runtime.getRuntime().availableProcessors(),
+ Executors.defaultThreadFactory());
+ this.port = port;
+ listener = createListener(channelGroup);
+ }
+
+ /**
+ *
+ * @return The socket address that the server is bound to
+ * @throws java.io.IOException if an I/O error occurs
+ */
+ public SocketAddress getSocketAddress() throws IOException {
+ return listener.getLocalAddress();
+ }
+
+ /**
+ * Start accepting connections
+ */
+ public void run() {
+
+ // call accept to wait for connections, tell it to call our CompletionHandler when there
+ // is a new incoming connection
+ listener.accept(null, new CompletionHandler<AsynchronousSocketChannel, Void>() {
+ @Override
+ public void completed(AsynchronousSocketChannel result, Void attachment) {
+ // request a new accept and handle the incoming connection
+ listener.accept(null, this);
+ handleNewConnection(result);
+ }
+
+ @Override
+ public void failed(Throwable exc, Void attachment) {
+ }
+ });
+ }
+
+ /**
+ * Shuts down the server
+ * @throws InterruptedException if terminated while waiting for shutdown
+ * @throws IOException if failing to shutdown the channel group
+ */
+ public void shutdown() throws InterruptedException, IOException {
+ channelGroup.shutdownNow();
+ channelGroup.awaitTermination(1, TimeUnit.SECONDS);
+ }
+
+ /*
+ * Creates a listener and starts accepting connections
+ */
+ private AsynchronousServerSocketChannel createListener(AsynchronousChannelGroup channelGroup) throws IOException {
+ final AsynchronousServerSocketChannel listener = openChannel(channelGroup);
+ listener.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+ listener.bind(new InetSocketAddress(port));
+ return listener;
+ }
+
+ private AsynchronousServerSocketChannel openChannel(AsynchronousChannelGroup channelGroup) throws IOException {
+ return AsynchronousServerSocketChannel.open(channelGroup);
+ }
+
+ /**
+ * Creates a new client and adds it to the list of connections.
+ * Sets the clients handler to the initial state of NameReader
+ *
+ * @param channel the newly accepted channel
+ */
+ private void handleNewConnection(AsynchronousSocketChannel channel) {
+ Client client = new Client(channel, new ClientReader(this, new NameReader(this)));
+ try {
+ channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
+ } catch (IOException e) {
+ // ignore
+ }
+ connections.add(client);
+ client.run();
+ }
+
+ /**
+ * Sends a message to all clients except the source.
+ * The method is synchronized as it is desired that messages are sent to
+ * all clients in the same order as received.
+ *
+ * @param client the message source
+ * @param message the message to be sent
+ */
+ public void writeMessageToClients(Client client, String message) {
+ synchronized (connections) {
+ for (Client clientConnection : connections) {
+ if (clientConnection != client) {
+ clientConnection.writeMessageFrom(client, message);
+ }
+ }
+ }
+ }
+
+ public void removeClient(Client client) {
+ connections.remove(client);
+ }
+
+ private static void usage() {
+ System.err.println("ChatServer [-port <port number>]");
+ System.exit(1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ int port = 5000;
+ if (args.length != 0 && args.length != 2) {
+ usage();
+ } else if (args.length == 2) {
+ try {
+ if (args[0].equals("-port")) {
+ port = Integer.parseInt(args[1]);
+ } else {
+ usage();
+ }
+ } catch (NumberFormatException e) {
+ usage();
+ }
+ }
+ System.out.println("Running on port " + port);
+ new ChatServer(port).run();
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/chatserver/Client.java b/staging/darwin-x86/sample/nio/chatserver/Client.java
new file mode 100644
index 0000000..31ee034
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/chatserver/Client.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousSocketChannel;
+import java.nio.channels.CompletionHandler;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Client represents a remote connection to the chat server.
+ * It contains methods for reading and writing messages from the
+ * channel.
+ * Messages are considered to be separated by newline, so incomplete
+ * messages are buffered in the {@code Client}.
+ *
+ * All reads and writes are asynchronous and uses the nio2 asynchronous
+ * elements.
+ */
+class Client {
+ private final AsynchronousSocketChannel channel;
+ private AtomicReference<ClientReader> reader;
+ private String userName;
+ private final StringBuilder messageBuffer = new StringBuilder();
+
+ private final Queue<ByteBuffer> queue = new LinkedList<ByteBuffer>();
+ private boolean writing = false;
+
+ public Client(AsynchronousSocketChannel channel, ClientReader reader) {
+ this.channel = channel;
+ this.reader = new AtomicReference<ClientReader>(reader);
+ }
+
+ /**
+ * Enqueues a write of the buffer to the channel.
+ * The call is asynchronous so the buffer is not safe to modify after
+ * passing the buffer here.
+ *
+ * @param buffer the buffer to send to the channel
+ */
+ private void writeMessage(final ByteBuffer buffer) {
+ boolean threadShouldWrite = false;
+
+ synchronized(queue) {
+ queue.add(buffer);
+ // Currently no thread writing, make this thread dispatch a write
+ if (!writing) {
+ writing = true;
+ threadShouldWrite = true;
+ }
+ }
+
+ if (threadShouldWrite) {
+ writeFromQueue();
+ }
+ }
+
+ private void writeFromQueue() {
+ ByteBuffer buffer;
+
+ synchronized (queue) {
+ buffer = queue.poll();
+ if (buffer == null) {
+ writing = false;
+ }
+ }
+
+ // No new data in buffer to write
+ if (writing) {
+ writeBuffer(buffer);
+ }
+ }
+
+ private void writeBuffer(ByteBuffer buffer) {
+ channel.write(buffer, buffer, new CompletionHandler<Integer, ByteBuffer>() {
+ @Override
+ public void completed(Integer result, ByteBuffer buffer) {
+ if (buffer.hasRemaining()) {
+ channel.write(buffer, buffer, this);
+ } else {
+ // Go back and check if there is new data to write
+ writeFromQueue();
+ }
+ }
+
+ @Override
+ public void failed(Throwable exc, ByteBuffer attachment) {
+ }
+ });
+ }
+
+ /**
+ * Sends a message
+ * @param string the message
+ */
+ public void writeStringMessage(String string) {
+ writeMessage(ByteBuffer.wrap(string.getBytes()));
+ }
+
+ /**
+ * Send a message from a specific client
+ * @param client the message is sent from
+ * @param message to send
+ */
+ public void writeMessageFrom(Client client, String message) {
+ if (reader.get().acceptsMessages()) {
+ writeStringMessage(client.getUserName() + ": " + message);
+ }
+ }
+
+ /**
+ * Enqueue a read
+ * @param completionHandler callback on completed read
+ */
+ public void read(CompletionHandler<Integer, ? super ByteBuffer> completionHandler) {
+ ByteBuffer input = ByteBuffer.allocate(256);
+ if (!channel.isOpen()) {
+ return;
+ }
+ channel.read(input, input, completionHandler);
+ }
+
+ /**
+ * Closes the channel
+ */
+ public void close() {
+ try {
+ channel.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Run the current states actions.
+ */
+ public void run() {
+ reader.get().run(this);
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public void setReader(ClientReader reader) {
+ this.reader.set(reader);
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void appendMessage(String message) {
+ synchronized (messageBuffer) {
+ messageBuffer.append(message);
+ }
+ }
+
+ /**
+ * @return the next newline separated message in the buffer. null is returned if the buffer
+ * doesn't contain any newline.
+ */
+ public String nextMessage() {
+ synchronized(messageBuffer) {
+ int nextNewline = messageBuffer.indexOf("\n");
+ if (nextNewline == -1) {
+ return null;
+ }
+ String message = messageBuffer.substring(0, nextNewline + 1);
+ messageBuffer.delete(0, nextNewline + 1);
+ return message;
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/chatserver/ClientReader.java b/staging/darwin-x86/sample/nio/chatserver/ClientReader.java
new file mode 100644
index 0000000..822125a
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/chatserver/ClientReader.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+import java.nio.channels.CompletionHandler;
+
+/**
+ * Handles a cycle of reading / writing on the {@code Client}.
+ */
+class ClientReader {
+ private final DataReader callback;
+ private final ChatServer chatServer;
+
+ ClientReader(ChatServer chatServer, DataReader callback) {
+ this.chatServer = chatServer;
+ this.callback = callback;
+ }
+
+ public boolean acceptsMessages() {
+ return callback.acceptsMessages();
+ }
+
+ /**
+ * Runs a cycle of doing a beforeRead action and then enqueuing a new
+ * read on the client. Handles closed channels and errors while reading.
+ * If the client is still connected a new round of actions are called.
+ */
+ public void run(final Client client) {
+ callback.beforeRead(client);
+ client.read(new CompletionHandler<Integer, ByteBuffer>() {
+ @Override
+ public void completed(Integer result, ByteBuffer buffer) {
+ // if result is negative or zero the connection has been closed or something gone wrong
+ if (result < 1) {
+ client.close();
+ System.out.println("Closing connection to " + client);
+ chatServer.removeClient(client);
+ } else {
+ callback.onData(client, buffer, result);
+ // enqueue next round of actions
+ client.run();
+ }
+ }
+
+ @Override
+ public void failed(Throwable exc, ByteBuffer buffer) {
+ client.close();
+ chatServer.removeClient(client);
+ }
+ });
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/chatserver/DataReader.java b/staging/darwin-x86/sample/nio/chatserver/DataReader.java
new file mode 100644
index 0000000..8858c9f
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/chatserver/DataReader.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+
+public interface DataReader {
+ void beforeRead(Client client);
+ void onData(Client client, ByteBuffer buffer, int bytes);
+ boolean acceptsMessages();
+}
diff --git a/staging/darwin-x86/sample/nio/chatserver/MessageReader.java b/staging/darwin-x86/sample/nio/chatserver/MessageReader.java
new file mode 100644
index 0000000..81c370b
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/chatserver/MessageReader.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+
+/**
+ * Writes all messages in our buffer to the other clients
+ * and appends new data read from the socket to our buffer
+ */
+class MessageReader implements DataReader {
+ private final ChatServer chatServer;
+
+ public MessageReader(ChatServer chatServer) {
+ this.chatServer = chatServer;
+ }
+
+ public boolean acceptsMessages() {
+ return true;
+ }
+
+ /**
+ * Write all full messages in our buffer to
+ * the other clients
+ *
+ * @param client the client to read messages from
+ */
+ @Override
+ public void beforeRead(Client client) {
+ // Check if we have any messages buffered and send them
+ String message = client.nextMessage();
+ while (message != null) {
+ chatServer.writeMessageToClients(client, message);
+ message = client.nextMessage();
+ }
+ }
+
+ /**
+ * Append the read buffer to the clients message buffer
+ * @param client the client to append messages to
+ * @param buffer the buffer we received from the socket
+ * @param bytes the number of bytes read into the buffer
+ */
+ @Override
+ public void onData(Client client, ByteBuffer buffer, int bytes) {
+ buffer.flip();
+ // Just append the message on the buffer
+ client.appendMessage(new String(buffer.array(), 0, bytes));
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/chatserver/NameReader.java b/staging/darwin-x86/sample/nio/chatserver/NameReader.java
new file mode 100644
index 0000000..341d4da
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/chatserver/NameReader.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+
+/**
+ * The first state a newly connected {@code Client} is in, this
+ * handles writing out the welcoming message and reads the response
+ * up to a newline. When a newline character have been received
+ * it changes the handler from NameReader to MessageReader on the
+ * client.
+ */
+class NameReader implements DataReader {
+ private final StringBuilder buffer = new StringBuilder();
+ private final ChatServer chatServer;
+ private boolean once = true;
+ private static final String NEWLINE = "\n";
+
+ public NameReader(ChatServer chatServer) {
+ this.chatServer = chatServer;
+ }
+
+ /**
+ * Writes the welcoming message to the client the first time this method
+ * is called.
+ *
+ * @param client the client to receive the message
+ */
+ @Override
+ public void beforeRead(Client client) {
+ // if it is a long name that takes more than one read we only want to display Name: once.
+ if (once) {
+ client.writeStringMessage("Name: ");
+ once = false;
+ }
+ }
+
+ public boolean acceptsMessages() {
+ return false;
+ }
+
+ /**
+ * Receives incoming data from the socket, searches for a newline
+ * and tries to set the username if one is found
+ */
+ @Override
+ public void onData(Client client, ByteBuffer buffer, int bytes) {
+ buffer.flip();
+ String name;
+ name = this.buffer.append(new String(buffer.array(), 0, bytes)).toString();
+ if (name.contains(NEWLINE)) {
+ onUserNameRead(client, name);
+ }
+ }
+
+ /**
+ * Splits the name on the newlines, takes the first as the username
+ * and appends everything else to the clients message buffer.
+ * Sets the clients handler to MessageReader.
+ *
+ * @param client the client to set the username for
+ * @param name the string containing the buffered input
+ */
+ private void onUserNameRead(Client client, String name) {
+ String[] strings = name.split(NEWLINE, 2);
+ client.setUserName(strings[0].trim());
+ sendRemainingParts(client, strings);
+ client.setReader(new ClientReader(chatServer, new MessageReader(chatServer)));
+ client.writeStringMessage("Welcome " + client.getUserName() + "\n");
+ }
+
+ /**
+ * Appends the remaining parts to the clients message buffer
+ *
+ * @param client the client
+ * @param strings the messages to append to the buffer
+ */
+ private void sendRemainingParts(Client client, String[] strings) {
+ for (int i = 1; i < strings.length; ++i) {
+ client.appendMessage(strings[i]);
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/chatserver/README.txt b/staging/darwin-x86/sample/nio/chatserver/README.txt
new file mode 100644
index 0000000..ec9b476
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/chatserver/README.txt
@@ -0,0 +1,62 @@
+A Simple Chat Server Example
+
+INTRODUCTION
+============
+This directory contains a very simple chat server, the server takes input from a
+socket ("user") and sends it to all other connected sockets ("users") along with
+the provided name the user was asked for when first connecting.
+
+The server was written to demonstrate the asynchronous I/O API in JDK 7.
+The sample assumes the reader has some familiarity with the subject matter.
+
+SETUP
+=====
+
+The server must be built with version 7 (or later) of the JDK.
+The server is built with:
+
+ % mkdir build
+ % javac -source 7 -target 7 -d build *.java
+
+EXECUTION
+=========
+
+ % java -classpath build ChatServer [-port <port number>]
+
+ Usage: ChatServer [options]
+ options:
+ -port port port number
+ default: 5000
+
+CLIENT EXECUTION
+================
+
+No client binary is included in the sample.
+Connections can be made using for example the telnet command or any program
+that supports a raw TCP connection to a port.
+
+SOURCE CODE OVERVIEW
+====================
+ChatServer is the main class, it handles the startup and handles incoming
+connections on the listening sockets. It keeps a list of connected client
+and provides methods for sending a message to them.
+
+Client represents a connected user, it provides methods for reading/writing
+from/to the underlying socket. It also contains a buffer of input read from
+the user.
+
+DataReader provides the interface of the two states a user can
+be in. Waiting for a name (and not receiving any messages while doing so, implemented
+by NameReader) and waiting for messages from the user (implemented by MessageReader).
+
+ClientReader contains the "main loop" for a connected client.
+
+NameReader is the initial state for a new client, it sends the user a string and
+waits for a response before changing the state to MessageReader.
+
+MessageReader is the main state for a client, it checks for new messages to send to
+other clients and reads messages from the client.
+
+FINALLY
+=======
+This is a sample: it is not production quality and isn't optimized for performance.
diff --git a/staging/darwin-x86/sample/nio/file/AclEdit.java b/staging/darwin-x86/sample/nio/file/AclEdit.java
new file mode 100644
index 0000000..90af865
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/file/AclEdit.java
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+import java.util.*;
+import java.util.regex.Pattern;
+
+/**
+ * Sample utility for editing a file's ACL.
+ */
+
+public class AclEdit {
+
+ // parse string as list of ACE permissions separated by /
+ static Set<AclEntryPermission> parsePermissions(String permsString) {
+ Set<AclEntryPermission> perms = new HashSet<AclEntryPermission>();
+ String[] result = permsString.split("/");
+ for (String s : result) {
+ if (s.equals(""))
+ continue;
+ try {
+ perms.add(AclEntryPermission.valueOf(s.toUpperCase()));
+ } catch (IllegalArgumentException x) {
+ System.err.format("Invalid permission '%s'\n", s);
+ System.exit(-1);
+ }
+ }
+ return perms;
+ }
+
+ // parse string as list of ACE flags separated by /
+ static Set<AclEntryFlag> parseFlags(String flagsString) {
+ Set<AclEntryFlag> flags = new HashSet<AclEntryFlag>();
+ String[] result = flagsString.split("/");
+ for (String s : result) {
+ if (s.equals(""))
+ continue;
+ try {
+ flags.add(AclEntryFlag.valueOf(s.toUpperCase()));
+ } catch (IllegalArgumentException x) {
+ System.err.format("Invalid flag '%s'\n", s);
+ System.exit(-1);
+ }
+ }
+ return flags;
+ }
+
+ // parse ACE type
+ static AclEntryType parseType(String typeString) {
+ // FIXME: support audit and alarm types in the future
+ if (typeString.equalsIgnoreCase("allow"))
+ return AclEntryType.ALLOW;
+ if (typeString.equalsIgnoreCase("deny"))
+ return AclEntryType.DENY;
+ System.err.format("Invalid type '%s'\n", typeString);
+ System.exit(-1);
+ return null; // keep compiler happy
+ }
+
+ /**
+ * Parse string of the form:
+ * [user|group:]<username|groupname>:<perms>[:flags]:<allow|deny>
+ */
+ static AclEntry parseAceString(String s,
+ UserPrincipalLookupService lookupService)
+ {
+ String[] result = s.split(":");
+
+ // must have at least 3 components (username:perms:type)
+ if (result.length < 3)
+ usage();
+
+ int index = 0;
+ int remaining = result.length;
+
+ // optional first component can indicate user or group type
+ boolean isGroup = false;
+ if (result[index].equalsIgnoreCase("user") ||
+ result[index].equalsIgnoreCase("group"))
+ {
+ if (--remaining < 3)
+ usage();
+ isGroup = result[index++].equalsIgnoreCase("group");
+ }
+
+ // user and permissions required
+ String userString = result[index++]; remaining--;
+ String permsString = result[index++]; remaining--;
+
+ // flags are optional
+ String flagsString = "";
+ String typeString = null;
+ if (remaining == 1) {
+ typeString = result[index++];
+ } else {
+ if (remaining == 2) {
+ flagsString = result[index++];
+ typeString = result[index++];
+ } else {
+ usage();
+ }
+ }
+
+ // lookup UserPrincipal
+ UserPrincipal user = null;
+ try {
+ user = (isGroup) ?
+ lookupService.lookupPrincipalByGroupName(userString) :
+ lookupService.lookupPrincipalByName(userString);
+ } catch (UserPrincipalNotFoundException x) {
+ System.err.format("Invalid %s '%s'\n",
+ ((isGroup) ? "group" : "user"),
+ userString);
+ System.exit(-1);
+ } catch (IOException x) {
+ System.err.format("Lookup of '%s' failed: %s\n", userString, x);
+ System.exit(-1);
+ }
+
+ // map string representation of permissions, flags, and type
+ Set<AclEntryPermission> perms = parsePermissions(permsString);
+ Set<AclEntryFlag> flags = parseFlags(flagsString);
+ AclEntryType type = parseType(typeString);
+
+ // build the ACL entry
+ return AclEntry.newBuilder()
+ .setType(type)
+ .setPrincipal(user)
+ .setPermissions(perms).setFlags(flags).build();
+ }
+
+ static void usage() {
+ System.err.println("usage: java AclEdit [ACL-operation] file");
+ System.err.println("");
+ System.err.println("Example 1: Prepends access control entry to the begining of the myfile's ACL");
+ System.err.println(" java AclEdit A+alice:read_data/read_attributes:allow myfile");
+ System.err.println("");
+ System.err.println("Example 2: Remove the entry at index 6 of myfile's ACL");
+ System.err.println(" java AclEdit A6- myfile");
+ System.err.println("");
+ System.err.println("Example 3: Replace the entry at index 2 of myfile's ACL");
+ System.err.println(" java AclEdit A2=bob:write_data/append_data:deny myfile");
+ System.exit(-1);
+ }
+
+ static enum Action {
+ PRINT,
+ ADD,
+ REMOVE,
+ REPLACE;
+ }
+
+ /**
+ * Main class: parses arguments and prints or edits ACL
+ */
+ public static void main(String[] args) throws IOException {
+ Action action = null;
+ int index = -1;
+ String entryString = null;
+
+ // parse arguments
+ if (args.length < 1 || args[0].equals("-help") || args[0].equals("-?"))
+ usage();
+
+ if (args.length == 1) {
+ action = Action.PRINT;
+ } else {
+ String s = args[0];
+
+ // A[index]+entry
+ if (Pattern.matches("^A[0-9]*\\+.*", s)) {
+ String[] result = s.split("\\+", 2);
+ if (result.length == 2) {
+ if (result[0].length() < 2) {
+ index = 0;
+ } else {
+ index = Integer.parseInt(result[0].substring(1));
+ }
+ entryString = result[1];
+ action = Action.ADD;
+ }
+ }
+
+ // Aindex-
+ if (Pattern.matches("^A[0-9]+\\-", s)) {
+ String[] result = s.split("\\-", 2);
+ if (result.length == 2) {
+ index = Integer.parseInt(result[0].substring(1));
+ entryString = result[1];
+ action = Action.REMOVE;
+ }
+ }
+
+ // Aindex=entry
+ if (Pattern.matches("^A[0-9]+=.*", s)) {
+ String[] result = s.split("=", 2);
+ if (result.length == 2) {
+ index = Integer.parseInt(result[0].substring(1));
+ entryString = result[1];
+ action = Action.REPLACE;
+ }
+ }
+ }
+ if (action == null)
+ usage();
+
+ int fileArg = (action == Action.PRINT) ? 0 : 1;
+ Path file = Paths.get(args[fileArg]);
+
+ // read file's ACL
+ AclFileAttributeView view =
+ Files.getFileAttributeView(file, AclFileAttributeView.class);
+ if (view == null) {
+ System.err.println("ACLs not supported on this platform");
+ System.exit(-1);
+ }
+ List<AclEntry> acl = view.getAcl();
+
+ switch (action) {
+ // print ACL
+ case PRINT : {
+ for (int i=0; i<acl.size(); i++) {
+ System.out.format("%5d: %s\n", i, acl.get(i));
+ }
+ break;
+ }
+
+ // add ACE to existing ACL
+ case ADD: {
+ AclEntry entry = parseAceString(entryString, file
+ .getFileSystem().getUserPrincipalLookupService());
+ if (index >= acl.size()) {
+ acl.add(entry);
+ } else {
+ acl.add(index, entry);
+ }
+ view.setAcl(acl);
+ break;
+ }
+
+ // remove ACE
+ case REMOVE: {
+ if (index >= acl.size()) {
+ System.err.format("Index '%d' is invalid", index);
+ System.exit(-1);
+ }
+ acl.remove(index);
+ view.setAcl(acl);
+ break;
+ }
+
+ // replace ACE
+ case REPLACE: {
+ if (index >= acl.size()) {
+ System.err.format("Index '%d' is invalid", index);
+ System.exit(-1);
+ }
+ AclEntry entry = parseAceString(entryString, file
+ .getFileSystem().getUserPrincipalLookupService());
+ acl.set(index, entry);
+ view.setAcl(acl);
+ break;
+ }
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/file/Chmod.java b/staging/darwin-x86/sample/nio/file/Chmod.java
new file mode 100644
index 0000000..05c16b9
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/file/Chmod.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import static java.nio.file.attribute.PosixFilePermission.*;
+import static java.nio.file.FileVisitResult.*;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Sample code that changes the permissions of files in a similar manner to the
+ * chmod(1) program.
+ */
+
+public class Chmod {
+
+ /**
+ * Compiles a list of one or more <em>symbolic mode expressions</em> that
+ * may be used to change a set of file permissions. This method is
+ * intended for use where file permissions are required to be changed in
+ * a manner similar to the UNIX <i>chmod</i> program.
+ *
+ * <p> The {@code exprs} parameter is a comma separated list of expressions
+ * where each takes the form:
+ * <blockquote>
+ * <i>who operator</i> [<i>permissions</i>]
+ * </blockquote>
+ * where <i>who</i> is one or more of the characters {@code 'u'}, {@code 'g'},
+ * {@code 'o'}, or {@code 'a'} meaning the owner (user), group, others, or
+ * all (owner, group, and others) respectively.
+ *
+ * <p> <i>operator</i> is the character {@code '+'}, {@code '-'}, or {@code
+ * '='} signifying how permissions are to be changed. {@code '+'} means the
+ * permissions are added, {@code '-'} means the permissions are removed, and
+ * {@code '='} means the permissions are assigned absolutely.
+ *
+ * <p> <i>permissions</i> is a sequence of zero or more of the following:
+ * {@code 'r'} for read permission, {@code 'w'} for write permission, and
+ * {@code 'x'} for execute permission. If <i>permissions</i> is omitted
+ * when assigned absolutely, then the permissions are cleared for
+ * the owner, group, or others as identified by <i>who</i>. When omitted
+ * when adding or removing then the expression is ignored.
+ *
+ * <p> The following examples demonstrate possible values for the {@code
+ * exprs} parameter:
+ *
+ * <table border="0">
+ * <tr>
+ * <td> {@code u=rw} </td>
+ * <td> Sets the owner permissions to be read and write. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code ug+w} </td>
+ * <td> Sets the owner write and group write permissions. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code u+w,o-rwx} </td>
+ * <td> Sets the owner write, and removes the others read, others write
+ * and others execute permissions. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code o=} </td>
+ * <td> Sets the others permission to none (others read, others write and
+ * others execute permissions are removed if set) </td>
+ * </tr>
+ * </table>
+ *
+ * @param exprs
+ * List of one or more <em>symbolic mode expressions</em>
+ *
+ * @return A {@code Changer} that may be used to changer a set of
+ * file permissions
+ *
+ * @throws IllegalArgumentException
+ * If the value of the {@code exprs} parameter is invalid
+ */
+ public static Changer compile(String exprs) {
+ // minimum is who and operator (u= for example)
+ if (exprs.length() < 2)
+ throw new IllegalArgumentException("Invalid mode");
+
+ // permissions that the changer will add or remove
+ final Set<PosixFilePermission> toAdd = new HashSet<PosixFilePermission>();
+ final Set<PosixFilePermission> toRemove = new HashSet<PosixFilePermission>();
+
+ // iterate over each of expression modes
+ for (String expr: exprs.split(",")) {
+ // minimum of who and operator
+ if (expr.length() < 2)
+ throw new IllegalArgumentException("Invalid mode");
+
+ int pos = 0;
+
+ // who
+ boolean u = false;
+ boolean g = false;
+ boolean o = false;
+ boolean done = false;
+ for (;;) {
+ switch (expr.charAt(pos)) {
+ case 'u' : u = true; break;
+ case 'g' : g = true; break;
+ case 'o' : o = true; break;
+ case 'a' : u = true; g = true; o = true; break;
+ default : done = true;
+ }
+ if (done)
+ break;
+ pos++;
+ }
+ if (!u && !g && !o)
+ throw new IllegalArgumentException("Invalid mode");
+
+ // get operator and permissions
+ char op = expr.charAt(pos++);
+ String mask = (expr.length() == pos) ? "" : expr.substring(pos);
+
+ // operator
+ boolean add = (op == '+');
+ boolean remove = (op == '-');
+ boolean assign = (op == '=');
+ if (!add && !remove && !assign)
+ throw new IllegalArgumentException("Invalid mode");
+
+ // who= means remove all
+ if (assign && mask.length() == 0) {
+ assign = false;
+ remove = true;
+ mask = "rwx";
+ }
+
+ // permissions
+ boolean r = false;
+ boolean w = false;
+ boolean x = false;
+ for (int i=0; i<mask.length(); i++) {
+ switch (mask.charAt(i)) {
+ case 'r' : r = true; break;
+ case 'w' : w = true; break;
+ case 'x' : x = true; break;
+ default:
+ throw new IllegalArgumentException("Invalid mode");
+ }
+ }
+
+ // update permissions set
+ if (add) {
+ if (u) {
+ if (r) toAdd.add(OWNER_READ);
+ if (w) toAdd.add(OWNER_WRITE);
+ if (x) toAdd.add(OWNER_EXECUTE);
+ }
+ if (g) {
+ if (r) toAdd.add(GROUP_READ);
+ if (w) toAdd.add(GROUP_WRITE);
+ if (x) toAdd.add(GROUP_EXECUTE);
+ }
+ if (o) {
+ if (r) toAdd.add(OTHERS_READ);
+ if (w) toAdd.add(OTHERS_WRITE);
+ if (x) toAdd.add(OTHERS_EXECUTE);
+ }
+ }
+ if (remove) {
+ if (u) {
+ if (r) toRemove.add(OWNER_READ);
+ if (w) toRemove.add(OWNER_WRITE);
+ if (x) toRemove.add(OWNER_EXECUTE);
+ }
+ if (g) {
+ if (r) toRemove.add(GROUP_READ);
+ if (w) toRemove.add(GROUP_WRITE);
+ if (x) toRemove.add(GROUP_EXECUTE);
+ }
+ if (o) {
+ if (r) toRemove.add(OTHERS_READ);
+ if (w) toRemove.add(OTHERS_WRITE);
+ if (x) toRemove.add(OTHERS_EXECUTE);
+ }
+ }
+ if (assign) {
+ if (u) {
+ if (r) toAdd.add(OWNER_READ);
+ else toRemove.add(OWNER_READ);
+ if (w) toAdd.add(OWNER_WRITE);
+ else toRemove.add(OWNER_WRITE);
+ if (x) toAdd.add(OWNER_EXECUTE);
+ else toRemove.add(OWNER_EXECUTE);
+ }
+ if (g) {
+ if (r) toAdd.add(GROUP_READ);
+ else toRemove.add(GROUP_READ);
+ if (w) toAdd.add(GROUP_WRITE);
+ else toRemove.add(GROUP_WRITE);
+ if (x) toAdd.add(GROUP_EXECUTE);
+ else toRemove.add(GROUP_EXECUTE);
+ }
+ if (o) {
+ if (r) toAdd.add(OTHERS_READ);
+ else toRemove.add(OTHERS_READ);
+ if (w) toAdd.add(OTHERS_WRITE);
+ else toRemove.add(OTHERS_WRITE);
+ if (x) toAdd.add(OTHERS_EXECUTE);
+ else toRemove.add(OTHERS_EXECUTE);
+ }
+ }
+ }
+
+ // return changer
+ return new Changer() {
+ @Override
+ public Set<PosixFilePermission> change(Set<PosixFilePermission> perms) {
+ perms.addAll(toAdd);
+ perms.removeAll(toRemove);
+ return perms;
+ }
+ };
+ }
+
+ /**
+ * A task that <i>changes</i> a set of {@link PosixFilePermission} elements.
+ */
+ public interface Changer {
+ /**
+ * Applies the changes to the given set of permissions.
+ *
+ * @param perms
+ * The set of permissions to change
+ *
+ * @return The {@code perms} parameter
+ */
+ Set<PosixFilePermission> change(Set<PosixFilePermission> perms);
+ }
+
+ /**
+ * Changes the permissions of the file using the given Changer.
+ */
+ static void chmod(Path file, Changer changer) {
+ try {
+ Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file);
+ Files.setPosixFilePermissions(file, changer.change(perms));
+ } catch (IOException x) {
+ System.err.println(x);
+ }
+ }
+
+ /**
+ * Changes the permission of each file and directory visited
+ */
+ static class TreeVisitor implements FileVisitor<Path> {
+ private final Changer changer;
+
+ TreeVisitor(Changer changer) {
+ this.changer = changer;
+ }
+
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+ chmod(dir, changer);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+ chmod(file, changer);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
+ if (exc != null)
+ System.err.println("WARNING: " + exc);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) {
+ System.err.println("WARNING: " + exc);
+ return CONTINUE;
+ }
+ }
+
+ static void usage() {
+ System.err.println("java Chmod [-R] symbolic-mode-list file...");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ if (args.length < 2)
+ usage();
+ int argi = 0;
+ int maxDepth = 0;
+ if (args[argi].equals("-R")) {
+ if (args.length < 3)
+ usage();
+ argi++;
+ maxDepth = Integer.MAX_VALUE;
+ }
+
+ // compile the symbolic mode expressions
+ Changer changer = compile(args[argi++]);
+ TreeVisitor visitor = new TreeVisitor(changer);
+
+ Set<FileVisitOption> opts = Collections.emptySet();
+ while (argi < args.length) {
+ Path file = Paths.get(args[argi]);
+ Files.walkFileTree(file, opts, maxDepth, visitor);
+ argi++;
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/file/Copy.java b/staging/darwin-x86/sample/nio/file/Copy.java
new file mode 100644
index 0000000..0d61ef3
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/file/Copy.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import static java.nio.file.StandardCopyOption.*;
+import java.nio.file.attribute.*;
+import static java.nio.file.FileVisitResult.*;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Sample code that copies files in a similar manner to the cp(1) program.
+ */
+
+public class Copy {
+
+ /**
+ * Returns {@code true} if okay to overwrite a file ("cp -i")
+ */
+ static boolean okayToOverwrite(Path file) {
+ String answer = System.console().readLine("overwrite %s (yes/no)? ", file);
+ return (answer.equalsIgnoreCase("y") || answer.equalsIgnoreCase("yes"));
+ }
+
+ /**
+ * Copy source file to target location. If {@code prompt} is true then
+ * prompt user to overwrite target if it exists. The {@code preserve}
+ * parameter determines if file attributes should be copied/preserved.
+ */
+ static void copyFile(Path source, Path target, boolean prompt, boolean preserve) {
+ CopyOption[] options = (preserve) ?
+ new CopyOption[] { COPY_ATTRIBUTES, REPLACE_EXISTING } :
+ new CopyOption[] { REPLACE_EXISTING };
+ if (!prompt || Files.notExists(target) || okayToOverwrite(target)) {
+ try {
+ Files.copy(source, target, options);
+ } catch (IOException x) {
+ System.err.format("Unable to copy: %s: %s%n", source, x);
+ }
+ }
+ }
+
+ /**
+ * A {@code FileVisitor} that copies a file-tree ("cp -r")
+ */
+ static class TreeCopier implements FileVisitor<Path> {
+ private final Path source;
+ private final Path target;
+ private final boolean prompt;
+ private final boolean preserve;
+
+ TreeCopier(Path source, Path target, boolean prompt, boolean preserve) {
+ this.source = source;
+ this.target = target;
+ this.prompt = prompt;
+ this.preserve = preserve;
+ }
+
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+ // before visiting entries in a directory we copy the directory
+ // (okay if directory already exists).
+ CopyOption[] options = (preserve) ?
+ new CopyOption[] { COPY_ATTRIBUTES } : new CopyOption[0];
+
+ Path newdir = target.resolve(source.relativize(dir));
+ try {
+ Files.copy(dir, newdir, options);
+ } catch (FileAlreadyExistsException x) {
+ // ignore
+ } catch (IOException x) {
+ System.err.format("Unable to create: %s: %s%n", newdir, x);
+ return SKIP_SUBTREE;
+ }
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+ copyFile(file, target.resolve(source.relativize(file)),
+ prompt, preserve);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
+ // fix up modification time of directory when done
+ if (exc == null && preserve) {
+ Path newdir = target.resolve(source.relativize(dir));
+ try {
+ FileTime time = Files.getLastModifiedTime(dir);
+ Files.setLastModifiedTime(newdir, time);
+ } catch (IOException x) {
+ System.err.format("Unable to copy all attributes to: %s: %s%n", newdir, x);
+ }
+ }
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) {
+ if (exc instanceof FileSystemLoopException) {
+ System.err.println("cycle detected: " + file);
+ } else {
+ System.err.format("Unable to copy: %s: %s%n", file, exc);
+ }
+ return CONTINUE;
+ }
+ }
+
+ static void usage() {
+ System.err.println("java Copy [-ip] source... target");
+ System.err.println("java Copy -r [-ip] source-dir... target");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ boolean recursive = false;
+ boolean prompt = false;
+ boolean preserve = false;
+
+ // process options
+ int argi = 0;
+ while (argi < args.length) {
+ String arg = args[argi];
+ if (!arg.startsWith("-"))
+ break;
+ if (arg.length() < 2)
+ usage();
+ for (int i=1; i<arg.length(); i++) {
+ char c = arg.charAt(i);
+ switch (c) {
+ case 'r' : recursive = true; break;
+ case 'i' : prompt = true; break;
+ case 'p' : preserve = true; break;
+ default : usage();
+ }
+ }
+ argi++;
+ }
+
+ // remaining arguments are the source files(s) and the target location
+ int remaining = args.length - argi;
+ if (remaining < 2)
+ usage();
+ Path[] source = new Path[remaining-1];
+ int i=0;
+ while (remaining > 1) {
+ source[i++] = Paths.get(args[argi++]);
+ remaining--;
+ }
+ Path target = Paths.get(args[argi]);
+
+ // check if target is a directory
+ boolean isDir = Files.isDirectory(target);
+
+ // copy each source file/directory to target
+ for (i=0; i<source.length; i++) {
+ Path dest = (isDir) ? target.resolve(source[i].getFileName()) : target;
+
+ if (recursive) {
+ // follow links when copying files
+ EnumSet<FileVisitOption> opts = EnumSet.of(FileVisitOption.FOLLOW_LINKS);
+ TreeCopier tc = new TreeCopier(source[i], dest, prompt, preserve);
+ Files.walkFileTree(source[i], opts, Integer.MAX_VALUE, tc);
+ } else {
+ // not recursive so source must not be a directory
+ if (Files.isDirectory(source[i])) {
+ System.err.format("%s: is a directory%n", source[i]);
+ continue;
+ }
+ copyFile(source[i], dest, prompt, preserve);
+ }
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/file/DiskUsage.java b/staging/darwin-x86/sample/nio/file/DiskUsage.java
new file mode 100644
index 0000000..7d30bdf
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/file/DiskUsage.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+
+/**
+ * Example utility that works like the df(1M) program to print out disk space
+ * information
+ */
+
+public class DiskUsage {
+
+ static final long K = 1024;
+
+ static void printFileStore(FileStore store) throws IOException {
+ long total = store.getTotalSpace() / K;
+ long used = (store.getTotalSpace() - store.getUnallocatedSpace()) / K;
+ long avail = store.getUsableSpace() / K;
+
+ String s = store.toString();
+ if (s.length() > 20) {
+ System.out.println(s);
+ s = "";
+ }
+ System.out.format("%-20s %12d %12d %12d\n", s, total, used, avail);
+ }
+
+ public static void main(String[] args) throws IOException {
+ System.out.format("%-20s %12s %12s %12s\n", "Filesystem", "kbytes", "used", "avail");
+ if (args.length == 0) {
+ FileSystem fs = FileSystems.getDefault();
+ for (FileStore store: fs.getFileStores()) {
+ printFileStore(store);
+ }
+ } else {
+ for (String file: args) {
+ FileStore store = Files.getFileStore(Paths.get(file));
+ printFileStore(store);
+ }
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/file/FileType.java b/staging/darwin-x86/sample/nio/file/FileType.java
new file mode 100644
index 0000000..d001d60
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/file/FileType.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.io.IOException;
+
+public class FileType {
+ public static void main(String[] args) throws IOException {
+ if (args.length == 0) {
+ System.err.println("usage: java FileType file...");
+ System.exit(-1);
+ }
+ for (String arg: args) {
+ Path file = Paths.get(arg);
+ String type;
+ if (Files.isDirectory(file)) {
+ type = "directory";
+ } else {
+ type = Files.probeContentType(file);
+ if (type == null)
+ type = "<not recognized>";
+ }
+ System.out.format("%s\t%s%n", file, type);
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/file/WatchDir.java b/staging/darwin-x86/sample/nio/file/WatchDir.java
new file mode 100644
index 0000000..4c73820
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/file/WatchDir.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import static java.nio.file.StandardWatchEventKinds.*;
+import static java.nio.file.LinkOption.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+
+/**
+ * Example to watch a directory (or tree) for changes to files.
+ */
+
+public class WatchDir {
+
+ private final WatchService watcher;
+ private final boolean recursive;
+ private boolean trace = false;
+ private int count;
+
+ @SuppressWarnings("unchecked")
+ static <T> WatchEvent<T> cast(WatchEvent<?> event) {
+ return (WatchEvent<T>)event;
+ }
+
+ /**
+ * Register the given directory with the WatchService
+ */
+ private void register(Path dir) throws IOException {
+ WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
+ count++;
+ if (trace)
+ System.out.format("register: %s\n", dir);
+ }
+
+ /**
+ * Register the given directory, and all its sub-directories, with the
+ * WatchService.
+ */
+ private void registerAll(final Path start) throws IOException {
+ // register directory and sub-directories
+ Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
+ throws IOException
+ {
+ register(dir);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ }
+
+ /**
+ * Creates a WatchService and registers the given directory
+ */
+ WatchDir(Path dir, boolean recursive) throws IOException {
+ this.watcher = FileSystems.getDefault().newWatchService();
+ this.recursive = recursive;
+
+ if (recursive) {
+ System.out.format("Scanning %s ...\n", dir);
+ registerAll(dir);
+ System.out.println("Done.");
+ } else {
+ register(dir);
+ }
+
+ // enable trace after initial registration
+ this.trace = true;
+ }
+
+ /**
+ * Process all events for keys queued to the watcher
+ */
+ void processEvents() {
+ for (;;) {
+
+ // wait for key to be signalled
+ WatchKey key;
+ try {
+ key = watcher.take();
+ } catch (InterruptedException x) {
+ return;
+ }
+
+ for (WatchEvent<?> event: key.pollEvents()) {
+ WatchEvent.Kind kind = event.kind();
+
+ // TBD - provide example of how OVERFLOW event is handled
+ if (kind == OVERFLOW) {
+ continue;
+ }
+
+ // Context for directory entry event is the file name of entry
+ WatchEvent<Path> ev = cast(event);
+ Path name = ev.context();
+ Path child = ((Path)key.watchable()).resolve(name);
+
+ // print out event
+ System.out.format("%s: %s\n", event.kind().name(), child);
+
+ // if directory is created, and watching recursively, then
+ // register it and its sub-directories
+ if (recursive && (kind == ENTRY_CREATE)) {
+ try {
+ if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
+ registerAll(child);
+ }
+ } catch (IOException x) {
+ // ignore to keep sample readbale
+ }
+ }
+ }
+
+ // reset key
+ boolean valid = key.reset();
+ if (!valid) {
+ // directory no longer accessible
+ count--;
+ if (count == 0)
+ break;
+ }
+ }
+ }
+
+ static void usage() {
+ System.err.println("usage: java WatchDir [-r] dir");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ // parse arguments
+ if (args.length == 0 || args.length > 2)
+ usage();
+ boolean recursive = false;
+ int dirArg = 0;
+ if (args[0].equals("-r")) {
+ if (args.length < 2)
+ usage();
+ recursive = true;
+ dirArg++;
+ }
+
+ // register directory and process its events
+ Path dir = Paths.get(args[dirArg]);
+ new WatchDir(dir, recursive).processEvents();
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/file/Xdd.java b/staging/darwin-x86/sample/nio/file/Xdd.java
new file mode 100644
index 0000000..c0c7f87
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/file/Xdd.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+
+/**
+ * Example code to list/set/get/delete the user-defined attributes of a file.
+ */
+
+public class Xdd {
+
+ static void usage() {
+ System.out.println("Usage: java Xdd <file>");
+ System.out.println(" java Xdd -set <name>=<value> <file>");
+ System.out.println(" java Xdd -get <name> <file>");
+ System.out.println(" java Xdd -del <name> <file>");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ // one or three parameters
+ if (args.length != 1 && args.length != 3)
+ usage();
+
+ Path file = (args.length == 1) ?
+ Paths.get(args[0]) : Paths.get(args[2]);
+
+ // check that user defined attributes are supported by the file store
+ FileStore store = Files.getFileStore(file);
+ if (!store.supportsFileAttributeView(UserDefinedFileAttributeView.class)) {
+ System.err.format("UserDefinedFileAttributeView not supported on %s\n", store);
+ System.exit(-1);
+
+ }
+ UserDefinedFileAttributeView view =
+ Files.getFileAttributeView(file, UserDefinedFileAttributeView.class);
+
+ // list user defined attributes
+ if (args.length == 1) {
+ System.out.println(" Size Name");
+ System.out.println("-------- --------------------------------------");
+ for (String name: view.list()) {
+ System.out.format("%8d %s\n", view.size(name), name);
+ }
+ return;
+ }
+
+ // Add/replace a file's user defined attribute
+ if (args[0].equals("-set")) {
+ // name=value
+ String[] s = args[1].split("=");
+ if (s.length != 2)
+ usage();
+ String name = s[0];
+ String value = s[1];
+ view.write(name, Charset.defaultCharset().encode(value));
+ return;
+ }
+
+ // Print out the value of a file's user defined attribute
+ if (args[0].equals("-get")) {
+ String name = args[1];
+ int size = view.size(name);
+ ByteBuffer buf = ByteBuffer.allocateDirect(size);
+ view.read(name, buf);
+ buf.flip();
+ System.out.println(Charset.defaultCharset().decode(buf).toString());
+ return;
+ }
+
+ // Delete a file's user defined attribute
+ if (args[0].equals("-del")) {
+ view.delete(args[1]);
+ return;
+ }
+
+ // option not recognized
+ usage();
+ }
+ }
diff --git a/staging/darwin-x86/sample/nio/multicast/MulticastAddress.java b/staging/darwin-x86/sample/nio/multicast/MulticastAddress.java
new file mode 100644
index 0000000..05f5ca5
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/multicast/MulticastAddress.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.UnknownHostException;
+import java.net.SocketException;
+
+/**
+ * Parses and represents a multicast address.
+ */
+
+class MulticastAddress {
+ private final InetAddress group;
+ private final int port;
+ private final NetworkInterface interf;
+
+ private MulticastAddress(InetAddress group, int port, NetworkInterface interf) {
+ this.group = group;
+ this.port = port;
+ this.interf = interf;
+ }
+
+ InetAddress group() {
+ return group;
+ }
+
+ int port() {
+ return port;
+ }
+
+ /**
+ * @return The network interface, may be {@code null}
+ */
+ NetworkInterface interf() {
+ return interf;
+ }
+
+ /**
+ * Parses a string of the form "group:port[@interface]", returning
+ * a MulticastAddress representing the address
+ */
+ static MulticastAddress parse(String s) {
+ String[] components = s.split("@");
+ if (components.length > 2)
+ throw new IllegalArgumentException("At most one '@' expected");
+
+ // get group and port
+ String target = components[0];
+ int len = components[0].length();
+ int colon = components[0].lastIndexOf(':');
+ if ((colon < 1) || (colon > (len-2)))
+ throw new IllegalArgumentException("group:port expected");
+ String groupString = target.substring(0, colon);
+ int port = -1;
+ try {
+ port = Integer.parseInt(target.substring(colon+1, len));
+ } catch (NumberFormatException x) {
+ throw new IllegalArgumentException(x);
+ }
+
+ // handle IPv6 literal address
+ if (groupString.charAt(0) == '[') {
+ len = groupString.length();
+ if (groupString.charAt(len-1) != ']')
+ throw new IllegalArgumentException("missing ']'");
+ groupString = groupString.substring(1,len-1);
+ if (groupString.length() == 0)
+ throw new IllegalArgumentException("missing IPv6 address");
+ }
+
+ // get group address
+ InetAddress group = null;
+ try {
+ group = InetAddress.getByName(groupString);
+ } catch (UnknownHostException x) {
+ throw new IllegalArgumentException(x);
+ }
+ if (!group.isMulticastAddress()) {
+ throw new IllegalArgumentException("'" + group.getHostAddress() +
+ "' is not multicast address");
+ }
+
+ // optional interface
+ NetworkInterface interf = null;
+ if (components.length == 2) {
+ try {
+ interf = NetworkInterface.getByName(components[1]);
+ } catch (SocketException x) {
+ throw new IllegalArgumentException(x);
+ }
+ if (interf == null) {
+ throw new IllegalArgumentException("'" + components[1] +
+ "' is not valid interface");
+ }
+ }
+ return new MulticastAddress(group, port, interf);
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/multicast/Reader.java b/staging/darwin-x86/sample/nio/multicast/Reader.java
new file mode 100644
index 0000000..303c356
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/multicast/Reader.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+import java.nio.charset.*;
+import java.nio.ByteBuffer;
+import java.net.*;
+import java.io.IOException;
+import java.util.*;
+
+public class Reader {
+
+ static void usage() {
+ System.err.println("usage: java Reader group:port@interf [-only source...] [-block source...]");
+ System.exit(-1);
+ }
+
+ static void printDatagram(SocketAddress sa, ByteBuffer buf) {
+ System.out.format("-- datagram from %s --\n",
+ ((InetSocketAddress)sa).getAddress().getHostAddress());
+ System.out.println(Charset.defaultCharset().decode(buf));
+ }
+
+ static void parseAddessList(String s, List<InetAddress> list)
+ throws UnknownHostException
+ {
+ String[] sources = s.split(",");
+ for (int i=0; i<sources.length; i++) {
+ list.add(InetAddress.getByName(sources[i]));
+ }
+ }
+
+ public static void main(String[] args) throws IOException {
+ if (args.length == 0)
+ usage();
+
+ // first parameter is the multicast address (interface required)
+ MulticastAddress target = MulticastAddress.parse(args[0]);
+ if (target.interf() == null)
+ usage();
+
+ // addition arguments are source addresses to include or exclude
+ List<InetAddress> includeList = new ArrayList<InetAddress>();
+ List<InetAddress> excludeList = new ArrayList<InetAddress>();
+ int argc = 1;
+ while (argc < args.length) {
+ String option = args[argc++];
+ if (argc >= args.length)
+ usage();
+ String value = args[argc++];
+ if (option.equals("-only")) {
+ parseAddessList(value, includeList);
+ continue;
+ }
+ if (option.equals("-block")) {
+ parseAddessList(value, excludeList);
+ continue;
+ }
+ usage();
+ }
+ if (!includeList.isEmpty() && !excludeList.isEmpty()) {
+ usage();
+ }
+
+ // create and bind socket
+ ProtocolFamily family = StandardProtocolFamily.INET;
+ if (target.group() instanceof Inet6Address) {
+ family = StandardProtocolFamily.INET6;
+ }
+ DatagramChannel dc = DatagramChannel.open(family)
+ .setOption(StandardSocketOptions.SO_REUSEADDR, true)
+ .bind(new InetSocketAddress(target.port()));
+
+ if (includeList.isEmpty()) {
+ // join group and block addresses on the exclude list
+ MembershipKey key = dc.join(target.group(), target.interf());
+ for (InetAddress source: excludeList) {
+ key.block(source);
+ }
+ } else {
+ // join with source-specific membership for each source
+ for (InetAddress source: includeList) {
+ dc.join(target.group(), target.interf(), source);
+ }
+ }
+
+ // register socket with Selector
+ Selector sel = Selector.open();
+ dc.configureBlocking(false);
+ dc.register(sel, SelectionKey.OP_READ);
+
+ // print out each datagram that we receive
+ ByteBuffer buf = ByteBuffer.allocateDirect(4096);
+ for (;;) {
+ int updated = sel.select();
+ if (updated > 0) {
+ Iterator<SelectionKey> iter = sel.selectedKeys().iterator();
+ while (iter.hasNext()) {
+ SelectionKey sk = iter.next();
+ iter.remove();
+
+ DatagramChannel ch = (DatagramChannel)sk.channel();
+ SocketAddress sa = ch.receive(buf);
+ if (sa != null) {
+ buf.flip();
+ printDatagram(sa, buf);
+ buf.rewind();
+ buf.limit(buf.capacity());
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/multicast/Sender.java b/staging/darwin-x86/sample/nio/multicast/Sender.java
new file mode 100644
index 0000000..f8685f6
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/multicast/Sender.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+import java.nio.charset.Charset;
+import java.net.*;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Sample multicast sender to send a message in a multicast datagram
+ * to a given group.
+ */
+
+public class Sender {
+
+ private static void usage() {
+ System.err.println("usage: java Sender group:port[@interface] message");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ if (args.length < 2)
+ usage();
+
+ MulticastAddress target = MulticastAddress.parse(args[0]);
+
+ // create socket
+ ProtocolFamily family = StandardProtocolFamily.INET;
+ if (target.group() instanceof Inet6Address)
+ family = StandardProtocolFamily.INET6;
+ DatagramChannel dc = DatagramChannel.open(family).bind(new InetSocketAddress(0));
+ if (target.interf() != null) {
+ dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, target.interf());
+ }
+
+ // send multicast packet
+ dc.send(Charset.defaultCharset().encode(args[1]),
+ new InetSocketAddress(target.group(), target.port()));
+ dc.close();
+ }
+
+}
diff --git a/staging/darwin-x86/sample/nio/server/AcceptHandler.java b/staging/darwin-x86/sample/nio/server/AcceptHandler.java
new file mode 100644
index 0000000..41c2570
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/AcceptHandler.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import javax.net.ssl.*;
+
+/**
+ * A single threaded Handler that performs accepts SocketChannels and
+ * registers the Channels with the read/write Selector.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class AcceptHandler implements Handler {
+
+ private ServerSocketChannel channel;
+ private Dispatcher dsp;
+
+ private SSLContext sslContext;
+
+ AcceptHandler(ServerSocketChannel ssc, Dispatcher dsp,
+ SSLContext sslContext) {
+ channel = ssc;
+ this.dsp = dsp;
+ this.sslContext = sslContext;
+ }
+
+ public void handle(SelectionKey sk) throws IOException {
+
+ if (!sk.isAcceptable())
+ return;
+
+ SocketChannel sc = channel.accept();
+ if (sc == null) {
+ return;
+ }
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, false /* non-blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, false /* non-blocking */));
+
+ RequestHandler rh = new RequestHandler(cio);
+ dsp.register(cio.getSocketChannel(), SelectionKey.OP_READ, rh);
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/Acceptor.java b/staging/darwin-x86/sample/nio/server/Acceptor.java
new file mode 100644
index 0000000..cfdaf0e
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Acceptor.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import javax.net.ssl.*;
+
+/**
+ * A Runnable class which sits in a loop accepting SocketChannels,
+ * then registers the Channels with the read/write Selector.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Acceptor implements Runnable {
+
+ private ServerSocketChannel ssc;
+ private Dispatcher d;
+
+ private SSLContext sslContext;
+
+ Acceptor(ServerSocketChannel ssc, Dispatcher d, SSLContext sslContext) {
+ this.ssc = ssc;
+ this.d = d;
+ this.sslContext = sslContext;
+ }
+
+ public void run() {
+ for (;;) {
+ try {
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, false /* non-blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, false /* non-blocking */));
+
+ RequestHandler rh = new RequestHandler(cio);
+
+ d.register(cio.getSocketChannel(), SelectionKey.OP_READ, rh);
+
+ } catch (IOException x) {
+ x.printStackTrace();
+ break;
+ }
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/B1.java b/staging/darwin-x86/sample/nio/server/B1.java
new file mode 100644
index 0000000..c6d7e90
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/B1.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+
+/**
+ * A blocking/single-threaded server which completely services
+ * each connection before moving to the next.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class B1 extends Server {
+
+ B1(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws Exception {
+ for (;;) {
+
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, true /* blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, true /* blocking */));
+
+ RequestServicer svc = new RequestServicer(cio);
+ svc.run();
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/BN.java b/staging/darwin-x86/sample/nio/server/BN.java
new file mode 100644
index 0000000..c765a8b
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/BN.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+
+/**
+ * A Blocking/Multi-threaded Server which creates a new thread for each
+ * connection. This is not efficient for large numbers of connections.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class BN extends Server {
+
+ BN(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws IOException {
+ for (;;) {
+
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, true /* blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, true /* blocking */));
+
+ RequestServicer svc = new RequestServicer(cio);
+ Thread th = new Thread(svc);
+ th.start();
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/BP.java b/staging/darwin-x86/sample/nio/server/BP.java
new file mode 100644
index 0000000..9540f1c
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/BP.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+import java.util.concurrent.*;
+
+/**
+ * A multi-threaded server which creates a pool of threads for use
+ * by the server. The Thread pool decides how to schedule those threads.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class BP extends Server {
+
+ private static final int POOL_MULTIPLE = 4;
+
+ BP(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws Exception {
+
+ ExecutorService xec = Executors.newFixedThreadPool(
+ Runtime.getRuntime().availableProcessors() * POOL_MULTIPLE);
+
+ for (;;) {
+
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, true /* blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, true /* blocking */));
+
+ RequestServicer svc = new RequestServicer(cio);
+ xec.execute(svc);
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/ChannelIO.java b/staging/darwin-x86/sample/nio/server/ChannelIO.java
new file mode 100644
index 0000000..7d1ca18
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/ChannelIO.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+
+/**
+ * A helper class for properly sizing inbound byte buffers and
+ * redirecting I/O calls to the proper SocketChannel call.
+ * <P>
+ * Many of these calls may seem unnecessary until you consider
+ * that they are placeholders for the secure variant, which is much
+ * more involved. See ChannelIOSecure for more information.
+ *
+ * @author Brad R. Wetmore
+ * @author Mark Reinhold
+ */
+class ChannelIO {
+
+ protected SocketChannel sc;
+
+ /*
+ * All of the inbound request data lives here until we determine
+ * that we've read everything, then we pass that data back to the
+ * caller.
+ */
+ protected ByteBuffer requestBB;
+ static private int requestBBSize = 4096;
+
+ protected ChannelIO(SocketChannel sc, boolean blocking)
+ throws IOException {
+ this.sc = sc;
+ sc.configureBlocking(blocking);
+ }
+
+ static ChannelIO getInstance(SocketChannel sc, boolean blocking)
+ throws IOException {
+ ChannelIO cio = new ChannelIO(sc, blocking);
+ cio.requestBB = ByteBuffer.allocate(requestBBSize);
+
+ return cio;
+ }
+
+ SocketChannel getSocketChannel() {
+ return sc;
+ }
+
+ /*
+ * Return a ByteBuffer with "remaining" space to work. If you have to
+ * reallocate the ByteBuffer, copy the existing info into the new buffer.
+ */
+ protected void resizeRequestBB(int remaining) {
+ if (requestBB.remaining() < remaining) {
+ // Expand buffer for large request
+ ByteBuffer bb = ByteBuffer.allocate(requestBB.capacity() * 2);
+ requestBB.flip();
+ bb.put(requestBB);
+ requestBB = bb;
+ }
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * This variant is for Servers without SelectionKeys (e.g.
+ * blocking).
+ * <P>
+ * return true when we're done with handshaking.
+ */
+ boolean doHandshake() throws IOException {
+ return true;
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * This variant is for Servers with SelectionKeys, so that
+ * we can register for selectable operations (e.g. selectable
+ * non-blocking).
+ * <P>
+ * return true when we're done with handshaking.
+ */
+ boolean doHandshake(SelectionKey sk) throws IOException {
+ return true;
+ }
+
+ /*
+ * Resize (if necessary) the inbound data buffer, and then read more
+ * data into the read buffer.
+ */
+ int read() throws IOException {
+ /*
+ * Allocate more space if less than 5% remains
+ */
+ resizeRequestBB(requestBBSize/20);
+ return sc.read(requestBB);
+ }
+
+ /*
+ * All data has been read, pass back the request in one buffer.
+ */
+ ByteBuffer getReadBuf() {
+ return requestBB;
+ }
+
+ /*
+ * Write the src buffer into the socket channel.
+ */
+ int write(ByteBuffer src) throws IOException {
+ return sc.write(src);
+ }
+
+ /*
+ * Perform a FileChannel.TransferTo on the socket channel.
+ */
+ long transferTo(FileChannel fc, long pos, long len) throws IOException {
+ return fc.transferTo(pos, len, sc);
+ }
+
+ /*
+ * Flush any outstanding data to the network if possible.
+ * <P>
+ * This isn't really necessary for the insecure variant, but needed
+ * for the secure one where intermediate buffering must take place.
+ * <P>
+ * Return true if successful.
+ */
+ boolean dataFlush() throws IOException {
+ return true;
+ }
+
+ /*
+ * Start any connection shutdown processing.
+ * <P>
+ * This isn't really necessary for the insecure variant, but needed
+ * for the secure one where intermediate buffering must take place.
+ * <P>
+ * Return true if successful, and the data has been flushed.
+ */
+ boolean shutdown() throws IOException {
+ return true;
+ }
+
+ /*
+ * Close the underlying connection.
+ */
+ void close() throws IOException {
+ sc.close();
+ }
+
+}
diff --git a/staging/darwin-x86/sample/nio/server/ChannelIOSecure.java b/staging/darwin-x86/sample/nio/server/ChannelIOSecure.java
new file mode 100644
index 0000000..7508966
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/ChannelIOSecure.java
@@ -0,0 +1,650 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+
+/**
+ * A helper class which performs I/O using the SSLEngine API.
+ * <P>
+ * Each connection has a SocketChannel and a SSLEngine that is
+ * used through the lifetime of the Channel. We allocate byte buffers
+ * for use as the outbound and inbound network buffers.
+ *
+ * <PRE>
+ * Application Data
+ * src requestBB
+ * | ^
+ * | | |
+ * v | |
+ * +----+-----|-----+----+
+ * | | |
+ * | SSL|Engine |
+ * wrap() | | | unwrap()
+ * | OUTBOUND | INBOUND |
+ * | | |
+ * +----+-----|-----+----+
+ * | | ^
+ * | | |
+ * v |
+ * outNetBB inNetBB
+ * Net data
+ * </PRE>
+ *
+ * These buffers handle all of the intermediary data for the SSL
+ * connection. To make things easy, we'll require outNetBB be
+ * completely flushed before trying to wrap any more data, but we
+ * could certainly remove that restriction by using larger buffers.
+ * <P>
+ * There are many, many ways to handle compute and I/O strategies.
+ * What follows is a relatively simple one. The reader is encouraged
+ * to develop the strategy that best fits the application.
+ * <P>
+ * In most of the non-blocking operations in this class, we let the
+ * Selector tell us when we're ready to attempt an I/O operation (by the
+ * application repeatedly calling our methods). Another option would be
+ * to attempt the operation and return from the method when no forward
+ * progress can be made.
+ * <P>
+ * There's lots of room for enhancements and improvement in this example.
+ * <P>
+ * We're checking for SSL/TLS end-of-stream truncation attacks via
+ * sslEngine.closeInbound(). When you reach the end of a input stream
+ * via a read() returning -1 or an IOException, we call
+ * sslEngine.closeInbound() to signal to the sslEngine that no more
+ * input will be available. If the peer's close_notify message has not
+ * yet been received, this could indicate a trucation attack, in which
+ * an attacker is trying to prematurely close the connection. The
+ * closeInbound() will throw an exception if this condition were
+ * present.
+ *
+ * @author Brad R. Wetmore
+ * @author Mark Reinhold
+ */
+class ChannelIOSecure extends ChannelIO {
+
+ private SSLEngine sslEngine = null;
+
+ private int appBBSize;
+ private int netBBSize;
+
+ /*
+ * All I/O goes through these buffers.
+ * <P>
+ * It might be nice to use a cache of ByteBuffers so we're
+ * not alloc/dealloc'ing ByteBuffer's for each new SSLEngine.
+ * <P>
+ * We use our superclass' requestBB for our application input buffer.
+ * Outbound application data is supplied to us by our callers.
+ */
+ private ByteBuffer inNetBB;
+ private ByteBuffer outNetBB;
+
+ /*
+ * An empty ByteBuffer for use when one isn't available, say
+ * as a source buffer during initial handshake wraps or for close
+ * operations.
+ */
+ private static ByteBuffer hsBB = ByteBuffer.allocate(0);
+
+ /*
+ * The FileChannel we're currently transferTo'ing (reading).
+ */
+ private ByteBuffer fileChannelBB = null;
+
+ /*
+ * During our initial handshake, keep track of the next
+ * SSLEngine operation that needs to occur:
+ *
+ * NEED_WRAP/NEED_UNWRAP
+ *
+ * Once the initial handshake has completed, we can short circuit
+ * handshake checks with initialHSComplete.
+ */
+ private HandshakeStatus initialHSStatus;
+ private boolean initialHSComplete;
+
+ /*
+ * We have received the shutdown request by our caller, and have
+ * closed our outbound side.
+ */
+ private boolean shutdown = false;
+
+ /*
+ * Constructor for a secure ChannelIO variant.
+ */
+ protected ChannelIOSecure(SocketChannel sc, boolean blocking,
+ SSLContext sslc) throws IOException {
+ super(sc, blocking);
+
+ /*
+ * We're a server, so no need to use host/port variant.
+ *
+ * The first call for a server is a NEED_UNWRAP.
+ */
+ sslEngine = sslc.createSSLEngine();
+ sslEngine.setUseClientMode(false);
+ initialHSStatus = HandshakeStatus.NEED_UNWRAP;
+ initialHSComplete = false;
+
+ // Create a buffer using the normal expected packet size we'll
+ // be getting. This may change, depending on the peer's
+ // SSL implementation.
+ netBBSize = sslEngine.getSession().getPacketBufferSize();
+ inNetBB = ByteBuffer.allocate(netBBSize);
+ outNetBB = ByteBuffer.allocate(netBBSize);
+ outNetBB.position(0);
+ outNetBB.limit(0);
+ }
+
+ /*
+ * Static factory method for creating a secure ChannelIO object.
+ * <P>
+ * We need to allocate different sized application data buffers
+ * based on whether we're secure or not. We can't determine
+ * this until our sslEngine is created.
+ */
+ static ChannelIOSecure getInstance(SocketChannel sc, boolean blocking,
+ SSLContext sslc) throws IOException {
+
+ ChannelIOSecure cio = new ChannelIOSecure(sc, blocking, sslc);
+
+ // Create a buffer using the normal expected application size we'll
+ // be getting. This may change, depending on the peer's
+ // SSL implementation.
+ cio.appBBSize = cio.sslEngine.getSession().getApplicationBufferSize();
+ cio.requestBB = ByteBuffer.allocate(cio.appBBSize);
+
+ return cio;
+ }
+
+ /*
+ * Calls up to the superclass to adjust the buffer size
+ * by an appropriate increment.
+ */
+ protected void resizeRequestBB() {
+ resizeRequestBB(appBBSize);
+ }
+
+ /*
+ * Adjust the inbount network buffer to an appropriate size.
+ */
+ private void resizeResponseBB() {
+ ByteBuffer bb = ByteBuffer.allocate(netBBSize);
+ inNetBB.flip();
+ bb.put(inNetBB);
+ inNetBB = bb;
+ }
+
+ /*
+ * Writes bb to the SocketChannel.
+ * <P>
+ * Returns true when the ByteBuffer has no remaining data.
+ */
+ private boolean tryFlush(ByteBuffer bb) throws IOException {
+ super.write(bb);
+ return !bb.hasRemaining();
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * This variant is for Servers without SelectionKeys (e.g.
+ * blocking).
+ */
+ boolean doHandshake() throws IOException {
+ return doHandshake(null);
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * If a SelectionKey is passed, register for selectable
+ * operations.
+ * <P>
+ * In the blocking case, our caller will keep calling us until
+ * we finish the handshake. Our reads/writes will block as expected.
+ * <P>
+ * In the non-blocking case, we just received the selection notification
+ * that this channel is ready for whatever the operation is, so give
+ * it a try.
+ * <P>
+ * return:
+ * true when handshake is done.
+ * false while handshake is in progress
+ */
+ boolean doHandshake(SelectionKey sk) throws IOException {
+
+ SSLEngineResult result;
+
+ if (initialHSComplete) {
+ return initialHSComplete;
+ }
+
+ /*
+ * Flush out the outgoing buffer, if there's anything left in
+ * it.
+ */
+ if (outNetBB.hasRemaining()) {
+
+ if (!tryFlush(outNetBB)) {
+ return false;
+ }
+
+ // See if we need to switch from write to read mode.
+
+ switch (initialHSStatus) {
+
+ /*
+ * Is this the last buffer?
+ */
+ case FINISHED:
+ initialHSComplete = true;
+ // Fall-through to reregister need for a Read.
+
+ case NEED_UNWRAP:
+ if (sk != null) {
+ sk.interestOps(SelectionKey.OP_READ);
+ }
+ break;
+ }
+
+ return initialHSComplete;
+ }
+
+
+ switch (initialHSStatus) {
+
+ case NEED_UNWRAP:
+ if (sc.read(inNetBB) == -1) {
+ sslEngine.closeInbound();
+ return initialHSComplete;
+ }
+
+needIO:
+ while (initialHSStatus == HandshakeStatus.NEED_UNWRAP) {
+ resizeRequestBB(); // expected room for unwrap
+ inNetBB.flip();
+ result = sslEngine.unwrap(inNetBB, requestBB);
+ inNetBB.compact();
+
+ initialHSStatus = result.getHandshakeStatus();
+
+ switch (result.getStatus()) {
+
+ case OK:
+ switch (initialHSStatus) {
+ case NOT_HANDSHAKING:
+ throw new IOException(
+ "Not handshaking during initial handshake");
+
+ case NEED_TASK:
+ initialHSStatus = doTasks();
+ break;
+
+ case FINISHED:
+ initialHSComplete = true;
+ break needIO;
+ }
+
+ break;
+
+ case BUFFER_UNDERFLOW:
+ // Resize buffer if needed.
+ netBBSize = sslEngine.getSession().getPacketBufferSize();
+ if (netBBSize > inNetBB.capacity()) {
+ resizeResponseBB();
+ }
+
+ /*
+ * Need to go reread the Channel for more data.
+ */
+ if (sk != null) {
+ sk.interestOps(SelectionKey.OP_READ);
+ }
+ break needIO;
+
+ case BUFFER_OVERFLOW:
+ // Reset the application buffer size.
+ appBBSize =
+ sslEngine.getSession().getApplicationBufferSize();
+ break;
+
+ default: //CLOSED:
+ throw new IOException("Received" + result.getStatus() +
+ "during initial handshaking");
+ }
+ } // "needIO" block.
+
+ /*
+ * Just transitioned from read to write.
+ */
+ if (initialHSStatus != HandshakeStatus.NEED_WRAP) {
+ break;
+ }
+
+ // Fall through and fill the write buffers.
+
+ case NEED_WRAP:
+ /*
+ * The flush above guarantees the out buffer to be empty
+ */
+ outNetBB.clear();
+ result = sslEngine.wrap(hsBB, outNetBB);
+ outNetBB.flip();
+
+ initialHSStatus = result.getHandshakeStatus();
+
+ switch (result.getStatus()) {
+ case OK:
+
+ if (initialHSStatus == HandshakeStatus.NEED_TASK) {
+ initialHSStatus = doTasks();
+ }
+
+ if (sk != null) {
+ sk.interestOps(SelectionKey.OP_WRITE);
+ }
+
+ break;
+
+ default: // BUFFER_OVERFLOW/BUFFER_UNDERFLOW/CLOSED:
+ throw new IOException("Received" + result.getStatus() +
+ "during initial handshaking");
+ }
+ break;
+
+ default: // NOT_HANDSHAKING/NEED_TASK/FINISHED
+ throw new RuntimeException("Invalid Handshaking State" +
+ initialHSStatus);
+ } // switch
+
+ return initialHSComplete;
+ }
+
+ /*
+ * Do all the outstanding handshake tasks in the current Thread.
+ */
+ private SSLEngineResult.HandshakeStatus doTasks() {
+
+ Runnable runnable;
+
+ /*
+ * We could run this in a separate thread, but
+ * do in the current for now.
+ */
+ while ((runnable = sslEngine.getDelegatedTask()) != null) {
+ runnable.run();
+ }
+ return sslEngine.getHandshakeStatus();
+ }
+
+ /*
+ * Read the channel for more information, then unwrap the
+ * (hopefully application) data we get.
+ * <P>
+ * If we run out of data, we'll return to our caller (possibly using
+ * a Selector) to get notification that more is available.
+ * <P>
+ * Each call to this method will perform at most one underlying read().
+ */
+ int read() throws IOException {
+ SSLEngineResult result;
+
+ if (!initialHSComplete) {
+ throw new IllegalStateException();
+ }
+
+ int pos = requestBB.position();
+
+ if (sc.read(inNetBB) == -1) {
+ sslEngine.closeInbound(); // probably throws exception
+ return -1;
+ }
+
+ do {
+ resizeRequestBB(); // expected room for unwrap
+ inNetBB.flip();
+ result = sslEngine.unwrap(inNetBB, requestBB);
+ inNetBB.compact();
+
+ /*
+ * Could check here for a renegotation, but we're only
+ * doing a simple read/write, and won't have enough state
+ * transitions to do a complete handshake, so ignore that
+ * possibility.
+ */
+ switch (result.getStatus()) {
+
+ case BUFFER_OVERFLOW:
+ // Reset the application buffer size.
+ appBBSize = sslEngine.getSession().getApplicationBufferSize();
+ break;
+
+ case BUFFER_UNDERFLOW:
+ // Resize buffer if needed.
+ netBBSize = sslEngine.getSession().getPacketBufferSize();
+ if (netBBSize > inNetBB.capacity()) {
+ resizeResponseBB();
+
+ break; // break, next read will support larger buffer.
+ }
+ case OK:
+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ doTasks();
+ }
+ break;
+
+ default:
+ throw new IOException("sslEngine error during data read: " +
+ result.getStatus());
+ }
+ } while ((inNetBB.position() != 0) &&
+ result.getStatus() != Status.BUFFER_UNDERFLOW);
+
+ return (requestBB.position() - pos);
+ }
+
+ /*
+ * Try to write out as much as possible from the src buffer.
+ */
+ int write(ByteBuffer src) throws IOException {
+
+ if (!initialHSComplete) {
+ throw new IllegalStateException();
+ }
+
+ return doWrite(src);
+ }
+
+ /*
+ * Try to flush out any existing outbound data, then try to wrap
+ * anything new contained in the src buffer.
+ * <P>
+ * Return the number of bytes actually consumed from the buffer,
+ * but the data may actually be still sitting in the output buffer,
+ * waiting to be flushed.
+ */
+ private int doWrite(ByteBuffer src) throws IOException {
+ int retValue = 0;
+
+ if (outNetBB.hasRemaining() && !tryFlush(outNetBB)) {
+ return retValue;
+ }
+
+ /*
+ * The data buffer is empty, we can reuse the entire buffer.
+ */
+ outNetBB.clear();
+
+ SSLEngineResult result = sslEngine.wrap(src, outNetBB);
+ retValue = result.bytesConsumed();
+
+ outNetBB.flip();
+
+ switch (result.getStatus()) {
+
+ case OK:
+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ doTasks();
+ }
+ break;
+
+ default:
+ throw new IOException("sslEngine error during data write: " +
+ result.getStatus());
+ }
+
+ /*
+ * Try to flush the data, regardless of whether or not
+ * it's been selected. Odds of a write buffer being full
+ * is less than a read buffer being empty.
+ */
+ if (outNetBB.hasRemaining()) {
+ tryFlush(outNetBB);
+ }
+
+ return retValue;
+ }
+
+ /*
+ * Perform a FileChannel.TransferTo on the socket channel.
+ * <P>
+ * We have to copy the data into an intermediary app ByteBuffer
+ * first, then send it through the SSLEngine.
+ * <P>
+ * We return the number of bytes actually read out of the
+ * filechannel. However, the data may actually be stuck
+ * in the fileChannelBB or the outNetBB. The caller
+ * is responsible for making sure to call dataFlush()
+ * before shutting down.
+ */
+ long transferTo(FileChannel fc, long pos, long len) throws IOException {
+
+ if (!initialHSComplete) {
+ throw new IllegalStateException();
+ }
+
+ if (fileChannelBB == null) {
+ fileChannelBB = ByteBuffer.allocate(appBBSize);
+ fileChannelBB.limit(0);
+ }
+
+ fileChannelBB.compact();
+ int fileRead = fc.read(fileChannelBB);
+ fileChannelBB.flip();
+
+ /*
+ * We ignore the return value here, we return the
+ * number of bytes actually consumed from the the file.
+ * We'll flush the output buffer before we start shutting down.
+ */
+ doWrite(fileChannelBB);
+
+ return fileRead;
+ }
+
+ /*
+ * Flush any remaining data.
+ * <P>
+ * Return true when the fileChannelBB and outNetBB are empty.
+ */
+ boolean dataFlush() throws IOException {
+ boolean fileFlushed = true;
+
+ if ((fileChannelBB != null) && fileChannelBB.hasRemaining()) {
+ doWrite(fileChannelBB);
+ fileFlushed = !fileChannelBB.hasRemaining();
+ } else if (outNetBB.hasRemaining()) {
+ tryFlush(outNetBB);
+ }
+
+ return (fileFlushed && !outNetBB.hasRemaining());
+ }
+
+ /*
+ * Begin the shutdown process.
+ * <P>
+ * Close out the SSLEngine if not already done so, then
+ * wrap our outgoing close_notify message and try to send it on.
+ * <P>
+ * Return true when we're done passing the shutdown messsages.
+ */
+ boolean shutdown() throws IOException {
+
+ if (!shutdown) {
+ sslEngine.closeOutbound();
+ shutdown = true;
+ }
+
+ if (outNetBB.hasRemaining() && tryFlush(outNetBB)) {
+ return false;
+ }
+
+ /*
+ * By RFC 2616, we can "fire and forget" our close_notify
+ * message, so that's what we'll do here.
+ */
+ outNetBB.clear();
+ SSLEngineResult result = sslEngine.wrap(hsBB, outNetBB);
+ if (result.getStatus() != Status.CLOSED) {
+ throw new SSLException("Improper close state");
+ }
+ outNetBB.flip();
+
+ /*
+ * We won't wait for a select here, but if this doesn't work,
+ * we'll cycle back through on the next select.
+ */
+ if (outNetBB.hasRemaining()) {
+ tryFlush(outNetBB);
+ }
+
+ return (!outNetBB.hasRemaining() &&
+ (result.getHandshakeStatus() != HandshakeStatus.NEED_WRAP));
+ }
+
+ /*
+ * close() is not overridden
+ */
+}
diff --git a/staging/darwin-x86/sample/nio/server/Content.java b/staging/darwin-x86/sample/nio/server/Content.java
new file mode 100644
index 0000000..52e06fa
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Content.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * An Sendable interface extension that adds additional
+ * methods for additional information, such as Files
+ * or Strings.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Content extends Sendable {
+
+ String type();
+
+ // Returns -1 until prepare() invoked
+ long length();
+
+}
diff --git a/staging/darwin-x86/sample/nio/server/Dispatcher.java b/staging/darwin-x86/sample/nio/server/Dispatcher.java
new file mode 100644
index 0000000..9474c12
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Dispatcher.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+
+/**
+ * Base class for the Dispatchers.
+ * <P>
+ * Servers use these to obtain ready status, and then to dispatch jobs.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Dispatcher extends Runnable {
+
+ void register(SelectableChannel ch, int ops, Handler h)
+ throws IOException;
+
+}
diff --git a/staging/darwin-x86/sample/nio/server/Dispatcher1.java b/staging/darwin-x86/sample/nio/server/Dispatcher1.java
new file mode 100644
index 0000000..533e4b8
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Dispatcher1.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import java.util.*;
+
+/**
+ * A single-threaded dispatcher.
+ * <P>
+ * When a SelectionKey is ready, it dispatches the job in this
+ * thread.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Dispatcher1 implements Dispatcher {
+
+ private Selector sel;
+
+ Dispatcher1() throws IOException {
+ sel = Selector.open();
+ }
+
+ // Doesn't really need to be runnable
+ public void run() {
+ for (;;) {
+ try {
+ dispatch();
+ } catch (IOException x) {
+ x.printStackTrace();
+ }
+ }
+ }
+
+ private void dispatch() throws IOException {
+ sel.select();
+ for (Iterator i = sel.selectedKeys().iterator(); i.hasNext(); ) {
+ SelectionKey sk = (SelectionKey)i.next();
+ i.remove();
+ Handler h = (Handler)sk.attachment();
+ h.handle(sk);
+ }
+ }
+
+ public void register(SelectableChannel ch, int ops, Handler h)
+ throws IOException {
+ ch.register(sel, ops, h);
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/DispatcherN.java b/staging/darwin-x86/sample/nio/server/DispatcherN.java
new file mode 100644
index 0000000..7b601b0
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/DispatcherN.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import java.util.*;
+
+/**
+ * A Multi-threaded dispatcher.
+ * <P>
+ * In this example, one thread does accepts, and the second
+ * does read/writes.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class DispatcherN implements Dispatcher {
+
+ private Selector sel;
+
+ DispatcherN() throws IOException {
+ sel = Selector.open();
+ }
+
+ public void run() {
+ for (;;) {
+ try {
+ dispatch();
+ } catch (IOException x) {
+ x.printStackTrace();
+ }
+ }
+ }
+
+ private Object gate = new Object();
+
+ private void dispatch() throws IOException {
+ sel.select();
+ for (Iterator i = sel.selectedKeys().iterator(); i.hasNext(); ) {
+ SelectionKey sk = (SelectionKey)i.next();
+ i.remove();
+ Handler h = (Handler)sk.attachment();
+ h.handle(sk);
+ }
+ synchronized (gate) { }
+ }
+
+ public void register(SelectableChannel ch, int ops, Handler h)
+ throws IOException {
+ synchronized (gate) {
+ sel.wakeup();
+ ch.register(sel, ops, h);
+ }
+ }
+
+}
diff --git a/staging/darwin-x86/sample/nio/server/FileContent.java b/staging/darwin-x86/sample/nio/server/FileContent.java
new file mode 100644
index 0000000..82c44a9
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/FileContent.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.net.*;
+import java.nio.channels.*;
+import java.nio.charset.*;
+
+/**
+ * A Content type that provides for transferring files.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class FileContent implements Content {
+
+ private static File ROOT = new File("root");
+
+ private File fn;
+
+ FileContent(URI uri) {
+ fn = new File(ROOT,
+ uri.getPath()
+ .replace('/',
+ File.separatorChar));
+ }
+
+ private String type = null;
+
+ public String type() {
+ if (type != null)
+ return type;
+ String nm = fn.getName();
+ if (nm.endsWith(".html"))
+ type = "text/html; charset=iso-8859-1";
+ else if ((nm.indexOf('.') < 0) || nm.endsWith(".txt"))
+ type = "text/plain; charset=iso-8859-1";
+ else
+ type = "application/octet-stream";
+ return type;
+ }
+
+ private FileChannel fc = null;
+ private long length = -1;
+ private long position = -1; // NB only; >= 0 if transferring
+
+ public long length() {
+ return length;
+ }
+
+ public void prepare() throws IOException {
+ if (fc == null)
+ fc = new RandomAccessFile(fn, "r").getChannel();
+ length = fc.size();
+ position = 0; // NB only
+ }
+
+ public boolean send(ChannelIO cio) throws IOException {
+ if (fc == null)
+ throw new IllegalStateException();
+ if (position < 0) // NB only
+ throw new IllegalStateException();
+
+ /*
+ * Short-circuit if we're already done.
+ */
+ if (position >= length) {
+ return false;
+ }
+
+ position += cio.transferTo(fc, position, length - position);
+ return (position < length);
+ }
+
+ public void release() throws IOException {
+ if (fc != null) {
+ fc.close();
+ fc = null;
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/Handler.java b/staging/darwin-x86/sample/nio/server/Handler.java
new file mode 100644
index 0000000..110feb7
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Handler.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+
+/**
+ * Base class for the Handlers.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Handler {
+
+ void handle(SelectionKey sk) throws IOException;
+
+}
diff --git a/staging/darwin-x86/sample/nio/server/MalformedRequestException.java b/staging/darwin-x86/sample/nio/server/MalformedRequestException.java
new file mode 100644
index 0000000..89b0db6
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/MalformedRequestException.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * Exception class used when a request can't be properly parsed.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class MalformedRequestException extends Exception {
+
+ MalformedRequestException() { }
+
+ MalformedRequestException(String msg) {
+ super(msg);
+ }
+
+ MalformedRequestException(Exception x) {
+ super(x);
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/N1.java b/staging/darwin-x86/sample/nio/server/N1.java
new file mode 100644
index 0000000..d02bc93
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/N1.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+
+/**
+ * A non-blocking/single-threaded server. All accept() and
+ * read()/write() operations are performed by a single thread, but only
+ * after being selected for those operations by a Selector.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class N1 extends Server {
+
+ N1(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ ssc.configureBlocking(false);
+ }
+
+ void runServer() throws Exception {
+ Dispatcher d = new Dispatcher1();
+ d.register(ssc, SelectionKey.OP_ACCEPT,
+ new AcceptHandler(ssc, d, sslContext));
+ d.run();
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/N2.java b/staging/darwin-x86/sample/nio/server/N2.java
new file mode 100644
index 0000000..2a21612
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/N2.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * A non-blocking/dual-threaded which performs accept()s in one thread,
+ * and services requests in a second. Both threads use select().
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class N2 extends Server {
+
+ N2(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws Exception {
+ Dispatcher d = new DispatcherN();
+ Acceptor a = new Acceptor(ssc, d, sslContext);
+ new Thread(a).start();
+ d.run();
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/README.txt b/staging/darwin-x86/sample/nio/server/README.txt
new file mode 100644
index 0000000..aa803e8
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/README.txt
@@ -0,0 +1,279 @@
+ A Simple NIO-based HTTP/HTTPS Server Example
+
+
+INTRODUCTION
+============
+This directory contains a simple HTTP/HTTPS server. HTTP/HTTPS are two
+common network protocols that provide for data transfer, and are more
+fully described in RFC 2616 and RFC 2818 (Available at
+http://www.ietf.org ). HTTPS is essentially HTTP after the connection
+has been secured with SSL/TLS. TLS is the successor to SSL, and is
+described in RFC 2246.
+
+This server was written to demonstrate some of the functionality new to
+the Java 2 platform. The demo is not meant to be a full tutorial, and
+assumes the reader has some familiarity with the subject matter.
+
+In particular, it shows:
+
+ New I/O (java.nio, java.nio.channels, java.util.regex, java.nio.charset)
+
+ Introduced in version 1.4 of the platform, NIO was designed to
+ overcome some of the scalability limitations found in the
+ existing blocking java.net.* API's, and to address other
+ concepts such as Regular Expression parsing and Character
+ Sets.
+
+ This server demonstrates:
+
+ ByteBuffer
+ Blocking and Non-Blocking I/O
+ SocketChannel
+ ServerSocketChannel
+ Selector
+ CharacterSet
+ Pattern matching using Regular Expressions
+
+ JSSE (javax.net.ssl)
+
+ Introduced in version 1.4 of the platform, JSSE provides
+ network security using SSL/TLS for java.net.Socket-based
+ traffic. In version 1.5, the SSLEngine API was introduced
+ which separates the SSL/TLS functionality from the underlying
+ I/O model. By making this separation, applications can adapt
+ I/O and compute strategies to best fit their circumstances.
+
+ This server demonstrates:
+
+ Using SSLEngine to create a HTTPS server
+ Creating simple key material for use with HTTPS
+
+ Concurrency Library (java.util.concurrent)
+
+ Introduced in version 1.5 of the platform, the concurrency
+ library provides a mechanism which decouples task submission
+ from the mechanics of how each task will be run.
+
+ This server demonstrates:
+
+ A ThreadPool with a fixed number of threads, which is
+ based on the number of available processors.
+
+
+SETUP
+=====
+
+The server must be built on version 1.5 (or later) of the platform.
+Invoking the following should be sufficient:
+
+ % mkdir build
+ % javac -source 1.5 -target 1.5 -d build *.java
+
+The following creates the document root:
+
+ % mkdir root
+
+All documents should be placed in this directory.
+
+For HTTPS, the server authenticates itself to clients by using simple
+Public Key Infrastructure (PKI) credentials in the form of
+X509Certificates. You must create the server's credentials before
+attempting to run the server in "-secure" mode. The server is
+currently hardcoded to look for its credentials in a file called
+"testkeys".
+
+In this example, we'll create credentials for a fictional widget web
+site owned by the ubiquitous "Xyzzy, Inc.". When you run this in your
+own environment, replace "widgets.xyzzy.com" with the hostname of your
+server.
+
+The easiest way to create the SSL/TLS credentials is to use the
+java keytool, by doing the following:
+
+ (<CR> represents your end-of-line key)
+
+ % keytool -genkey -keyalg rsa -keystore testkeys -alias widgets
+ Enter keystore password: passphrase
+ What is your first and last name?
+ [Unknown]: widgets.xyzzy.com<CR>
+ What is the name of your organizational unit?
+ [Unknown]: Consumer Widgets Group<CR>
+ What is the name of your organization?
+ [Unknown]: Xyzzy, Inc.<CR>
+ What is the name of your City or Locality?
+ [Unknown]: Arcata<CR>
+ What is the name of your State or Province?
+ [Unknown]: CA<CR>
+ What is the two-letter country code for this unit?
+ [Unknown]: US<CR>
+ Is CN=widgets.xyzzy.com, OU=Consumer Widgets Group, O="Xyzzy, Inc.",
+ L=Arcata, ST=CA, C=US correct?
+ [no]: yes<CR>
+
+ Enter key password for <mykey>
+ (RETURN if same as keystore password): <CR>
+
+This directory also contain a very simple URL reader (URLDumper), which
+connects to a specified URL and places all output into a specified file.
+
+
+SERVER EXECUTION
+================
+
+ % java -classpath build Server N1
+
+ Usage: Server <type> [options]
+ type:
+ B1 Blocking/Single-threaded Server
+ BN Blocking/Multi-threaded Server
+ BP Blocking/Pooled-thread Server
+ N1 Nonblocking/Single-threaded Server
+ N2 Nonblocking/Dual-threaded Server
+
+ options:
+ -port port port number
+ default: 8000
+ -backlog backlog backlog
+ default: 1024
+ -secure encrypt with SSL/TLS
+ default is insecure
+
+"http://" URLs should be used with insecure mode, and
+"https://" for secure mode.
+
+The "B*" servers use classic blocking I/O: in other words, calls to
+read()/write() will not return until the I/O operation has completed. The
+"N*" servers use non-blocking mode and Selectors to determine which
+Channels are ready to perform I/O.
+
+B1: A single-threaded server which completely services each
+ connection before moving to the next.
+
+B2: A multi-threaded server which creates a new thread for each
+ connection. This is not efficient for large numbers of
+ connections.
+
+BP: A multi-threaded server which creates a pool of threads for use
+ by the server. The Thread pool decides how to schedule those
+ threads.
+
+N1: A single-threaded server. All accept() and read()/write()
+ operations are performed by a single thread, but only after
+ being selected for those operations by a Selector.
+
+N2: A dual-threaded server which performs accept()s in one thread, and
+ services requests in a second. Both threads use select().
+
+
+CLIENT EXECUTION
+================
+You can test the server using any standard browser such as Internet
+Explorer or Mozilla, but since the browser will not trust the
+credentials you just created, you may need to accept the credentials
+via the browser's pop-up dialog box.
+
+Alternatively, to use the certificates using the simple included JSSE
+client URLDumper, export the server certificate into a new truststore,
+and then run the application using the new truststore.
+
+ % keytool -export -keystore testkeys -alias widgets -file widgets.cer
+ Enter keystore password: passphrase<CR>
+ Certificate stored in file <widgets.cer>
+
+ % keytool -import -keystore trustCerts -alias widgetServer \
+ -file widgets.cer
+ Enter keystore password: passphrase<CR>
+ Owner: CN=widgets.xyzzy.com, OU=Consumer, O="xyzzy, inc.", L=Arcata,
+ ST=CA, C=US
+ Issuer: CN=widgets.xyzzy.com, OU=Consumer, O="xyzzy, inc.",
+ L=Arcata, ST=CA, C=US
+ Serial number: 4086cc7a
+ Valid from: Wed Apr 21 12:33:14 PDT 2004 until: Tue Jul 20 12:33:14
+ PDT 2004
+ Certificate fingerprints:
+ MD5: 39:71:42:CD:BF:0D:A9:8C:FB:8B:4A:CD:F8:6D:19:1F
+ SHA1: 69:5D:38:E9:F4:6C:E5:A7:4C:EA:45:8E:FB:3E:F3:9A:84:01:6F:22
+ Trust this certificate? [no]: yes<CR>
+ Certificate was added to keystore
+
+ % java -classpath build -Djavax.net.ssl.trustStore=trustCerts \
+ -Djavax.net.ssl.TrustStorePassword=passphrase \
+ URLDumper https://widgets.xyzzy.com:8000/ outputFile
+
+NOTE: The server must be run with "-secure" in order to receive
+"https://" URLs.
+
+WARNING: This is just a simple example for code exposition, you should
+spend more time understanding PKI security concerns.
+
+
+SOURCE CODE OVERVIEW
+====================
+
+The main class is Server, which handles program startup, and is
+subclassed by the "B*" and "N*" server classes.
+
+Following a successful accept(), the "B*" variants each create a
+RequestServicer object to perform the actual request/reply operations. The
+primary differences between the different "B*" servers is how the
+RequestServicer is actually run:
+
+ B1: RequestServicer.run() is directly called.
+ BN: A new thread is started, and the thread calls RequestServicer.run().
+ BP: A ThreadPool is created, and the pool framework is given Runnable
+ tasks to complete.
+
+In the "N*" variations, a Dispatcher object is created, which is
+responsible for performing the select, and then issuing the
+corresponding handler:
+
+ N1: A single thread is used for all accept()/read()/write() operations
+ N2: Similar to N1, but a separate thread is used for the accept()
+ operations.
+
+In all cases, once the connection has been accepted, a ChannelIO object
+is created to handle all I/O. In the insecure case, the corresponding
+SocketChannel methods are directly called. However in the secure case,
+more manipulations are needed to first secure the channel, then
+encrypt/decrypt the data, and finally properly send any shutdown
+messages. ChannelIOSecure extends ChannelIO, and provides the secure
+variants of the corresponding ChannelIO calls.
+
+RequestServicer and RequestHandler are the main drivers for the
+blocking and non-blocking variants, respectively. They are responsible
+for:
+
+ Performing any initial handshaking
+
+ Reading the request data
+ All data is stored in a local buffer in the ChannelIO
+ structure.
+
+ Parsing the request
+ The request data is obtained from the ChannelIO object, and
+ is processed by Request class, which represents the
+ parsed URI address.
+
+ Locating/preparing/sending the data or reporting error conditions.
+ A Reply object is created which represents the entire object to send,
+ including the HTTP/HTTPS headers.
+
+ Shutdown/closing the channel.
+
+
+CLOSING THOUGHTS
+================
+This example represents a simple server: it is not production quality.
+It was primarily meant to demonstrate the new APIs in versions 1.4 and
+1.5 of the platform.
+
+This example could certainly be expanded to address other areas of
+concern: for example, assigning multiple threads to handle the selected
+Channels, or delegating SSLEngine tasks to multiple threads. There are
+so many ways to implement compute and I/O strategies, we encourage you
+to experiment and find what works best for your situation.
+
+To steal a phrase from many textbooks:
+
+ "It is left as an exercise for the reader..."
+
diff --git a/staging/darwin-x86/sample/nio/server/Reply.java b/staging/darwin-x86/sample/nio/server/Reply.java
new file mode 100644
index 0000000..c128ee8
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Reply.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+/**
+ * An object used for sending Content to the requestor.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Reply implements Sendable {
+
+ /**
+ * A helper class which define the HTTP response codes
+ */
+ static class Code {
+
+ private int number;
+ private String reason;
+ private Code(int i, String r) { number = i; reason = r; }
+ public String toString() { return number + " " + reason; }
+
+ static Code OK = new Code(200, "OK");
+ static Code BAD_REQUEST = new Code(400, "Bad Request");
+ static Code NOT_FOUND = new Code(404, "Not Found");
+ static Code METHOD_NOT_ALLOWED = new Code(405, "Method Not Allowed");
+
+ }
+
+ private Code code;
+ private Content content;
+ private boolean headersOnly;
+
+ Reply(Code rc, Content c) {
+ this(rc, c, null);
+ }
+
+ Reply(Code rc, Content c, Request.Action head) {
+ code = rc;
+ content = c;
+ headersOnly = (head == Request.Action.HEAD);
+ }
+
+ private static String CRLF = "\r\n";
+ private static Charset ascii = Charset.forName("US-ASCII");
+
+ private ByteBuffer hbb = null;
+
+ private ByteBuffer headers() {
+ CharBuffer cb = CharBuffer.allocate(1024);
+ for (;;) {
+ try {
+ cb.put("HTTP/1.0 ").put(code.toString()).put(CRLF);
+ cb.put("Server: niossl/0.1").put(CRLF);
+ cb.put("Content-type: ").put(content.type()).put(CRLF);
+ cb.put("Content-length: ")
+ .put(Long.toString(content.length())).put(CRLF);
+ cb.put(CRLF);
+ break;
+ } catch (BufferOverflowException x) {
+ assert(cb.capacity() < (1 << 16));
+ cb = CharBuffer.allocate(cb.capacity() * 2);
+ continue;
+ }
+ }
+ cb.flip();
+ return ascii.encode(cb);
+ }
+
+ public void prepare() throws IOException {
+ content.prepare();
+ hbb = headers();
+ }
+
+ public boolean send(ChannelIO cio) throws IOException {
+
+ if (hbb == null)
+ throw new IllegalStateException();
+
+ if (hbb.hasRemaining()) {
+ if (cio.write(hbb) <= 0)
+ return true;
+ }
+
+ if (!headersOnly) {
+ if (content.send(cio))
+ return true;
+ }
+
+ if (!cio.dataFlush())
+ return true;
+
+ return false;
+ }
+
+ public void release() throws IOException {
+ content.release();
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/Request.java b/staging/darwin-x86/sample/nio/server/Request.java
new file mode 100644
index 0000000..fa36d1e
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Request.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.net.*;
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.regex.*;
+
+/**
+ * An encapsulation of the request received.
+ * <P>
+ * The static method parse() is responsible for creating this
+ * object.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Request {
+
+ /**
+ * A helper class for parsing HTTP command actions.
+ */
+ static class Action {
+
+ private String name;
+ private Action(String name) { this.name = name; }
+ public String toString() { return name; }
+
+ static Action GET = new Action("GET");
+ static Action PUT = new Action("PUT");
+ static Action POST = new Action("POST");
+ static Action HEAD = new Action("HEAD");
+
+ static Action parse(String s) {
+ if (s.equals("GET"))
+ return GET;
+ if (s.equals("PUT"))
+ return PUT;
+ if (s.equals("POST"))
+ return POST;
+ if (s.equals("HEAD"))
+ return HEAD;
+ throw new IllegalArgumentException(s);
+ }
+ }
+
+ private Action action;
+ private String version;
+ private URI uri;
+
+ Action action() { return action; }
+ String version() { return version; }
+ URI uri() { return uri; }
+
+ private Request(Action a, String v, URI u) {
+ action = a;
+ version = v;
+ uri = u;
+ }
+
+ public String toString() {
+ return (action + " " + version + " " + uri);
+ }
+
+ static boolean isComplete(ByteBuffer bb) {
+ int p = bb.position() - 4;
+ if (p < 0)
+ return false;
+ return (((bb.get(p + 0) == '\r') &&
+ (bb.get(p + 1) == '\n') &&
+ (bb.get(p + 2) == '\r') &&
+ (bb.get(p + 3) == '\n')));
+ }
+
+ private static Charset ascii = Charset.forName("US-ASCII");
+
+ /*
+ * The expected message format is first compiled into a pattern,
+ * and is then compared against the inbound character buffer to
+ * determine if there is a match. This convienently tokenizes
+ * our request into usable pieces.
+ *
+ * This uses Matcher "expression capture groups" to tokenize
+ * requests like:
+ *
+ * GET /dir/file HTTP/1.1
+ * Host: hostname
+ *
+ * into:
+ *
+ * group[1] = "GET"
+ * group[2] = "/dir/file"
+ * group[3] = "1.1"
+ * group[4] = "hostname"
+ *
+ * The text in between the parens are used to captured the regexp text.
+ */
+ private static Pattern requestPattern
+ = Pattern.compile("\\A([A-Z]+) +([^ ]+) +HTTP/([0-9\\.]+)$"
+ + ".*^Host: ([^ ]+)$.*\r\n\r\n\\z",
+ Pattern.MULTILINE | Pattern.DOTALL);
+
+ static Request parse(ByteBuffer bb) throws MalformedRequestException {
+
+ CharBuffer cb = ascii.decode(bb);
+ Matcher m = requestPattern.matcher(cb);
+ if (!m.matches())
+ throw new MalformedRequestException();
+ Action a;
+ try {
+ a = Action.parse(m.group(1));
+ } catch (IllegalArgumentException x) {
+ throw new MalformedRequestException();
+ }
+ URI u;
+ try {
+ u = new URI("http://"
+ + m.group(4)
+ + m.group(2));
+ } catch (URISyntaxException x) {
+ throw new MalformedRequestException();
+ }
+ return new Request(a, m.group(3), u);
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/RequestHandler.java b/staging/darwin-x86/sample/nio/server/RequestHandler.java
new file mode 100644
index 0000000..91d2bda
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/RequestHandler.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+
+/**
+ * Primary driver class used by non-blocking Servers to receive,
+ * prepare, send, and shutdown requests.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class RequestHandler implements Handler {
+
+ private ChannelIO cio;
+ private ByteBuffer rbb = null;
+
+ private boolean requestReceived = false;
+ private Request request = null;
+ private Reply reply = null;
+
+ private static int created = 0;
+
+ RequestHandler(ChannelIO cio) {
+ this.cio = cio;
+
+ // Simple heartbeat to let user know we're alive.
+ synchronized (RequestHandler.class) {
+ created++;
+ if ((created % 50) == 0) {
+ System.out.println(".");
+ created = 0;
+ } else {
+ System.out.print(".");
+ }
+ }
+ }
+
+ // Returns true when request is complete
+ // May expand rbb if more room required
+ //
+ private boolean receive(SelectionKey sk) throws IOException {
+ ByteBuffer tmp = null;
+
+ if (requestReceived) {
+ return true;
+ }
+
+ if (!cio.doHandshake(sk)) {
+ return false;
+ }
+
+ if ((cio.read() < 0) || Request.isComplete(cio.getReadBuf())) {
+ rbb = cio.getReadBuf();
+ return (requestReceived = true);
+ }
+ return false;
+ }
+
+ // When parse is successfull, saves request and returns true
+ //
+ private boolean parse() throws IOException {
+ try {
+ request = Request.parse(rbb);
+ return true;
+ } catch (MalformedRequestException x) {
+ reply = new Reply(Reply.Code.BAD_REQUEST,
+ new StringContent(x));
+ }
+ return false;
+ }
+
+ // Ensures that reply field is non-null
+ //
+ private void build() throws IOException {
+ Request.Action action = request.action();
+ if ((action != Request.Action.GET) &&
+ (action != Request.Action.HEAD)) {
+ reply = new Reply(Reply.Code.METHOD_NOT_ALLOWED,
+ new StringContent(request.toString()));
+ }
+ reply = new Reply(Reply.Code.OK,
+ new FileContent(request.uri()), action);
+ }
+
+ public void handle(SelectionKey sk) throws IOException {
+ try {
+
+ if (request == null) {
+ if (!receive(sk))
+ return;
+ rbb.flip();
+ if (parse())
+ build();
+ try {
+ reply.prepare();
+ } catch (IOException x) {
+ reply.release();
+ reply = new Reply(Reply.Code.NOT_FOUND,
+ new StringContent(x));
+ reply.prepare();
+ }
+ if (send()) {
+ // More bytes remain to be written
+ sk.interestOps(SelectionKey.OP_WRITE);
+ } else {
+ // Reply completely written; we're done
+ if (cio.shutdown()) {
+ cio.close();
+ reply.release();
+ }
+ }
+ } else {
+ if (!send()) { // Should be rp.send()
+ if (cio.shutdown()) {
+ cio.close();
+ reply.release();
+ }
+ }
+ }
+ } catch (IOException x) {
+ String m = x.getMessage();
+ if (!m.equals("Broken pipe") &&
+ !m.equals("Connection reset by peer")) {
+ System.err.println("RequestHandler: " + x.toString());
+ }
+
+ try {
+ /*
+ * We had a failure here, so we'll try to be nice
+ * before closing down and send off a close_notify,
+ * but if we can't get the message off with one try,
+ * we'll just shutdown.
+ */
+ cio.shutdown();
+ } catch (IOException e) {
+ // ignore
+ }
+
+ cio.close();
+ if (reply != null) {
+ reply.release();
+ }
+ }
+
+ }
+
+ private boolean send() throws IOException {
+ try {
+ return reply.send(cio);
+ } catch (IOException x) {
+ if (x.getMessage().startsWith("Resource temporarily")) {
+ System.err.println("## RTA");
+ return true;
+ }
+ throw x;
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/RequestServicer.java b/staging/darwin-x86/sample/nio/server/RequestServicer.java
new file mode 100644
index 0000000..88d40b5
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/RequestServicer.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+
+/**
+ * Primary driver class used by blocking Servers to receive,
+ * prepare, send, and shutdown requests.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class RequestServicer implements Runnable {
+
+ private ChannelIO cio;
+
+ private static int created = 0;
+
+ RequestServicer(ChannelIO cio) {
+ this.cio = cio;
+
+ // Simple heartbeat to let user know we're alive.
+ synchronized (RequestServicer.class) {
+ created++;
+ if ((created % 50) == 0) {
+ System.out.println(".");
+ created = 0;
+ } else {
+ System.out.print(".");
+ }
+ }
+ }
+
+ private void service() throws IOException {
+ Reply rp = null;
+ try {
+ ByteBuffer rbb = receive(); // Receive
+ Request rq = null;
+ try { // Parse
+ rq = Request.parse(rbb);
+ } catch (MalformedRequestException x) {
+ rp = new Reply(Reply.Code.BAD_REQUEST,
+ new StringContent(x));
+ }
+ if (rp == null) rp = build(rq); // Build
+ do {} while (rp.send(cio)); // Send
+ do {} while (!cio.shutdown());
+ cio.close();
+ rp.release();
+ } catch (IOException x) {
+ String m = x.getMessage();
+ if (!m.equals("Broken pipe") &&
+ !m.equals("Connection reset by peer")) {
+ System.err.println("RequestHandler: " + x.toString());
+ }
+
+ try {
+ /*
+ * We had a failure here, so we'll try to be nice
+ * before closing down and send off a close_notify,
+ * but if we can't get the message off with one try,
+ * we'll just shutdown.
+ */
+ cio.shutdown();
+ } catch (IOException e) {
+ // ignore
+ }
+
+ cio.close();
+ if (rp != null) {
+ rp.release();
+ }
+ }
+ }
+
+ public void run() {
+ try {
+ service();
+ } catch (IOException x) {
+ x.printStackTrace();
+ }
+ }
+
+ ByteBuffer receive() throws IOException {
+
+ do {} while (!cio.doHandshake());
+
+ for (;;) {
+ int read = cio.read();
+ ByteBuffer bb = cio.getReadBuf();
+ if ((read < 0) || (Request.isComplete(bb))) {
+ bb.flip();
+ return bb;
+ }
+ }
+ }
+
+ Reply build(Request rq) throws IOException {
+
+ Reply rp = null;
+ Request.Action action = rq.action();
+ if ((action != Request.Action.GET) &&
+ (action != Request.Action.HEAD))
+ rp = new Reply(Reply.Code.METHOD_NOT_ALLOWED,
+ new StringContent(rq.toString()));
+ else
+ rp = new Reply(Reply.Code.OK,
+ new FileContent(rq.uri()), action);
+ try {
+ rp.prepare();
+ } catch (IOException x) {
+ rp.release();
+ rp = new Reply(Reply.Code.NOT_FOUND,
+ new StringContent(x));
+ rp.prepare();
+ }
+ return rp;
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/Sendable.java b/staging/darwin-x86/sample/nio/server/Sendable.java
new file mode 100644
index 0000000..44ac848
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Sendable.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+
+/**
+ * Method definitions used for preparing, sending, and release
+ * content.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Sendable {
+
+ void prepare() throws IOException;
+
+ // Sends (some) content to the given channel.
+ // Returns true if more bytes remain to be written.
+ // Throws IllegalStateException if not prepared.
+ //
+ boolean send(ChannelIO cio) throws IOException;
+
+ void release() throws IOException;
+}
diff --git a/staging/darwin-x86/sample/nio/server/Server.java b/staging/darwin-x86/sample/nio/server/Server.java
new file mode 100644
index 0000000..1ac6421
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/Server.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.net.*;
+import java.nio.channels.*;
+import java.security.*;
+import javax.net.ssl.*;
+
+/**
+ * The main server base class.
+ * <P>
+ * This class is responsible for setting up most of the server state
+ * before the actual server subclasses take over.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public abstract class Server {
+
+ ServerSocketChannel ssc;
+ SSLContext sslContext = null;
+
+ static private int PORT = 8000;
+ static private int BACKLOG = 1024;
+ static private boolean SECURE = false;
+
+ Server(int port, int backlog,
+ boolean secure) throws Exception {
+
+ if (secure) {
+ createSSLContext();
+ }
+
+ ssc = ServerSocketChannel.open();
+ ssc.socket().setReuseAddress(true);
+ ssc.socket().bind(new InetSocketAddress(port), backlog);
+ }
+
+ /*
+ * If this is a secure server, we now setup the SSLContext we'll
+ * use for creating the SSLEngines throughout the lifetime of
+ * this process.
+ */
+ private void createSSLContext() throws Exception {
+
+ char[] passphrase = "passphrase".toCharArray();
+
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(new FileInputStream("testkeys"), passphrase);
+
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, passphrase);
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(ks);
+
+ sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ }
+
+ abstract void runServer() throws Exception;
+
+ static private void usage() {
+ System.out.println(
+ "Usage: Server <type> [options]\n"
+ + " type:\n"
+ + " B1 Blocking/Single-threaded Server\n"
+ + " BN Blocking/Multi-threaded Server\n"
+ + " BP Blocking/Pooled-Thread Server\n"
+ + " N1 Nonblocking/Single-threaded Server\n"
+ + " N2 Nonblocking/Dual-threaded Server\n"
+ + "\n"
+ + " options:\n"
+ + " -port port port number\n"
+ + " default: " + PORT + "\n"
+ + " -backlog backlog backlog\n"
+ + " default: " + BACKLOG + "\n"
+ + " -secure encrypt with SSL/TLS");
+ System.exit(1);
+ }
+
+ /*
+ * Parse the arguments, decide what type of server to run,
+ * see if there are any defaults to change.
+ */
+ static private Server createServer(String args[]) throws Exception {
+ if (args.length < 1) {
+ usage();
+ }
+
+ int port = PORT;
+ int backlog = BACKLOG;
+ boolean secure = SECURE;
+
+ for (int i = 1; i < args.length; i++) {
+ if (args[i].equals("-port")) {
+ checkArgs(i, args.length);
+ port = Integer.valueOf(args[++i]);
+ } else if (args[i].equals("-backlog")) {
+ checkArgs(i, args.length);
+ backlog = Integer.valueOf(args[++i]);
+ } else if (args[i].equals("-secure")) {
+ secure = true;
+ } else {
+ usage();
+ }
+ }
+
+ Server server = null;
+
+ if (args[0].equals("B1")) {
+ server = new B1(port, backlog, secure);
+ } else if (args[0].equals("BN")) {
+ server = new BN(port, backlog, secure);
+ } else if (args[0].equals("BP")) {
+ server = new BP(port, backlog, secure);
+ } else if (args[0].equals("N1")) {
+ server = new N1(port, backlog, secure);
+ } else if (args[0].equals("N2")) {
+ server = new N2(port, backlog, secure);
+ }
+
+ return server;
+ }
+
+ static private void checkArgs(int i, int len) {
+ if ((i + 1) >= len) {
+ usage();
+ }
+ }
+
+ static public void main(String args[]) throws Exception {
+ Server server = createServer(args);
+
+ if (server == null) {
+ usage();
+ }
+
+ System.out.println("Server started.");
+ server.runServer();
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/StringContent.java b/staging/darwin-x86/sample/nio/server/StringContent.java
new file mode 100644
index 0000000..267b338
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/StringContent.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+/**
+ * A Content type that provides for transferring Strings.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class StringContent implements Content {
+
+ private static Charset ascii = Charset.forName("US-ASCII");
+
+ private String type; // MIME type
+ private String content;
+
+ StringContent(CharSequence c, String t) {
+ content = c.toString();
+ if (!content.endsWith("\n"))
+ content += "\n";
+ type = t + "; charset=iso-8859-1";
+ }
+
+ StringContent(CharSequence c) {
+ this(c, "text/plain");
+ }
+
+ StringContent(Exception x) {
+ StringWriter sw = new StringWriter();
+ x.printStackTrace(new PrintWriter(sw));
+ type = "text/plain; charset=iso-8859-1";
+ content = sw.toString();
+ }
+
+ public String type() {
+ return type;
+ }
+
+ private ByteBuffer bb = null;
+
+ private void encode() {
+ if (bb == null)
+ bb = ascii.encode(CharBuffer.wrap(content));
+ }
+
+ public long length() {
+ encode();
+ return bb.remaining();
+ }
+
+ public void prepare() {
+ encode();
+ bb.rewind();
+ }
+
+ public boolean send(ChannelIO cio) throws IOException {
+ if (bb == null)
+ throw new IllegalStateException();
+ cio.write(bb);
+
+ return bb.hasRemaining();
+ }
+
+ public void release() throws IOException {
+ }
+}
diff --git a/staging/darwin-x86/sample/nio/server/URLDumper.java b/staging/darwin-x86/sample/nio/server/URLDumper.java
new file mode 100644
index 0000000..30166e7
--- /dev/null
+++ b/staging/darwin-x86/sample/nio/server/URLDumper.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.net.*;
+
+/**
+ * A simple example to illustrate using a URL to access a resource
+ * and then store the result to a File.
+ * <P>
+ * Any type of URL can be used: http, https, ftp, etc.
+ *
+ * @author Brad R. Wetmore
+ * @author Mark Reinhold
+ */
+public class URLDumper {
+ public static void main(String[] args) throws Exception {
+
+ if (args.length != 2) {
+ System.out.println("Usage: URLDumper <URL> <file>");
+ System.exit(1);
+ }
+
+ String location = args[0];
+ String file = args[1];
+
+ URL url = new URL(location);
+ FileOutputStream fos = new FileOutputStream(file);
+
+ byte [] bytes = new byte [4096];
+
+ InputStream is = url.openStream();
+
+ int read;
+
+ while ((read = is.read(bytes)) != -1) {
+ fos.write(bytes, 0, read);
+ }
+
+ is.close();
+ fos.close();
+ }
+}
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/README.txt b/staging/darwin-x86/sample/scripting/scriptpad/README.txt
new file mode 100644
index 0000000..ab4bd5f
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/README.txt
@@ -0,0 +1,122 @@
+Scriptpad Sample
+
+* Introduction
+
+Scriptpad is a notepad like editor to open/edit/save and run
+script (JavaScript) files. This sample demonstrates the use of
+javax.script (JSR-223) API and JavaScript engine that is bundled
+with JDK 6.
+
+Scriptpad sample demonstrates how to use Javascript to use Java
+classes and objects to perform various tasks such as to modify,
+customize Swing GUI or to connect to a running application and
+monitor it using JMX (Java Management Extensions) API.
+
+* How to run Scriptpad?
+
+Scriptpad can be run with the following command:
+
+ java -jar ./build/scriptpad.jar
+
+(be sure to use the correct version of java). You can
+open/edit/save scripts using menu items under "File" menu.
+To run currently edited script, you can use "Tools->Run" menu.
+
+For example, you may enter
+
+ alert("hello, world");
+
+in the editor and run the same with "Tools->Run" menu.
+You will see an alert box with the message "hello, world".
+
+In addition to being a simple script editor/runner, scriptpad
+can be used to connect to a JMX MBean server ("Tools->JMX Connect"
+menu). User can specify JMX hostname and port. After connecting,
+user can use "monitoring and management" script functions defined
+in "mm.js" (see below).
+
+* Scriptpad Sources
+
+com.sun.demo.scriptpad.Main class is the entry point of this
+sample. This class creates ScriptEngine and evaluates few
+JavaScript "files" -- which are stored as resources (please
+refer to src/resources/*.js). Actual code for the scriptpad's
+main functionality lives in these JavaScript files.
+
+1. conc.js
+ -- simple concurrency utilities for JavaScript
+
+2. gui.js
+ -- simple GUI utilities for JavaScript
+
+3. mm.js
+ -- Monitoring and Management utilities for JavaScript
+
+4. scriptpad.js
+ -- This creates main "notepad"-like GUI for open/edit/save
+ and run script files
+
+5. Main.js
+ -- This script file can be used under "jrunscript" tool.
+ jrunscript is an experimental tool shipped with JDK (under
+ $JDK_HOME/bin directory). The scriptpad application can be
+ run by the following commands:
+
+ cd ./src/resources
+ $JDK_HOME/bin/jrunscript -f Main.js -f -
+
+
+* Extending Scriptpad:
+
+It is possible to extend scriptpad using scripts. There is a global
+object called "application". This object has 2 fields and a method.
+
+ Fields of the application object:
+
+ frame -> JFrame of the scriptpad
+ editor -> editor pane of the scriptpad
+
+ Method of the application object:
+
+ addTool -> adds a menu item under "Tools" menu
+
+ Example script to add "Tools->Hello" menu item:
+
+ application.addTool("Hello",
+ function() { alert("hello, world"); });
+
+After running the above script, you can click Tools->Hello menu item
+and you'll see an alert box.
+
+Scriptpad customization may also be done by defining a file named
+"scriptpad.js" under your home directory,. If this file is found,
+scriptpad loads this file just after initializating everything.
+In your initialization file, you can additional script functions
+by "load" function.
+
+* Script Samples:
+
+On clicking the menu items under "Examples" menu, scriptpad shows
+built-in examples in the editor. Also, there are few script samples
+under the ./src/scripts directory.
+
+* Monitoring and Management with Scriptpad:
+
+(1) Start the application with the JMX agent - here's an example of
+ how the Java2D demo is started
+
+ java -Dcom.sun.management.jmxremote.port=1090 \
+ -Dcom.sun.management.jmxremote.ssl=false \
+ -Dcom.sun.management.jmxremote.authenticate=false \
+ -jar $JDK_HOME/demo/jfc/Font2DTest/Font2DTest.jar
+
+(2) Start scriptpad and click on "Tools->JMX Connect" menu.
+ In the prompt, enter "localhost:1090" to connect to the above
+ program.
+
+After connecting to a MBeanServer (using "Tools->JMX Connect"),
+you can run any script that uses functions defined in "mm.js".
+For example, it is possible to load and run management scripts that
+are part of JConsole script shell plugin under the directory:
+
+ $JDK_HOME/demo/scripting/jconsole-plugin/src/scripts
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/build.properties b/staging/darwin-x86/sample/scripting/scriptpad/build.properties
new file mode 100644
index 0000000..efcd591
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/build.properties
@@ -0,0 +1,22 @@
+main.dir=.
+
+src.dir=${main.dir}/src
+
+build.dir=build
+classes.dir=${build.dir}/classes
+jar=${build.dir}/scriptpad.jar
+javadoc.dir=${build.dir}/javadoc
+
+build.sysclasspath=ignore
+# E.g.: cp=lib/x.jar:lib/y.jar
+cp=
+extra.run.cp=
+
+main.class=com.sun.sample.scriptpad.Main
+
+run.cp=${cp}:${classes.dir}:${extra.run.cp}
+
+debug=true
+deprecation=false
+
+nbjdk.home=${basedir}/../../..
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/build.xml b/staging/darwin-x86/sample/scripting/scriptpad/build.xml
new file mode 100644
index 0000000..5f203d5
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/build.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+
+<!--
+ This is ant (http://ant.apache.org) build script to build the
+ "Scriptpad" sample. Either this build.xml can be used standalone
+ with "ant" tool or can be opened as a project with NetBeans IDE
+ (http://www.netbeans.org).
+-->
+
+<project name="Scriptpad" default="jar" basedir=".">
+
+ <import file="nbproject/jdk.xml"/>
+
+ <target name="-prop-init">
+ <property file="user.build.properties"/>
+ <property file="build.properties"/>
+ </target>
+
+ <target name="-init" depends="-prop-init,-jdk-init"/>
+
+ <target name="compile" depends="-init" description="Compile main sources.">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ </javac>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}"/>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile" description="Build JAR file for main sources.">
+ <jar jarfile="${jar}" compress="true">
+ <manifest>
+ <attribute name="Main-Class" value="${main.class}"/>
+ </manifest>
+ <fileset dir="${classes.dir}"/>
+ </jar>
+ </target>
+
+ <target name="run" depends="compile" description="Run application.">
+ <fail unless="main.class">Must set property 'main.class' (e.g. in build.properties)</fail>
+ <java classname="${main.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ </java>
+ </target>
+
+ <target name="javadoc" depends="-init" description="Build Javadoc.">
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc destdir="${javadoc.dir}">
+ <classpath path="${cp}"/>
+ <sourcepath>
+ <pathelement location="${src.dir}"/>
+ </sourcepath>
+ <fileset dir="${src.dir}"/>
+ </javadoc>
+ </target>
+
+ <target name="clean" depends="-init" description="Clean build products.">
+ <delete dir="${build.dir}"/>
+ <delete file="${jar}"/>
+ </target>
+
+ <target name="profile">
+ <ant antfile="nbproject/netbeans-targets.xml" target="profile"/>
+ </target>
+</project>
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/nbproject/file-targets.xml b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/file-targets.xml
new file mode 100644
index 0000000..0904977
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/file-targets.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="scriptpad/file">
+
+ <import file="../build.xml"/>
+
+ <target name="compile-selected" depends="-init">
+ <fail unless="includes">Must set property 'includes'</fail>
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" includes="${includes}">
+ <classpath path="${cp}"/>
+ </javac>
+ </target>
+
+</project>
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/nbproject/jdk.xml b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/jdk.xml
new file mode 100644
index 0000000..2b85b77
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/jdk.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project name="jdk" basedir=".">
+
+ <target name="-jdk-preinit">
+ <condition property=".exe" value=".exe">
+ <os family="windows"/>
+ </condition>
+ <property name=".exe" value=""/>
+ <property name="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}"/>
+ <property name="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}"/>
+ <property name="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}"/>
+ <property name="nbjdk.appletviewer" value="${nbjdk.home}/bin/appletviewer${.exe}"/>
+ <property name="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar"/>
+ </target>
+
+ <target name="-jdk-presetdef-basic" depends="-jdk-preinit" unless="nbjdk.presetdef.basic.done">
+ <macrodef name="javac-presetdef">
+ <attribute name="javacval"/>
+ <sequential>
+ <presetdef name="javac">
+ <javac fork="yes" executable="@{javacval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javac-presetdef javacval="${nbjdk.javac}"/>
+ <macrodef name="java-presetdef">
+ <attribute name="javaval"/>
+ <sequential>
+ <presetdef name="java">
+ <java fork="yes" jvm="@{javaval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <java-presetdef javaval="${nbjdk.java}"/>
+ <macrodef name="javadoc-presetdef">
+ <attribute name="javadocval"/>
+ <sequential>
+ <presetdef name="javadoc">
+ <javadoc executable="@{javadocval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
+ <property name="nbjdk.presetdef.basic.done" value="true"/>
+ </target>
+
+ <target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" unless="nbjdk.presetdef.nbjpdastart.done">
+ <macrodef name="nbjpdastart-presetdef">
+ <attribute name="bootcpval"/>
+ <sequential>
+ <presetdef name="nbjpdastart">
+ <nbjpdastart>
+ <bootclasspath>
+ <path path="@{bootcpval}"/>
+ </bootclasspath>
+ </nbjpdastart>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
+ <property name="nbjdk.presetdef.nbjpdastart.done" value="true"/>
+ </target>
+
+ <target name="-jdk-init" depends="-jdk-preinit,-jdk-presetdef-basic"/>
+
+</project>
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml
new file mode 100644
index 0000000..b53c34d
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="scriptpad/NB">
+
+ <import file="../build.xml"/>
+
+ <target name="debug" depends="compile,-jdk-presetdef-nbjpdastart">
+ <nbjpdastart addressproperty="jpda.address" name="scriptpad" transport="dt_socket">
+ <classpath path="${run.cp}"/>
+ </nbjpdastart>
+ <java classname="${main.class}" failonerror="true" fork="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=none"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ </java>
+ </target>
+
+ <target name="debug-fix" depends="-init">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ <include name="${class}.java"/>
+ </javac>
+ <nbjpdareload>
+ <fileset dir="${classes.dir}">
+ <include name="${class}.class"/>
+ </fileset>
+ </nbjpdareload>
+ </target>
+
+ <target name="show-javadoc" depends="javadoc">
+ <nbbrowse file="${javadoc.dir}/index.html"/>
+ </target>
+
+ <target name="profile" depends="compile">
+ <nbprofiledirect>
+ <classpath path="${run.cp}"/>
+ </nbprofiledirect>
+ <property environment="env"/>
+ <java classname="${main.class}" fork="true" failonerror="true" dir="${profiler.session.working.dir}" jvm="${profiler.info.jvm}">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}"/>
+ <env key="Path" path="${profiler.info.agentpath}:${env.Path}"/>
+ </java>
+ </target>
+
+</project>
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/nbproject/project.xml b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/project.xml
new file mode 100644
index 0000000..32135c7
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/nbproject/project.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>Scriptpad</name>
+ <properties>
+ <property-file>user.build.properties</property-file>
+ <property-file>build.properties</property-file>
+ <property name="nbjdk.bootclasspath">${nbjdk.home}/jre/lib/rt.jar</property>
+ </properties>
+ <folders>
+ <source-folder>
+ <label>JDK Demo</label>
+ <location>${main.dir}</location>
+ </source-folder>
+ <source-folder>
+ <label>Sources</label>
+ <type>java</type>
+ <location>${src.dir}</location>
+ </source-folder>
+ <build-folder>
+ <location>${build.dir}</location>
+ </build-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>jar</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>jar</target>
+ </action>
+ <action name="run">
+ <target>run</target>
+ </action>
+ <action name="javadoc">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>show-javadoc</target>
+ </action>
+ <action name="debug">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ </action>
+ <action name="compile.single">
+ <script>nbproject/file-targets.xml</script>
+ <target>compile-selected</target>
+ <context>
+ <property>includes</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path</format>
+ <arity>
+ <separated-files>,</separated-files>
+ </arity>
+ </context>
+ </action>
+ <action name="run.single">
+ <target>run</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.single">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.fix">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug-fix</target>
+ <context>
+ <property>class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path-noext</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ </ide-actions>
+ <export>
+ <type>jar</type>
+ <location>${jar}</location>
+ <build-target>jar</build-target>
+ <clean-target>clean</clean-target>
+ </export>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>Sources</label>
+ <location>${src.dir}</location>
+ </source-folder>
+ <source-file>
+ <location>${main.dir}/README.txt</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="build"/>
+ <ide-action name="rebuild"/>
+ <ide-action name="clean"/>
+ <ide-action name="javadoc"/>
+ <separator/>
+ <ide-action name="run"/>
+ <ide-action name="debug"/>
+ </context-menu>
+ </view>
+ <subprojects/>
+ </general-data>
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
+ <compilation-unit>
+ <package-root>${src.dir}</package-root>
+ <classpath mode="compile">${cp}</classpath>
+ <classpath mode="execute">${run.cp}</classpath>
+ <classpath mode="boot">${nbjdk.bootclasspath}</classpath>
+ <built-to>${classes.dir}</built-to>
+ <built-to>${jar}</built-to>
+ <javadoc-built-to>${javadoc.dir}</javadoc-built-to>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf b/staging/darwin-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf
new file mode 100644
index 0000000..76eda30
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf
@@ -0,0 +1,2 @@
+Main-Class: com.sun.sample.scriptpad.Main
+
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java b/staging/darwin-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java
new file mode 100644
index 0000000..aaeb58d
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.sample.scriptpad;
+
+import javax.script.*;
+import java.io.*;
+
+/**
+ * This is the entry point of "Scriptpad" sample. This class creates
+ * ScriptEngine and evaluates few JavaScript "files" -- which are stored
+ * as resources (please refer to src/resources/*.js). Actual code for the
+ * scriptpad's main functionality lives in these JavaScript files.
+ */
+public class Main {
+ public static void main(String[] args) throws Exception {
+
+ // create a ScriptEngineManager
+ ScriptEngineManager m = new ScriptEngineManager();
+ // get an instance of JavaScript script engine
+ ScriptEngine engine = m.getEngineByName("js");
+
+ // expose the current script engine as a global variable
+ engine.put("engine", engine);
+
+ // evaluate few scripts that are bundled in "resources"
+ eval(engine, "conc.js");
+ eval(engine, "gui.js");
+ eval(engine, "scriptpad.js");
+ eval(engine, "mm.js");
+ }
+
+ private static void eval(ScriptEngine engine, String name)
+ throws Exception {
+ /*
+ * This class is compiled into a jar file. The jar file
+ * contains few scripts under /resources URL.
+ */
+ InputStream is = Main.class.getResourceAsStream("/resources/" + name);
+ // current script file name for better error messages
+ engine.put(ScriptEngine.FILENAME, name);
+ // evaluate the script in the InputStream
+ engine.eval(new InputStreamReader(is));
+ }
+}
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/resources/Main.js b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/Main.js
new file mode 100644
index 0000000..a1c332d
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/Main.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script can be loaded in jrunscript to start scriptpad.
+ *
+ * jrunscript -f Main.js -f -
+ */
+
+load("conc.js");
+load("gui.js");
+load("scriptpad.js");
+load("mm.js");
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/resources/conc.js b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/conc.js
new file mode 100644
index 0000000..aaca49a
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/conc.js
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * Concurrency utilities for JavaScript. These are based on
+ * java.lang and java.util.concurrent API. The following functions
+ * provide a simpler API for scripts. Instead of directly using java.lang
+ * and java.util.concurrent classes, scripts can use functions and
+ * objects exported from here.
+ */
+
+// shortcut for j.u.c lock classes
+var Lock = java.util.concurrent.locks.ReentrantLock;
+var RWLock = java.util.concurrent.locks.ReentrantReadWriteLock;
+
+// check if there is a build in sync function, define one if missing
+if (typeof sync === "undefined") {
+ var sync = function(func, obj) {
+ if (arguments.length < 1 || arguments.length > 2 ) {
+ throw "sync(function [,object]) parameter count mismatch";
+ }
+
+ var syncobj = (arguments.length == 2 ? obj : this);
+
+ if (!syncobj._syncLock) {
+ syncobj._syncLock = new Lock();
+ }
+
+ return function() {
+ syncobj._syncLock.lock();
+ try {
+ func.apply(null, arguments);
+ } finally {
+ syncobj._syncLock.unlock();
+ }
+ };
+ };
+ sync.docString = "synchronize a function, optionally on an object";
+}
+
+/**
+ * Wrapper for java.lang.Object.wait
+ *
+ * can be called only within a sync method
+ */
+function wait(object) {
+ var objClazz = java.lang.Class.forName('java.lang.Object');
+ var waitMethod = objClazz.getMethod('wait', null);
+ waitMethod.invoke(object, null);
+}
+wait.docString = "convenient wrapper for java.lang.Object.wait method";
+
+/**
+ * Wrapper for java.lang.Object.notify
+ *
+ * can be called only within a sync method
+ */
+function notify(object) {
+ var objClazz = java.lang.Class.forName('java.lang.Object');
+ var notifyMethod = objClazz.getMethod('notify', null);
+ notifyMethod.invoke(object, null);
+}
+notify.docString = "convenient wrapper for java.lang.Object.notify method";
+
+/**
+ * Wrapper for java.lang.Object.notifyAll
+ *
+ * can be called only within a sync method
+ */
+function notifyAll(object) {
+ var objClazz = java.lang.Class.forName('java.lang.Object');
+ var notifyAllMethod = objClazz.getMethod('notifyAll', null);
+ notifyAllMethod.invoke(object, null);
+}
+notifyAll.docString = "convenient wrapper for java.lang.Object.notifyAll method";
+
+/**
+ * Creates a java.lang.Runnable from a given script
+ * function.
+ */
+Function.prototype.runnable = function() {
+ var args = arguments;
+ var func = this;
+ return new java.lang.Runnable() {
+ run: function() {
+ func.apply(null, args);
+ }
+ }
+};
+
+/**
+ * Executes the function on a new Java Thread.
+ */
+Function.prototype.thread = function() {
+ var t = new java.lang.Thread(this.runnable.apply(this, arguments));
+ t.start();
+ return t;
+};
+
+/**
+ * Executes the function on a new Java daemon Thread.
+ */
+Function.prototype.daemon = function() {
+ var t = new java.lang.Thread(this.runnable.apply(this, arguments));
+ t.setDaemon(true);
+ t.start();
+ return t;
+};
+
+/**
+ * Creates a java.util.concurrent.Callable from a given script
+ * function.
+ */
+Function.prototype.callable = function() {
+ var args = arguments;
+ var func = this;
+ return new java.util.concurrent.Callable() {
+ call: function() { return func.apply(null, args); }
+ }
+};
+
+/**
+ * Registers the script function so that it will be called exit.
+ */
+Function.prototype.atexit = function () {
+ var args = arguments;
+ java.lang.Runtime.getRuntime().addShutdownHook(
+ new java.lang.Thread(this.runnable.apply(this, args)));
+};
+
+/**
+ * Executes the function asynchronously.
+ *
+ * @return a java.util.concurrent.FutureTask
+ */
+Function.prototype.future = (function() {
+ // default executor for future
+ var juc = java.util.concurrent;
+ var theExecutor = juc.Executors.newSingleThreadExecutor();
+ // clean-up the default executor at exit
+ (function() { theExecutor.shutdown(); }).atexit();
+ return function() {
+ return theExecutor.submit(this.callable.apply(this, arguments));
+ };
+})();
+
+/**
+ * Executes a function after acquiring given lock. On return,
+ * (normal or exceptional), lock is released.
+ *
+ * @param lock lock that is locked and unlocked
+ */
+Function.prototype.sync = function (lock) {
+ if (arguments.length == 0) {
+ throw "lock is missing";
+ }
+ var res = new Array(arguments.length - 1);
+ for (var i = 0; i < res.length; i++) {
+ res[i] = arguments[i + 1];
+ }
+ lock.lock();
+ try {
+ this.apply(null, res);
+ } finally {
+ lock.unlock();
+ }
+};
+
+/**
+ * Causes current thread to sleep for specified
+ * number of milliseconds
+ *
+ * @param interval in milliseconds
+ */
+function sleep(interval) {
+ java.lang.Thread.sleep(interval);
+}
+sleep.docString = "wrapper for java.lang.Thread.sleep method";
+
+/**
+ * Schedules a task to be executed once in N milliseconds specified.
+ *
+ * @param callback function or expression to evaluate
+ * @param interval in milliseconds to sleep
+ * @return timeout ID (which is nothing but Thread instance)
+ */
+function setTimeout(callback, interval) {
+ if (! (callback instanceof Function)) {
+ callback = new Function(callback);
+ }
+
+ // start a new thread that sleeps given time
+ // and calls callback in an infinite loop
+ return (function() {
+ try {
+ sleep(interval);
+ } catch (x) { }
+ callback();
+ }).daemon();
+}
+setTimeout.docString = "calls given callback once after specified interval";
+
+/**
+ * Cancels a timeout set earlier.
+ * @param tid timeout ID returned from setTimeout
+ */
+function clearTimeout(tid) {
+ // we just interrupt the timer thread
+ tid.interrupt();
+}
+clearTimeout.docString = "interrupt a setTimeout timer";
+
+/**
+ * Schedules a task to be executed once in
+ * every N milliseconds specified.
+ *
+ * @param callback function or expression to evaluate
+ * @param interval in milliseconds to sleep
+ * @return timeout ID (which is nothing but Thread instance)
+ */
+function setInterval(callback, interval) {
+ if (! (callback instanceof Function)) {
+ callback = new Function(callback);
+ }
+
+ // start a new thread that sleeps given time
+ // and calls callback in an infinite loop
+ return (function() {
+ while (true) {
+ try {
+ sleep(interval);
+ } catch (x) {
+ break;
+ }
+ callback();
+ }
+ }).daemon();
+}
+setInterval.docString = "calls given callback every specified interval";
+
+/**
+ * Cancels a timeout set earlier.
+ * @param tid timeout ID returned from setTimeout
+ */
+function clearInterval(tid) {
+ // we just interrupt the timer thread
+ tid.interrupt();
+}
+clearInterval.docString = "interrupt a setInterval timer";
+
+/**
+ * Simple access to thread local storage.
+ *
+ * Script sample:
+ *
+ * __thread.x = 44;
+ * function f() {
+ * __thread.x = 'hello';
+ * print(__thread.x);
+ * }
+ * f.thread(); // prints 'hello'
+ * print(__thread.x); // prints 44 in main thread
+ */
+var __thread = (function () {
+ var map = new Object();
+ return new JSAdapter({
+ __has__: function(name) {
+ return map[name] != undefined;
+ },
+ __get__: function(name) {
+ if (map[name] != undefined) {
+ return map[name].get();
+ } else {
+ return undefined;
+ }
+ },
+ __put__: sync(function(name, value) {
+ if (map[name] == undefined) {
+ var tmp = new java.lang.ThreadLocal();
+ tmp.set(value);
+ map[name] = tmp;
+ } else {
+ map[name].set(value);
+ }
+ }),
+ __delete__: function(name) {
+ if (map[name] != undefined) {
+ map[name].set(null);
+ }
+ }
+ });
+})();
+
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/resources/gui.js b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/gui.js
new file mode 100644
index 0000000..d62b92f
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/gui.js
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * Few user interface utilities.
+ */
+
+if (this.window === undefined) {
+ this.window = null;
+}
+
+/**
+ * Swing invokeLater - invokes given function in AWT event thread
+ */
+Function.prototype.invokeLater = function() {
+ var SwingUtilities = javax.swing.SwingUtilities;
+ var func = this;
+ var args = arguments;
+ SwingUtilities.invokeLater(new java.lang.Runnable() {
+ run: function() {
+ func.apply(func, args);
+ }
+ });
+};
+
+/**
+ * Swing invokeAndWait - invokes given function in AWT event thread
+ * and waits for it's completion
+ */
+Function.prototype.invokeAndWait = function() {
+ var SwingUtilities = javax.swing.SwingUtilities;
+ var func = this;
+ var args = arguments;
+ SwingUtilities.invokeAndWait(new java.lang.Runnable() {
+ run: function() {
+ func.apply(func, args);
+ }
+ });
+};
+
+/**
+ * Am I running in AWT event dispatcher thread?
+ */
+function isEventThread() {
+ var SwingUtilities = javax.swing.SwingUtilities;
+ return SwingUtilities.isEventDispatchThread();
+}
+isEventThread.docString = "returns whether the current thread is GUI thread";
+
+/**
+ * Opens a file dialog box
+ *
+ * @param curDir current directory [optional]
+ * @param save flag tells whether this is a save dialog or not
+ * @return selected file or else null
+ */
+function fileDialog(curDir, save) {
+ var result;
+ function _fileDialog() {
+ if (curDir == undefined) {
+ curDir = new java.io.File(".");
+ }
+
+ var JFileChooser = javax.swing.JFileChooser;
+ var dialog = new JFileChooser(curDir);
+ var res = save ? dialog.showSaveDialog(window):
+ dialog.showOpenDialog(window);
+
+ if (res == JFileChooser.APPROVE_OPTION) {
+ result = dialog.getSelectedFile();
+ } else {
+ result = null;
+ }
+ }
+
+ if (isEventThread()) {
+ _fileDialog();
+ } else {
+ _fileDialog.invokeAndWait();
+ }
+
+ return result;
+}
+fileDialog.docString = "show a file dialog box";
+
+/**
+ * Opens a color chooser dialog box
+ *
+ * @param title of the dialog box [optional]
+ * @param color default color [optional]
+ * @return chosen color or default color
+ */
+function colorDialog(title, color) {
+ var result;
+
+ function _colorDialog() {
+ if (title == undefined) {
+ title = "Choose Color";
+ }
+
+ if (color == undefined) {
+ color = java.awt.Color.BLACK;
+ }
+
+ var chooser = new javax.swing.JColorChooser();
+ var res = chooser.showDialog(window, title, color);
+ result = res ? res : color;
+ }
+
+ if (isEventThread()) {
+ _colorDialog();
+ } else {
+ _colorDialog.invokeAndWait();
+ }
+
+ return result;
+}
+colorDialog.docString = "shows a color chooser dialog box";
+
+/**
+ * Shows a message box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ * @param msgType type of message box [constants in JOptionPane]
+ */
+function msgBox(msg, title, msgType) {
+ function _msgBox() {
+ var JOptionPane = javax.swing.JOptionPane;
+ if (msg === undefined) msg = "undefined";
+ if (msg === null) msg = "null";
+ if (title == undefined) title = msg;
+ if (msgType == undefined) msgType = JOptionPane.INFORMATION_MESSAGE;
+ JOptionPane.showMessageDialog(window, msg, title, msgType);
+ }
+
+ if (isEventThread()) {
+ _msgBox();
+ } else {
+ _msgBox.invokeAndWait();
+ }
+}
+msgBox.docString = "shows MessageBox to the user";
+
+/**
+ * Shows an information alert box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ */
+function alert(msg, title) {
+ var JOptionPane = javax.swing.JOptionPane;
+ msgBox(msg, title, JOptionPane.INFORMATION_MESSAGE);
+}
+alert.docString = "shows an alert message box to the user";
+
+/**
+ * Shows an error alert box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ */
+function error(msg, title) {
+ var JOptionPane = javax.swing.JOptionPane;
+ msgBox(msg, title, JOptionPane.ERROR_MESSAGE);
+}
+error.docString = "shows an error message box to the user";
+
+/**
+ * Shows a warning alert box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ */
+function warn(msg, title) {
+ var JOptionPane = javax.swing.JOptionPane;
+ msgBox(msg, title, JOptionPane.WARNING_MESSAGE);
+}
+warn.docString = "shows a warning message box to the user";
+
+/**
+ * Shows a prompt dialog box
+ *
+ * @param question question to be asked
+ * @param answer default answer suggested [optional]
+ * @return answer given by user
+ */
+function prompt(question, answer) {
+ var result;
+ function _prompt() {
+ var JOptionPane = javax.swing.JOptionPane;
+ if (answer == undefined) answer = "";
+ result = JOptionPane.showInputDialog(window, question, answer);
+ }
+
+ if (isEventThread()) {
+ _prompt();
+ } else {
+ _prompt.invokeAndWait();
+ }
+
+ return result;
+}
+prompt.docString = "shows a prompt box to the user and returns the answer";
+
+/**
+ * Shows a confirmation dialog box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ * @return boolean (yes->true, no->false)
+ */
+function confirm(msg, title) {
+ var result;
+ var JOptionPane = javax.swing.JOptionPane;
+
+ function _confirm() {
+ if (title == undefined) title = msg;
+ var optionType = JOptionPane.YES_NO_OPTION;
+ result = JOptionPane.showConfirmDialog(window, msg, title, optionType);
+ }
+
+ if (isEventThread()) {
+ _confirm();
+ } else {
+ _confirm.invokeAndWait();
+ }
+
+ return result == JOptionPane.YES_OPTION;
+}
+confirm.docString = "shows a confirmation message box to the user";
+
+/**
+ * Exit the process after confirmation from user
+ *
+ * @param exitCode return code to OS [optional]
+ */
+function exit(exitCode) {
+ if (exitCode == undefined) exitCode = 0;
+ if (confirm("Do you really want to exit?")) {
+ java.lang.System.exit(exitCode);
+ }
+}
+exit.docString = "exits jconsole";
+
+// synonym to exit
+var quit = exit;
+
+// if echo function is not defined, define it as synonym
+// for println function
+if (this.echo == undefined) {
+ function echo(str) {
+ println(str);
+ }
+}
+
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/resources/mm.js b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/mm.js
new file mode 100644
index 0000000..07efad2
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/mm.js
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This is a collection of utilities for Monitoring
+ * and management API.
+ *
+ * File dependency:
+ * conc.js -> for concurrency utilities
+ */
+
+// At any time, we maintain atmost one MBeanServer
+// connection. And so, we store the same as a global
+// variable.
+var mmConnection = null;
+
+function jmxConnect(hostport) {
+ if (mmConnection != null) {
+ // close the existing connection
+ try {
+ mmConnection.close();
+ } catch (e) {
+ }
+ }
+
+ var JMXServiceURL = javax.management.remote.JMXServiceURL;
+ var JMXConnectorFactory = javax.management.remote.JMXConnectorFactory;
+
+ var urlPath = "/jndi/rmi://" + hostport + "/jmxrmi";
+ var url = new JMXServiceURL("rmi", "", 0, urlPath);
+ var jmxc = JMXConnectorFactory.connect(url);
+ // note that the "mmConnection" is a global variable!
+ mmConnection = jmxc.getMBeanServerConnection();
+}
+jmxConnect.docString = "connects to the given host, port (specified as name:port)";
+
+function mbeanConnection() {
+ if (mmConnection == null) {
+ throw "Not connected to MBeanServer yet!";
+ }
+
+ return mmConnection;
+}
+mbeanConnection.docString = "returns the current MBeanServer connection";
+
+/**
+ * Returns a platform MXBean proxy for given MXBean name and interface class
+ */
+function newPlatformMXBeanProxy(name, intf) {
+ var factory = java.lang.management.ManagementFactory;
+ return factory.newPlatformMXBeanProxy(mbeanConnection(), name, intf);
+}
+newPlatformMXBeanProxy.docString = "returns a proxy for a platform MXBean";
+
+/**
+ * Wraps a string to ObjectName if needed.
+ */
+function objectName(objName) {
+ var ObjectName = Packages.javax.management.ObjectName;
+ if (objName instanceof ObjectName) {
+ return objName;
+ } else {
+ return new ObjectName(objName);
+ }
+}
+objectName.docString = "creates JMX ObjectName for a given String";
+
+/**
+ * Creates a new (M&M) Attribute object
+ *
+ * @param name name of the attribute
+ * @param value value of the attribute
+ */
+function attribute(name, value) {
+ var Attribute = Packages.javax.management.Attribute;
+ return new Attribute(name, value);
+}
+attribute.docString = "returns a new JMX Attribute using name and value given";
+
+/**
+ * Returns MBeanInfo for given ObjectName. Strings are accepted.
+ */
+function mbeanInfo(objName) {
+ objName = objectName(objName);
+ return mbeanConnection().getMBeanInfo(objName);
+}
+mbeanInfo.docString = "returns MBeanInfo of a given ObjectName";
+
+/**
+ * Returns ObjectInstance for a given ObjectName.
+ */
+function objectInstance(objName) {
+ objName = objectName(objName);
+ return mbeanConnection().objectInstance(objectName);
+}
+objectInstance.docString = "returns ObjectInstance for a given ObjectName";
+
+/**
+ * Queries with given ObjectName and QueryExp.
+ * QueryExp may be null.
+ *
+ * @return set of ObjectNames.
+ */
+function queryNames(objName, query) {
+ objName = objectName(objName);
+ if (query == undefined) query = null;
+ return mbeanConnection().queryNames(objName, query);
+}
+queryNames.docString = "returns QueryNames using given ObjectName and optional query";
+
+/**
+ * Queries with given ObjectName and QueryExp.
+ * QueryExp may be null.
+ *
+ * @return set of ObjectInstances.
+ */
+function queryMBeans(objName, query) {
+ objName = objectName(objName);
+ if (query == undefined) query = null;
+ return mbeanConnection().queryMBeans(objName, query);
+}
+queryMBeans.docString = "return MBeans using given ObjectName and optional query";
+
+// wraps a script array as java.lang.Object[]
+function objectArray(array) {
+ return Java.to(array, "java.lang.Object[]");
+}
+
+// wraps a script (string) array as java.lang.String[]
+function stringArray(array) {
+ return Java.to(array, "java.lang.String[]");
+}
+
+// script array to Java List
+function toAttrList(array) {
+ var AttributeList = Packages.javax.management.AttributeList;
+ if (array instanceof AttributeList) {
+ return array;
+ }
+ var list = new AttributeList(array.length);
+ for (var index = 0; index < array.length; index++) {
+ list.add(array[index]);
+ }
+ return list;
+}
+
+// Java Collection (Iterable) to script array
+function toArray(collection) {
+ if (collection instanceof Array) {
+ return collection;
+ }
+ var itr = collection.iterator();
+ var array = new Array();
+ while (itr.hasNext()) {
+ array[array.length] = itr.next();
+ }
+ return array;
+}
+
+// gets MBean attributes
+function getMBeanAttributes(objName, attributeNames) {
+ objName = objectName(objName);
+ return mbeanConnection().getAttributes(objName,stringArray(attributeNames));
+}
+getMBeanAttributes.docString = "returns specified Attributes of given ObjectName";
+
+// gets MBean attribute
+function getMBeanAttribute(objName, attrName) {
+ objName = objectName(objName);
+ return mbeanConnection().getAttribute(objName, attrName);
+}
+getMBeanAttribute.docString = "returns a single Attribute of given ObjectName";
+
+// sets MBean attributes
+function setMBeanAttributes(objName, attrList) {
+ objName = objectName(objName);
+ attrList = toAttrList(attrList);
+ return mbeanConnection().setAttributes(objName, attrList);
+}
+setMBeanAttributes.docString = "sets specified Attributes of given ObjectName";
+
+// sets MBean attribute
+function setMBeanAttribute(objName, attrName, attrValue) {
+ var Attribute = Packages.javax.management.Attribute;
+ objName = objectName(objName);
+ mbeanConnection().setAttribute(objName, new Attribute(attrName, attrValue));
+}
+setMBeanAttribute.docString = "sets a single Attribute of given ObjectName";
+
+// invokes an operation on given MBean
+function invokeMBean(objName, operation, params, signature) {
+ objName = objectName(objName);
+ params = objectArray(params);
+ signature = stringArray(signature);
+ return mbeanConnection().invoke(objName, operation, params, signature);
+}
+invokeMBean.docString = "invokes MBean operation on given ObjectName";
+
+/**
+ * Wraps a MBean specified by ObjectName as a convenient
+ * script object -- so that setting/getting MBean attributes
+ * and invoking MBean method can be done with natural syntax.
+ *
+ * @param objName ObjectName of the MBean
+ * @param async asynchornous mode [optional, default is false]
+ * @return script wrapper for MBean
+ *
+ * With async mode, all field, operation access is async. Results
+ * will be of type FutureTask. When you need value, call 'get' on it.
+ */
+function mbean(objName, async) {
+ var index;
+ objName = objectName(objName);
+ var info = mbeanInfo(objName);
+ var attrs = info.attributes;
+ var attrMap = new Object;
+ for (index in attrs) {
+ attrMap[attrs[index].name] = attrs[index];
+ }
+ var opers = info.operations;
+ var operMap = new Object;
+ for (index in opers) {
+ operMap[opers[index].name] = opers[index];
+ }
+
+ function isAttribute(name) {
+ return name in attrMap;
+ }
+
+ function isOperation(name) {
+ return name in operMap;
+ }
+
+ return new JSAdapter() {
+ __has__: function (name) {
+ return isAttribute(name) || isOperation(name);
+ },
+ __get__: function (name) {
+ if (isAttribute(name)) {
+ if (async) {
+ return getMBeanAttribute.future(objName, name);
+ } else {
+ return getMBeanAttribute(objName, name);
+ }
+ } else {
+ return undefined;
+ }
+ },
+ __call__: function(name) {
+ if (isOperation(name)) {
+ var oper = operMap[name];
+
+ var params = [];
+ for (var j = 1; j < arguments.length; j++) {
+ params[j-1]= arguments[j];
+ }
+
+ var sigs = oper.signature;
+
+ var sigNames = new Array(sigs.length);
+ for (var index in sigs) {
+ sigNames[index] = sigs[index].getType();
+ }
+
+ if (async) {
+ return invokeMBean.future(objName, name, params, sigNames);
+ } else {
+ return invokeMBean(objName, name, params, sigNames);
+ }
+ } else {
+ return undefined;
+ }
+ },
+ __put__: function (name, value) {
+ if (isAttribute(name)) {
+ if (async) {
+ setMBeanAttribute.future(objName, name, value);
+ } else {
+ setMBeanAttribute(objName, name, value);
+ }
+ } else {
+ return undefined;
+ }
+ }
+ };
+}
+mbean.docString = "returns a conveninent script wrapper for a MBean of given ObjectName";
+
+if (this.application != undefined) {
+ this.application.addTool("JMX Connect",
+ // connect to a JMX MBean Server
+ function () {
+ var url = prompt("Connect to JMX server (host:port)");
+ if (url != null) {
+ try {
+ jmxConnect(url);
+ alert("connected!");
+ } catch (e) {
+ error(e, "Can not connect to " + url);
+ }
+ }
+ });
+}
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/resources/scriptpad.js b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/scriptpad.js
new file mode 100644
index 0000000..807d05e
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/resources/scriptpad.js
@@ -0,0 +1,662 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script creates a simple Notepad-like interface, which
+ * serves as a simple script editor, runner.
+ *
+ * File dependency:
+ *
+ * gui.js -> for basic GUI functions
+ */
+
+/*
+ * globalThis is used for actionHelpGlobals() and showFrame().
+ */
+var globalThis = this;
+
+/*
+ * JavaImporter helps in avoiding pollution of JavaScript
+ * global namespace. We can import multiple Java packages
+ * with this and use the JavaImporter object with "with"
+ * statement.
+ */
+var guiPkgs = new JavaImporter(java.awt, java.awt.event,
+ javax.swing, javax.swing.undo,
+ javax.swing.event, javax.swing.text);
+
+// main entry point of the scriptpad application
+var main = function() {
+ function createEditor() {
+ var c = new guiPkgs.JTextArea();
+ c.setDragEnabled(true);
+ c.setFont(new guiPkgs.Font("monospaced", guiPkgs.Font.PLAIN, 12));
+ return c;
+ }
+
+ /*const*/ var titleSuffix = "- Scriptpad";
+ /*const*/ var defaultTitle = "Untitled" + titleSuffix;
+
+ // Scriptpad's main frame
+ var frame;
+ // Scriptpad's main editor
+ var editor;
+
+ // To track the current file name
+ var curFileName = null;
+
+ // To track whether the current document
+ // has been modified or not
+ var docChanged = false;
+
+ // check and alert user for unsaved
+ // but modified document
+ function checkDocChanged() {
+ if (docChanged) {
+ // ignore zero-content untitled document
+ if (curFileName == null &&
+ editor.document.length == 0) {
+ return;
+ }
+
+ if (confirm("Do you want to save the changes?",
+ "The document has changed")) {
+ actionSave();
+ }
+ }
+ }
+
+ // set a document listener to track
+ // whether that is modified or not
+ function setDocListener() {
+ var doc = editor.getDocument();
+ docChanged = false;
+ doc.addDocumentListener( new guiPkgs.DocumentListener() {
+ equals: function(o) {
+ return this === o; },
+ toString: function() {
+ return "doc listener"; },
+ changeUpdate: function() {
+ docChanged = true; },
+ insertUpdate: function() {
+ docChanged = true; },
+ removeUpdate: function() {
+ docChanged = true; }
+ });
+ }
+
+ // menu action functions
+
+ // "File" menu
+
+ // create a "new" document
+ function actionNew() {
+ checkDocChanged();
+ curFileName = null;
+ editor.setDocument(new guiPkgs.PlainDocument());
+ setDocListener();
+ frame.setTitle(defaultTitle);
+ editor.revalidate();
+ }
+
+ // open an existing file
+ function actionOpen() {
+ checkDocChanged();
+ var f = fileDialog();
+ if (f == null) {
+ return;
+ }
+
+ if (f.isFile() && f.canRead()) {
+ frame.setTitle(f.getName() + titleSuffix);
+ editor.setDocument(new guiPkgs.PlainDocument());
+ var progress = new guiPkgs.JProgressBar();
+ progress.setMinimum(0);
+ progress.setMaximum(f.length());
+ var doc = editor.getDocument();
+ var inp = new java.io.FileReader(f);
+ var buff = java.lang.reflect.Array.newInstance(
+ java.lang.Character.TYPE, 4096);
+ var nch;
+ while ((nch = inp.read(buff, 0, buff.length)) != -1) {
+ doc.insertString(doc.getLength(),
+ new java.lang.String(buff, 0, nch), null);
+ progress.setValue(progress.getValue() + nch);
+ }
+ inp.close();
+ curFileName = f.getAbsolutePath();
+ setDocListener();
+ } else {
+ error("Can not open file: " + f,
+ "Error opening file: " + f);
+ }
+ }
+
+ // open script from a URL
+ function actionOpenURL() {
+ checkDocChanged();
+ var url = prompt("Address:");
+ if (url == null) {
+ return;
+ }
+
+ try {
+ var u = new java.net.URL(url);
+ editor.setDocument(new guiPkgs.PlainDocument());
+ frame.setTitle(url + titleSuffix);
+ var progress = new guiPkgs.JProgressBar();
+ progress.setMinimum(0);
+ progress.setIndeterminate(true);
+ var doc = editor.getDocument();
+ var inp = new java.io.InputStreamReader(u.openStream());
+ var buff = java.lang.reflect.Array.newInstance(
+ java.lang.Character.TYPE, 4096);
+ var nch;
+ while ((nch = inp.read(buff, 0, buff.length)) != -1) {
+ doc.insertString(doc.getLength(),
+ new java.lang.String(buff, 0, nch), null);
+ progress.setValue(progress.getValue() + nch);
+ }
+ curFileName = null;
+ setDocListener();
+ } catch (e) {
+ error("Error opening URL: " + e,
+ "Can not open URL: " + url);
+ }
+ }
+
+ // factored out "save" function used by
+ // save, save as menu actions
+ function save(file) {
+ var doc = editor.getDocument();
+ frame.setTitle(file.getName() + titleSuffix);
+ curFileName = file;
+ var progress = new guiPkgs.JProgressBar();
+ progress.setMinimum(0);
+ progress.setMaximum(file.length());
+ var out = new java.io.FileWriter(file);
+ var text = new guiPkgs.Segment();
+ text.setPartialReturn(true);
+ var charsLeft = doc.getLength();
+ var offset = 0;
+ var min;
+
+ while (charsLeft > 0) {
+ doc.getText(offset, Math.min(4096, charsLeft), text);
+ out.write(text.array, text.offset, text.count);
+ charsLeft -= text.count;
+ offset += text.count;
+ progress.setValue(offset);
+ java.lang.Thread.sleep(10);
+ }
+
+ out.flush();
+ out.close();
+ docChanged = false;
+ }
+
+ // file-save as menu
+ function actionSaveAs() {
+ var ret = fileDialog(null, true);
+ if (ret == null) {
+ return;
+ }
+ save(ret);
+ }
+
+ // file-save menu
+ function actionSave() {
+ if (curFileName) {
+ save(new java.io.File(curFileName));
+ } else {
+ actionSaveAs();
+ }
+ }
+
+ // exit from scriptpad
+ function actionExit() {
+ checkDocChanged();
+ java.lang.System.exit(0);
+ }
+
+ // "Edit" menu
+
+ // cut the currently selected text
+ function actionCut() {
+ editor.cut();
+ }
+
+ // copy the currently selected text to clipboard
+ function actionCopy() {
+ editor.copy();
+ }
+
+ // paste clipboard content to document
+ function actionPaste() {
+ editor.paste();
+ }
+
+ // select all the text in editor
+ function actionSelectAll() {
+ editor.selectAll();
+ }
+
+ // "Tools" menu
+
+ // run the current document as JavaScript
+ function actionRun() {
+ var doc = editor.getDocument();
+ var script = doc.getText(0, doc.getLength());
+ var oldFile = engine.get(javax.script.ScriptEngine.FILENAME);
+ try {
+ if (engine == undefined) {
+ var m = new javax.script.ScriptEngineManager();
+ engine = m.getEngineByName("nashorn");
+ }
+ engine.put(javax.script.ScriptEngine.FILENAME, frame.title);
+ engine.eval(script, context);
+ } catch (e) {
+ error(e, "Script Error");
+ e.printStackTrace();
+ } finally {
+ engine.put(javax.script.ScriptEngine.FILENAME, oldFile);
+ }
+ }
+
+ // "Examples" menu
+
+ // show given script as new document
+ function showScript(title, str) {
+ actionNew();
+ frame.setTitle("Example - " + title + titleSuffix);
+ var doc = editor.document;
+ doc.insertString(0, str, null);
+ }
+
+ // "hello world"
+ function actionHello() {
+ showScript(actionEval.title,
+ "alert('Hello, world');");
+ }
+ actionHello.title = "Hello, World";
+
+ // eval the "hello world"!
+ function actionEval() {
+ showScript(actionEval.title,
+ "eval(\"alert('Hello, world')\");");
+ }
+ actionEval.title = "Eval";
+
+ // show how to access Java static methods
+ function actionJavaStatic() {
+ showScript(arguments.callee.title,
+ "// Just use Java syntax\n" +
+ "var props = java.lang.System.getProperties();\n" +
+ "alert(props.get('os.name'));");
+ }
+ actionJavaStatic.title = "Java Static Calls";
+
+ // show how to access Java classes, methods
+ function actionJavaAccess() {
+ showScript(arguments.callee.title,
+ "// just use new JavaClass();\n" +
+ "var fr = new javax.swing.JFrame();\n" +
+ "// call all public methods as in Java\n" +
+ "fr.setTitle('hello');\n" +
+ "fr.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\n" +
+ "fr.setSize(200, 200);\n" +
+ "fr.setVisible(true);");
+ }
+ actionJavaAccess.title = "Java Object Access";
+
+ // show how to use Java bean conventions
+ function actionJavaBean() {
+ showScript(arguments.callee.title,
+ "var fr = new javax.swing.JFrame();\n" +
+ "fr.setSize(200, 200);\n" +
+ "// access public get/set methods as fields\n" +
+ "fr.defaultCloseOperation = javax.swing.WindowConstants.DISPOSE_ON_CLOSE;\n" +
+ "fr.title = 'hello';\n" +
+ "fr.visible = true;");
+ }
+ actionJavaBean.title = "Java Beans";
+
+ // show how to implement Java interface
+ function actionJavaInterface() {
+ showScript(arguments.callee.title,
+ "// use Java anonymizer class-like syntax!\n" +
+ "var r = new java.lang.Runnable() {\n" +
+ " run: function() {\n" +
+ " alert('hello');\n" +
+ " }\n" +
+ " };\n" +
+ "// use the above Runnable to create a Thread\n" +
+ "new java.lang.Thread(r).start();\n" +
+ "// For simple one method interfaces, just pass script function\n" +
+ "new java.lang.Thread(function() { alert('world'); }).start();");
+ }
+ actionJavaInterface.title = "Java Interfaces";
+
+ // show how to import Java classes, packages
+ function actionJavaImport() {
+ showScript(arguments.callee.title,
+ "// use Java-like import *...\n" +
+ "// importPackage(java.io);\n" +
+ "// or import a specific class\n" +
+ "// importClass(java.io.File);\n" +
+ "// or better - import just within a scope!\n" +
+ "var ioPkgs = JavaImporter(java.io);\n" +
+ "with (ioPkgs) { alert(new File('.').absolutePath); }");
+ }
+ actionJavaImport.title = "Java Import";
+
+ // "Help" menu
+
+ /*
+ * Shows a one liner help message for each
+ * global function. Note that this function
+ * depends on docString meta-data for each
+ * function.
+ */
+ function actionHelpGlobals() {
+ var names = new java.util.ArrayList();
+ for (var i in globalThis) {
+ var func = globalThis[i];
+ if (typeof(func) == "function" &&
+ ("docString" in func)) {
+ names.add(i);
+ }
+ }
+ java.util.Collections.sort(names);
+ var helpDoc = new java.lang.StringBuffer();
+ helpDoc.append("<table border='1'>");
+ var itr = names.iterator();
+ while (itr.hasNext()) {
+ var name = itr.next();
+ helpDoc.append("<tr><td>");
+ helpDoc.append(name);
+ helpDoc.append("</td><td>");
+ helpDoc.append(globalThis[name].docString);
+ helpDoc.append("</td></tr>");
+ }
+ helpDoc.append("</table>");
+
+ var helpEditor = new guiPkgs.JEditorPane();
+ helpEditor.setContentType("text/html");
+ helpEditor.setEditable(false);
+ helpEditor.setText(helpDoc.toString());
+
+ var scroller = new guiPkgs.JScrollPane();
+ var port = scroller.getViewport();
+ port.add(helpEditor);
+
+ var helpFrame = new guiPkgs.JFrame("Help - Global Functions");
+ helpFrame.getContentPane().add("Center", scroller);
+ helpFrame.setDefaultCloseOperation(guiPkgs.WindowConstants.DISPOSE_ON_CLOSE);
+ helpFrame.pack();
+ helpFrame.setSize(500, 600);
+ helpFrame.setVisible(true);
+ }
+
+ // show a simple about message for scriptpad
+ function actionAbout() {
+ alert("Scriptpad\nVersion 1.1", "Scriptpad");
+ }
+
+ /*
+ * This data is used to construct menu bar.
+ * This way adding a menu is easier. Just add
+ * top level menu or add an item to an existing
+ * menu. "action" should be a function that is
+ * called back on clicking the correponding menu.
+ */
+ var menuData = [
+ {
+ menu: "File",
+ items: [
+ { name: "New", action: actionNew , accel: guiPkgs.KeyEvent.VK_N },
+ { name: "Open...", action: actionOpen, accel: guiPkgs.KeyEvent.VK_O },
+ { name: "Open URL...", action: actionOpenURL, accel: guiPkgs.KeyEvent.VK_U },
+ { name: "Save", action: actionSave, accel: guiPkgs.KeyEvent.VK_S },
+ { name: "Save As...", action: actionSaveAs },
+ { name: "-" },
+ { name: "Exit", action: actionExit, accel: guiPkgs.KeyEvent.VK_Q }
+ ]
+ },
+
+ {
+ menu: "Edit",
+ items: [
+ { name: "Cut", action: actionCut, accel: guiPkgs.KeyEvent.VK_X },
+ { name: "Copy", action: actionCopy, accel: guiPkgs.KeyEvent.VK_C },
+ { name: "Paste", action: actionPaste, accel: guiPkgs.KeyEvent.VK_V },
+ { name: "-" },
+ { name: "Select All", action: actionSelectAll, accel: guiPkgs.KeyEvent.VK_A }
+ ]
+ },
+
+ {
+ menu: "Tools",
+ items: [
+ { name: "Run", action: actionRun, accel: guiPkgs.KeyEvent.VK_R }
+ ]
+ },
+
+ {
+ menu: "Examples",
+ items: [
+ { name: actionHello.title, action: actionHello },
+ { name: actionEval.title, action: actionEval },
+ { name: actionJavaStatic.title, action: actionJavaStatic },
+ { name: actionJavaAccess.title, action: actionJavaAccess },
+ { name: actionJavaBean.title, action: actionJavaBean },
+ { name: actionJavaInterface.title, action: actionJavaInterface },
+ { name: actionJavaImport.title, action: actionJavaImport }
+ ]
+ },
+
+ {
+ menu: "Help",
+ items: [
+ { name: "Global Functions", action: actionHelpGlobals },
+ { name: "-" },
+ { name: "About Scriptpad", action: actionAbout }
+ ]
+ }
+ ];
+
+ function setMenuAccelerator(mi, accel) {
+ var keyStroke = guiPkgs.KeyStroke.getKeyStroke(accel,
+ guiPkgs.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ mi.setAccelerator(keyStroke);
+ }
+
+ // create a menubar using the above menu data
+ function createMenubar() {
+ var mb = new guiPkgs.JMenuBar();
+ for (var m in menuData) {
+ var items = menuData[m].items;
+ var menu = new guiPkgs.JMenu(menuData[m].menu);
+
+ for (var i in items) {
+ if (items[i].name.equals("-")) {
+ menu.addSeparator();
+ } else {
+ var mi = new guiPkgs.JMenuItem(items[i].name);
+ var action = items[i].action;
+ mi.addActionListener(action);
+ var accel = items[i].accel;
+ if (accel) {
+ setMenuAccelerator(mi, accel);
+ }
+ menu.add(mi);
+ }
+ }
+
+ mb.add(menu);
+ }
+
+ return mb;
+ }
+
+ // function to add a new menu item under "Tools" menu
+ function addTool(menuItem, action, accel) {
+ if (typeof(action) != "function") {
+ return;
+ }
+
+ var toolsIndex = -1;
+ // find the index of the "Tools" menu
+ for (var i in menuData) {
+ if (menuData[i].menu.equals("Tools")) {
+ toolsIndex = i;
+ break;
+ }
+ }
+ if (toolsIndex == -1) {
+ return;
+ }
+ var toolsMenu = frame.getJMenuBar().getMenu(toolsIndex);
+ var mi = new guiPkgs.JMenuItem(menuItem);
+ mi.addActionListener(action);
+ if (accel) {
+ setMenuAccelerator(mi, accel);
+ }
+ toolsMenu.add(mi);
+ }
+
+ // create Scriptpad frame
+ function createFrame() {
+ frame = new guiPkgs.JFrame();
+ frame.setTitle(defaultTitle);
+ frame.setBackground(guiPkgs.Color.lightGray);
+ frame.getContentPane().setLayout(new guiPkgs.BorderLayout());
+
+ // create notepad panel
+ var notepad = new guiPkgs.JPanel();
+ notepad.setBorder(guiPkgs.BorderFactory.createEtchedBorder());
+ notepad.setLayout(new guiPkgs.BorderLayout());
+
+ // create editor
+ editor = createEditor();
+ var scroller = new guiPkgs.JScrollPane();
+ var port = scroller.getViewport();
+ port.add(editor);
+
+ // add editor to notepad panel
+ var panel = new guiPkgs.JPanel();
+ panel.setLayout(new guiPkgs.BorderLayout());
+ panel.add("Center", scroller);
+ notepad.add("Center", panel);
+
+ // add notepad panel to frame
+ frame.getContentPane().add("Center", notepad);
+
+ // set menu bar to frame and show the frame
+ frame.setJMenuBar(createMenubar());
+ frame.setDefaultCloseOperation(guiPkgs.JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setSize(500, 600);
+ }
+
+ // show Scriptpad frame
+ function showFrame() {
+ // set global variable by the name "window"
+ globalThis.window = frame;
+
+ // open new document
+ actionNew();
+
+ frame.setVisible(true);
+ }
+
+ // create and show Scriptpad frame
+ createFrame();
+ showFrame();
+
+ /*
+ * Application object has two fields "frame", "editor"
+ * which are current JFrame and editor and a method
+ * called "addTool" to add new menu item to "Tools" menu.
+ */
+ return {
+ frame: frame,
+ editor: editor,
+ addTool: addTool
+ };
+};
+
+/*
+ * Call the main and store Application object
+ * in a global variable named "application".
+ */
+var application = main();
+
+if (this.load == undefined) {
+ function load(file) {
+ var ioPkgs = new JavaImporter(java.io);
+ with (ioPkgs) {
+ var stream = new FileInputStream(file);
+ var bstream = new BufferedInputStream(stream);
+ var reader = new BufferedReader(new InputStreamReader(bstream));
+ var oldFilename = engine.get(engine.FILENAME);
+ engine.put(engine.FILENAME, file);
+ try {
+ engine.eval(reader, context);
+ } finally {
+ engine.put(engine.FILENAME, oldFilename);
+ }
+ stream.close();
+ }
+ }
+ load.docString = "loads the given script file";
+}
+
+/*
+ * Load user specific init file under home dir, if found.
+ */
+function loadUserInit() {
+ var home = java.lang.System.getProperty("user.home");
+ var f = new java.io.File(home, "scriptpad.js");
+ if (f.exists()) {
+ engine.eval(new java.io.FileReader(f));
+ }
+}
+
+loadUserInit();
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/README.txt b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/README.txt
new file mode 100644
index 0000000..72e162d
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/README.txt
@@ -0,0 +1,52 @@
+Sample scripts:
+
+(1) browse.js
+
+ -- Open and run this script in scriptpad. You will see
+ Tools->Browse menu. Using this you can start your
+ desktop default browser with the given URL.
+
+(2) insertfile.js
+
+ -- Open and run this script in scriptpad. You will see
+ "Tools->Insert File..." menu. Using this you can start
+ insert content of a selected file into currently
+ edited document
+
+(3) linewrap.js
+
+ -- Open and run this script in scriptpad. You will see
+ "Tools->Line Wrap" menu. Using this you can toggle
+ the line wrapping mode of the editor
+
+(4) mail.js
+
+ -- Open and run this script in scriptpad. You will see
+ Tools->Mail menu. Using this you can start your
+ desktop default mail client with the given "To" mail id.
+
+(5) memmonitor.js
+
+ -- This is a simple Monitoring & Management script. To use this,
+ you need an application to monitor. You can use memory.bat
+ or memory.sh in the current directory to start an application
+ that will be monitored. After that please follow these steps:
+
+ 1. Start the target application using memory.sh or memory.bat
+ 2. Start scriptpad
+ 3. Use "Tools->JMX Connect" menu and specify "localhost:1090"
+ to connect
+ 4. Open "memmonitor.js" and run it (using "Tools->Run")
+ in scriptpad
+ 5. A new "Tools-Memory Monitor" menu appears. Use this menu
+ and specify 4 and 500 as threshold and interval values.
+ 6. In the target application shell (where memory.bat/.sh was
+ started), enter an integer value and press "enter".
+ 7. You'll see an alert box from scriptpad -- alerting you for
+ memory threshold exceeded!
+
+(6) textcolor.js
+
+ -- Open and run this script in scriptpad. You will see
+ "Tools->Selected Text Color..." menu. Using this you
+ change the color of "selected text" in the editor.
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/browse.js b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/browse.js
new file mode 100644
index 0000000..fbe50e1
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/browse.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This function uses new Swing Desktop API in JDK 6.
+ * To use this with scriptpad, open this in scriptpad
+ * and use "Tools->Run Script" menu.
+ */
+function browse() {
+ var desktop = null;
+ // Before more Desktop API is used, first check
+ // whether the API is supported by this particular
+ // virtual machine (VM) on this particular host.
+ if (java.awt.Desktop.isDesktopSupported()) {
+ desktop = java.awt.Desktop.getDesktop();
+ } else {
+ alert("no desktop support");
+ return;
+ }
+
+ if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
+ var url = prompt("Address:");
+ if (url != null) {
+ desktop.browse(new java.net.URI(url));
+ }
+ } else {
+ alert("no browser support");
+ }
+}
+
+if (this.application != undefined) {
+ // add "Browse" menu item under "Tools" menu
+ this.application.addTool("Browse", browse);
+}
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/insertfile.js b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/insertfile.js
new file mode 100644
index 0000000..07a7ac2
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/insertfile.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script adds "Insert File" mode menu item to "Tools" menu.
+ * When selected, this menu shows a file dialog box and inserts
+ * contents of the selected file into current document (at the
+ * current caret position).
+ */
+if (this.application) {
+ application.addTool("Insert File...",
+ function() {
+ var file = fileDialog();
+
+ if (file) {
+ var reader = new java.io.FileReader(file);
+ var arr = java.lang.reflect.Array.newInstance(
+ java.lang.Character.TYPE, 8*1024); // 8K at a time
+ var buf = new java.lang.StringBuffer();
+ var numChars;
+
+ while ((numChars = reader.read(arr, 0, arr.length)) > 0) {
+ buf.append(arr, 0, numChars);
+ }
+
+ var pos = application.editor.caretPosition;
+ var doc = application.editor.document;
+
+ doc.insertString(pos, buf.toString(), null);
+ }
+ });
+}
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/linewrap.js b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/linewrap.js
new file mode 100644
index 0000000..989473a
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/linewrap.js
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script adds "Line Wrap" mode menu item to "Tools" menu.
+ * When selected, this menu toggles the current word wrap mode
+ * of the editor.
+ */
+
+function toggleLineWrap() {
+ var wrap = application.editor.lineWrap;
+ application.editor.lineWrap = !wrap;
+}
+
+application.addTool("Line Wrap", toggleLineWrap);
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/mail.js b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/mail.js
new file mode 100644
index 0000000..cabe5c4
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/mail.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This function uses new Swing Desktop API in JDK 6.
+ * To use this with scriptpad, open this in scriptpad
+ * and use "Tools->Run Script" menu.
+ */
+function mail() {
+ var desktop = null;
+ // Before more Desktop API is used, first check
+ // whether the API is supported by this particular
+ // virtual machine (VM) on this particular host.
+ if (java.awt.Desktop.isDesktopSupported()) {
+ desktop = java.awt.Desktop.getDesktop();
+ } else {
+ alert("no desktop support");
+ return;
+ }
+
+ if (desktop.isSupported(java.awt.Desktop.Action.MAIL)) {
+ var mailTo = prompt("Mail To:");
+ if (mailTo != null) {
+ desktop.mail(new java.net.URI("mailto", mailTo, null));
+ }
+ }
+}
+
+if (this.application != undefined) {
+ // add "Mail" menu item under "Tools" menu
+ this.application.addTool("Mail", mail);
+}
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js
new file mode 100644
index 0000000..0744e30
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+// this checker function runs asynchronously
+function memoryChecker(memoryBean, threshold, interval) {
+ while (true) {
+ var memUsage = memoryBean.HeapMemoryUsage;
+ var usage = memUsage.get("used") / (1024 * 1024);
+
+ println("usage: " + usage);
+
+ if (usage > threshold) {
+ alert("Hey! heap usage threshold exceeded!");
+ // after first alert just return.
+ return;
+ }
+
+ java.lang.Thread.sleep(interval);
+ }
+}
+
+// add "Tools->Memory Monitor" menu item
+if (this.application != undefined) {
+ this.application.addTool("Memory Monitor",
+ function () {
+ // show threshold box with default of 50 MB
+ var threshold = prompt("Threshold (mb)", 50);
+
+ // show interval box with default of 1000 millisec.
+ var interval = prompt("Sample Interval (ms):", 1000);
+ var memoryBean = mbean("java.lang:type=Memory");
+
+ // ".future" makes the function to be called
+ // asynchronously in a separate thread.
+ memoryChecker.future(memoryBean, threshold, interval);
+ });
+}
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.bat b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.bat
new file mode 100644
index 0000000..9478c09
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.bat
@@ -0,0 +1,35 @@
+@echo off
+REM
+REM Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+REM
+REM Redistribution and use in source and binary forms, with or without
+REM modification, are permitted provided that the following conditions
+REM are met:
+REM
+REM - Redistributions of source code must retain the above copyright
+REM notice, this list of conditions and the following disclaimer.
+REM
+REM - Redistributions in binary form must reproduce the above copyright
+REM notice, this list of conditions and the following disclaimer in the
+REM documentation and/or other materials provided with the distribution.
+REM
+REM - Neither the name of Oracle nor the names of its
+REM contributors may be used to endorse or promote products derived
+REM from this software without specific prior written permission.
+REM
+REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+REM IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+REM THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+REM PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+REM CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+REM EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+REM PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+REM PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+REM LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+REM NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+REM SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+REM
+
+
+jrunscript -J-Dcom.sun.management.jmxremote.port=1090 -J-Dcom.sun.management.jmxremote.ssl=false -J-Dcom.sun.management.jmxremote.authenticate=false memory.js
+
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.js b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.js
new file mode 100644
index 0000000..b8252fb
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script serves as a simple "monitored application".
+ * Start this script using memory.bat or memory.sh in the
+ * current directory.
+ */
+
+java.lang.System.out.print("Enter a number and press enter:");
+var input = java.lang.System["in"].read();
+
+// allocate an integer array of "big enough" size!
+var a = java.lang.reflect.Array.newInstance(
+ java.lang.Integer.TYPE, input * 1024 * 1024);
+
+// sleep some time...
+java.lang.Thread.sleep(10*60*1000);
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.sh b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.sh
new file mode 100644
index 0000000..8da155b
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/memory.sh
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - 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.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS 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.
+#
+
+jrunscript -J-Dcom.sun.management.jmxremote.port=1090 -J-Dcom.sun.management.jmxremote.ssl=false -J-Dcom.sun.management.jmxremote.authenticate=false memory.js
diff --git a/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/textcolor.js b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/textcolor.js
new file mode 100644
index 0000000..b9d86cc
--- /dev/null
+++ b/staging/darwin-x86/sample/scripting/scriptpad/src/scripts/textcolor.js
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script adds "Selected Text Color" menu item to "Tools" menu.
+ * When selected, this menu changes the "selected text" color.
+ */
+if (this.application) {
+ application.addTool("Selected Text Color...",
+ function() {
+ var color = application.editor.selectedTextColor;
+ color = colorDialog("Selected Text Color", color);
+ application.editor.selectedTextColor = color;
+ });
+}
diff --git a/staging/darwin-x86/sample/try-with-resources/index.html b/staging/darwin-x86/sample/try-with-resources/index.html
new file mode 100644
index 0000000..ff237d8
--- /dev/null
+++ b/staging/darwin-x86/sample/try-with-resources/index.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>Try-with-Resources Feature Demo</title>
+</head>
+<body>
+<h2>Try-with-Resources Feature Demo</h2>
+
+<p>
+ This demo shows how to use the try-with-resources feature introduced in JDK7.
+</p>
+
+<ul>
+ <li><h3>Custom AutoCloseable.</h3>
+
+ <p>
+ Shows how to use a custom resource with the try-with-resources construct.
+ For more information, see the source file.
+ </p>
+ Source: <a href="src/CustomAutoCloseableSample.java">src/CustomAutoCloseableSample.java</a>
+
+ <li><h3>Unzip</h3>
+
+ <p>
+ Extracts archived files. For more information, see the source file.
+ </p>
+ Source: <a href="src/Unzip.java">src/Unzip.java</a>
+ <li><h3>ZipCat</h3>
+
+ <p>Prints data about a specified file from an archive. For more information, see the source file.</p>
+ Source: <a href="src/ZipCat.java">src/ZipCat.java</a>
+
+</ul>
+</body>
+</html> \ No newline at end of file
diff --git a/staging/darwin-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java b/staging/darwin-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java
new file mode 100644
index 0000000..9bbe09a
--- /dev/null
+++ b/staging/darwin-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * This sample demonstrates the ability to create custom resource that
+ * implements the {@code AutoCloseable} interface. This resource can be used in
+ * the try-with-resources construct.
+ */
+public class CustomAutoCloseableSample {
+
+ /**
+ * The main method for the CustomAutoCloseableSample program.
+ *
+ * @param args is not used.
+ */
+ public static void main(String[] args) {
+ /*
+ * TeeStream will be closed automatically after the try block.
+ */
+ try (TeeStream teeStream = new TeeStream(System.out, Paths.get("out.txt"));
+ PrintStream out = new PrintStream(teeStream)) {
+ out.print("Hello, world");
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Passes the output through to the specified output stream while copying it into a file.
+ * The TeeStream functionality is similar to the Unix tee utility.
+ * TeeStream implements AutoCloseable interface. See OutputStream for details.
+ */
+ public static class TeeStream extends OutputStream {
+
+ private final OutputStream fileStream;
+ private final OutputStream outputStream;
+
+ /**
+ * Creates a TeeStream.
+ *
+ * @param outputStream an output stream.
+ * @param outputFile an path to file.
+ * @throws IOException If an I/O error occurs.
+ */
+ public TeeStream(OutputStream outputStream, Path outputFile) throws IOException {
+ this.fileStream = new BufferedOutputStream(Files.newOutputStream(outputFile));
+ this.outputStream = outputStream;
+ }
+
+ /**
+ * Writes the specified byte to the specified output stream
+ * and copies it to the file.
+ *
+ * @param b the byte to be written.
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public void write(int b) throws IOException {
+ fileStream.write(b);
+ outputStream.write(b);
+ }
+
+ /**
+ * Flushes this output stream and forces any buffered output bytes
+ * to be written out.
+ * The <code>flush</code> method of <code>TeeStream</code> flushes
+ * the specified output stream and the file output stream.
+ *
+ * @throws IOException if an I/O error occurs.
+ */
+ @Override
+ public void flush() throws IOException {
+ outputStream.flush();
+ fileStream.flush();
+ }
+
+ /**
+ * Closes underlying streams and resources.
+ * The external output stream won't be closed.
+ * This method is the member of AutoCloseable interface and
+ * it will be invoked automatically after the try-with-resources block.
+ *
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public void close() throws IOException {
+ try (OutputStream file = fileStream) {
+ flush();
+ }
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/try-with-resources/src/Unzip.java b/staging/darwin-x86/sample/try-with-resources/src/Unzip.java
new file mode 100644
index 0000000..d75eba5
--- /dev/null
+++ b/staging/darwin-x86/sample/try-with-resources/src/Unzip.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.*;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+/**
+ * Extract (unzip) a file to the current directory.
+ */
+public class Unzip {
+
+ /**
+ * The main method for the Unzip program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for {@code Unzip}.
+ */
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ System.out.println("Usage: Unzip zipfile");
+ }
+ final Path destDir = Paths.get(".");
+ /*
+ * Create AutoCloseable FileSystem. It will be closed automatically
+ * after the try block.
+ */
+ try (FileSystem zipFileSystem = FileSystems.newFileSystem(Paths.get(args[0]), null)) {
+
+ Path top = zipFileSystem.getPath("/");
+ Files.walk(top).skip(1).forEach(file -> {
+ Path target = destDir.resolve(top.relativize(file).toString());
+ System.out.println("Extracting " + target);
+ try {
+ Files.copy(file, target, REPLACE_EXISTING);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ });
+ } catch (UncheckedIOException | IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/staging/darwin-x86/sample/try-with-resources/src/ZipCat.java b/staging/darwin-x86/sample/try-with-resources/src/ZipCat.java
new file mode 100644
index 0000000..4bbf513
--- /dev/null
+++ b/staging/darwin-x86/sample/try-with-resources/src/ZipCat.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+/**
+ * Prints data of the specified file to standard output from a zip archive.
+ */
+public class ZipCat {
+
+ /**
+ * The main method for the ZipCat program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for ZipCat
+ */
+ public static void main(String[] args) {
+ if (args.length != 2) {
+ System.out.println("Usage: ZipCat zipfile fileToPrint");
+ }
+ /*
+ * Creates AutoCloseable FileSystem and BufferedReader.
+ * They will be closed automatically after the try block.
+ * If reader initialization fails, then zipFileSystem will be closed
+ * automatically.
+ */
+ try (FileSystem zipFileSystem
+ = FileSystems.newFileSystem(Paths.get(args[0]),null);
+ InputStream input
+ = Files.newInputStream(zipFileSystem.getPath(args[1]))) {
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = input.read(buffer)) != -1) {
+ System.out.write(buffer, 0, len);
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/staging/darwin-x86/src.zip b/staging/darwin-x86/src.zip
new file mode 100644
index 0000000..7a42e91
--- /dev/null
+++ b/staging/darwin-x86/src.zip
Binary files differ
diff --git a/staging/linux-x86/ASSEMBLY_EXCEPTION b/staging/linux-x86/ASSEMBLY_EXCEPTION
new file mode 100644
index 0000000..065b8d9
--- /dev/null
+++ b/staging/linux-x86/ASSEMBLY_EXCEPTION
@@ -0,0 +1,27 @@
+
+OPENJDK ASSEMBLY EXCEPTION
+
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+only ("GPL2"), with the following clarification and special exception.
+
+ Linking this OpenJDK Code statically or dynamically with other code
+ is making a combined work based on this library. Thus, the terms
+ and conditions of GPL2 cover the whole combination.
+
+ As a special exception, Oracle gives you permission to link this
+ OpenJDK Code with certain code licensed by Oracle as indicated at
+ http://openjdk.java.net/legal/exception-modules-2007-05-08.html
+ ("Designated Exception Modules") to produce an executable,
+ regardless of the license terms of the Designated Exception Modules,
+ and to copy and distribute the resulting executable under GPL2,
+ provided that the Designated Exception Modules continue to be
+ governed by the licenses under which they were offered by Oracle.
+
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception). If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
diff --git a/staging/linux-x86/LICENSE b/staging/linux-x86/LICENSE
new file mode 100644
index 0000000..8b400c7
--- /dev/null
+++ b/staging/linux-x86/LICENSE
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have. You must
+make sure that they, too, receive or can get the source code. And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+ a) You must cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in whole or
+ in part contains or is derived from the Program or any part thereof, to be
+ licensed as a whole at no charge to all third parties under the terms of
+ this License.
+
+ c) If the modified program normally reads commands interactively when run,
+ you must cause it, when started running for such interactive use in the
+ most ordinary way, to print or display an announcement including an
+ appropriate copyright notice and a notice that there is no warranty (or
+ else, saying that you provide a warranty) and that users may redistribute
+ the program under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the Program is
+ not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable source
+ code, which must be distributed under the terms of Sections 1 and 2 above
+ on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three years, to
+ give any third party, for a charge no more than your cost of physically
+ performing source distribution, a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed only
+ for noncommercial distribution and only if you received the program in
+ object code or executable form with such an offer, in accord with
+ Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not
+accept this License. Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein. You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+ One line to give the program's name and a brief idea of what it does.
+
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program 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 for
+ more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+ with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
+ software, and you are welcome to redistribute it under certain conditions;
+ type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary. Here
+is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ 'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ signature of Ty Coon, 1 April 1989
+
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+ Linking this library statically or dynamically with other modules is making
+ a combined work based on this library. Thus, the terms and conditions of
+ the GNU General Public License cover the whole combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent modules,
+ and to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent module,
+ the terms and conditions of the license of that module. An independent
+ module is a module which is not derived from or based on this library. If
+ you modify this library, you may extend this exception to your version of
+ the library, but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version.
diff --git a/staging/linux-x86/MODULE_LICENSE_GPL b/staging/linux-x86/MODULE_LICENSE_GPL
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/staging/linux-x86/MODULE_LICENSE_GPL
diff --git a/staging/linux-x86/THIRD_PARTY_README b/staging/linux-x86/THIRD_PARTY_README
new file mode 100644
index 0000000..2b20da2
--- /dev/null
+++ b/staging/linux-x86/THIRD_PARTY_README
@@ -0,0 +1,3574 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to ASM Bytecode Manipulation
+Framework v5.0.3, which may be included with JRE 8, and JDK 8, and
+OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2011 France Télécom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+3. 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.
+
+THIS 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.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to BSDiff v4.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 2003-2005 Colin Percival
+All rights reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted providing that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CodeViewer 1.0, which may be
+included with JDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1999 by CoolServlets.com.
+
+Any errors or suggested improvements to this class can be reported as
+instructed on CoolServlets.com. We hope you enjoy this program... your
+comments will encourage further development! This software is distributed
+under the terms of the BSD License. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+Neither name of CoolServlets.com nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY COOLSERVLETS.COM 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 AUTHOR 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."
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Cryptix AES 3.2.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Cryptix General License
+
+Copyright (c) 1995-2005 The Cryptix Foundation Limited.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ 1. Redistributions of source code must retain the copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED 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 CRYPTIX FOUNDATION LIMITED 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CUP Parser Generator for
+Java 0.10k, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both the
+copyright notice and this permission notice and warranty disclaimer appear in
+supporting documentation, and that the names of the authors or their
+employers not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+The authors and their employers disclaim all warranties with regard to
+this software, including all implied warranties of merchantability and fitness.
+In no event shall the authors or their employers be liable for any special,
+indirect or consequential damages or any damages whatsoever resulting from
+loss of use, data or profits, whether in an action of contract, negligence or
+other tortious action, arising out of or in connection with the use or
+performance of this software.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Document Object Model (DOM) Level 2
+& 3, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+W3C SOFTWARE NOTICE AND LICENSE
+
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee)
+agree that you have read, understood, and will comply with the following terms
+and conditions.
+
+Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without fee
+or royalty is hereby granted, provided that you include the following on ALL
+copies of the software and documentation or portions thereof, including
+modifications:
+
+ 1.The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+
+ 2.Any pre-existing intellectual property disclaimers, notices, or terms and
+ conditions. If none exist, the W3C Software Short Notice should be included
+ (hypertext is preferred, text is permitted) within the body of any
+ redistributed or derivative code.
+
+ 3.Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
+THIRD PARTY PATENTS,COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION. The name and trademarks of copyright holders may NOT be used
+in advertising or publicity pertaining to the software without specific,
+written prior permission. Title to copyright in this software and any
+associated documentation will at all times remain with copyright holders.
+
+____________________________________
+
+This formulation of W3C's notice and license became active on December 31
+2002. This version removes the copyright ownership notice such that this
+license can be used with materials other than those owned by the W3C, reflects
+that ERCIM is now a host of the W3C, includes references to this specific
+dated version of the license, and removes the ambiguous grant of "use".
+Otherwise, this version is the same as the previous version and is written so
+as to preserve the Free Software Foundation's assessment of GPL compatibility
+and OSI's certification under the Open Source Definition. Please see our
+Copyright FAQ for common questions about using materials from our site,
+including specific terms and conditions for packages like libwww, Amaya, and
+Jigsaw. Other questions about this notice can be directed to
+site-policy@w3.org.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Dynalink v0.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2009-2013, Attila Szegedi
+
+All rights reserved.Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following conditions are
+met:* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer. * 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. * Neither the name of Attila
+Szegedi nor the names of its contributors may be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+THIS 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 HOLDER 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 THEPOSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Elliptic Curve Cryptography, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+You are receiving a copy of the Elliptic Curve Cryptography library in source
+form with the JDK 8 and OpenJDK 8 source distributions, and as object code in
+the JRE 8 & JDK 8 runtimes.
+
+In the case of the JRE 8 & JDK 8 runtimes, the terms of the Oracle license do
+NOT apply to the Elliptic Curve Cryptography library; it is licensed under the
+following license, separately from Oracle's JDK & JRE. If you do not wish to
+install the Elliptic Curve Cryptography library, you may delete the library
+named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows
+systems) from the JRE bin directory reserved for native libraries.
+
+
+--- begin of LICENSE ---
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ECMAScript Language
+Specification ECMA-262 Edition 5.1 which may be included with
+JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright notice
+Copyright © 2011 Ecma International
+Ecma International
+Rue du Rhone 114
+CH-1204 Geneva
+Tel: +41 22 849 6000
+Fax: +41 22 849 6001
+Web: http://www.ecma-international.org
+
+This document and possible translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it or assist
+in its implementation may be prepared, copied, published, and distributed, in
+whole or in part, without restriction of any kind, provided that the above
+copyright notice and this section are included on all such copies and derivative
+works. However, this document itself may not be modified in any way, including
+by removing the copyright notice or references to Ecma International, except as
+needed for the purpose of developing any document or deliverable produced by
+Ecma International (in which case the rules applied to copyrights must be
+followed) or as required to translate it into languages other than English. The
+limited permissions granted above are perpetual and will not be revoked by Ecma
+International or its successors or assigns. This document and the information
+contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL
+DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
+WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP
+RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE." Software License
+
+All Software contained in this document ("Software)" is protected by copyright
+and is being made available under the "BSD License", included below. This
+Software may be subject to third party rights (rights from parties other than
+Ecma International), including patent rights, and no licenses under such third
+party rights are granted under this license even if the third party concerned is
+a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS
+AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR
+INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO
+IMPLEMENT ECMA INTERNATIONAL STANDARDS*. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. 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.
+
+3. Neither the name of the authors nor Ecma International may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "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 ECMA INTERNATIONAL 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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Dynalink library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Copyright (c) 2009-2013, Attila Szegedi
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* 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.
+* Neither the name of the copyright holder nor the names of
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS 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 COPYRIGHT HOLDER
+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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Joni library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to FontConfig 2.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 source distributions on
+Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright © 2001,2003 Keith Packard
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and that
+the name of Keith Packard not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior permission.
+Keith Packard makes no representations about the suitability of this software
+for any purpose. It is provided "as is" without express or implied warranty.
+
+KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL KEITH
+PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IAIK PKCS#11 Wrapper,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+IAIK PKCS#11 Wrapper License
+
+Copyright (c) 2002 Graz University of Technology. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by IAIK of Graz University of
+ Technology."
+
+ Alternately, this acknowledgment may appear in the software itself, if and
+ wherever such third-party acknowledgments normally appear.
+
+4. The names "Graz University of Technology" and "IAIK of Graz University of
+ Technology" must not be used to endorse or promote products derived from this
+ software without prior written permission.
+
+5. Products derived from this software may not be called "IAIK PKCS Wrapper",
+ nor may "IAIK" appear in their name, without prior written permission of
+ Graz University of Technology.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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
+LICENSOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ICU4C 4.0.1 and ICU4J 4.4, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1995-2010 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+provided that the above copyright notice(s) and this permission notice appear
+in all copies of the Software and that both the above copyright notice(s) and
+this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+All trademarks and registered trademarks mentioned herein are the property of
+their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IJG JPEG 6b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Joni v1.1.9, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to JOpt-Simple v3.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2004-2009 Paul R. Holser, Jr.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality, which
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ (C) Copyright IBM Corp. 1999 All Rights Reserved.
+ Copyright 1997 The Open Group Research Institute. All rights reserved.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality from
+FundsXpress, INC., which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (C) 1998 by the FundsXpress, INC.
+
+ All rights reserved.
+
+ Export of this software from the United States of America may require
+ a specific license from the United States Government. It is the
+ responsibility of any person or organization contemplating export to
+ obtain such a license before exporting.
+
+ WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ distribute this software and its documentation for any purpose and
+ without fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation, and that
+ the name of FundsXpress. not be used in advertising or publicity pertaining
+ to distribution of the software without specific, written prior
+ permission. FundsXpress makes no representations about the suitability of
+ this software for any purpose. It is provided "as is" without express
+ or implied warranty.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kronos OpenGL headers, which may be
+included with JDK 8 and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2007 The Khronos Group Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and/or associated documentation files (the "Materials"), to
+ deal in the Materials without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Materials, and to permit persons to whom the Materials are
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Materials.
+
+ THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE
+ MATERIALS.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions Copyright Eastman Kodak Company 1992
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to libpng 1.6.16, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors
+
+ Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
+Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6
+with the following individuals added to the list of Contributing Authors
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Gilles Vollant
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-0.96,
+with the following individuals added to the list of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996, 1997 Andreas Dilger
+Distributed according to the same disclaimer and license as libpng-0.88,
+with the following individuals added to the list of Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+1. The origin of this source code must not be misrepresented.
+
+2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+
+A "png_get_copyright" function is available, for convenient use in "about"
+boxes and the like:
+
+ printf("%s",png_get_copyright(NULL));
+
+Also, the PNG logo (in PNG format, of course) is supplied in the
+files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
+certification mark of the Open Source Initiative.
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+December 22, 2014
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Little CMS 2.7, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Little CMS
+Copyright (c) 1998-2015 Marti Maria Saguer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Lucida is a registered trademark or trademark of Bigelow & Holmes in the
+U.S. and other countries.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mesa 3D Graphics Library v4.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Mesa 3-D graphics library
+ Version: 4.1
+
+ Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mozilla Network Security
+Services (NSS), which is supplied with the JDK test suite in the OpenJDK
+source code repository. It is licensed under Mozilla Public License (MPL),
+version 2.0.
+
+The NSS libraries are supplied in executable form, built from unmodified
+NSS source code labeled with the "NSS_3_16_RTM" HG tag.
+
+The NSS source code is available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/src
+
+The NSS libraries are available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/lib
+
+--- begin of LICENSE ---
+
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1999-2004 David Corcoran <corcoran@linuxnet.com>
+Copyright (c) 1999-2004 Ludovic Rousseau <ludovic.rousseau (at) free.fr>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. 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.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by:
+ David Corcoran <corcoran@linuxnet.com>
+ http://www.linuxnet.com (MUSCLE)
+4. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+Changes to this license can be made only by the copyright author with
+explicit written consent.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PorterStemmer v4, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+See: http://tartarus.org/~martin/PorterStemmer
+
+The software is completely free for any purpose, unless notes at the head of
+the program text indicates otherwise (which is rare). In any case, the notes
+about licensing are never more restrictive than the BSD License.
+
+In every case where the software is not written by me (Martin Porter), this
+licensing arrangement has been endorsed by the contributor, and it is
+therefore unnecessary to ask the contributor again to confirm it.
+
+I have not asked any contributors (or their employers, if they have them) for
+proofs that they have the right to distribute their software in this way.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Relax NG Object/Parser v.20050510,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) Kohsuke Kawaguchi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions: The above copyright
+notice and this permission notice shall be included in all copies or
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to RelaxNGCC v1.12, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2003 Daisuke Okajima and Kohsuke Kawaguchi.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by Daisuke Okajima
+ and Kohsuke Kawaguchi (http://relaxngcc.sf.net/)."
+
+Alternately, this acknowledgment may appear in the software itself, if and
+wherever such third-party acknowledgments normally appear.
+
+4. The names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission. For
+ written permission, please contact the copyright holders.
+
+5. Products derived from this software may not be called "RELAXNGCC", nor may
+ "RELAXNGCC" appear in their name, without prior written permission of the
+ copyright holders.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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 APACHE
+SOFTWARE FOUNDATION OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SAX 2.0.1, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ SAX is free!
+
+ In fact, it's not possible to own a license to SAX, since it's been placed in
+ the public domain.
+
+ No Warranty
+
+ Because SAX is released to the public domain, there is no warranty for the
+ design or for the software implementation, to the extent permitted by
+ applicable law. Except when otherwise stated in writing the copyright holders
+ and/or other parties provide SAX "as is" without warranty of any kind, either
+ expressed or implied, including, but not limited to, the implied warranties
+ of merchantability and fitness for a particular purpose. The entire risk as
+ to the quality and performance of SAX is with you. Should SAX prove
+ defective, you assume the cost of all necessary servicing, repair or
+ correction.
+
+ In no event unless required by applicable law or agreed to in writing will
+ any copyright holder, or any other party who may modify and/or redistribute
+ SAX, be liable to you for damages, including any general, special, incidental
+ or consequential damages arising out of the use or inability to use SAX
+ (including but not limited to loss of data or data being rendered inaccurate
+ or losses sustained by you or third parties or a failure of the SAX to
+ operate with any other programs), even if such holder or other party has been
+ advised of the possibility of such damages.
+
+ Copyright Disclaimers
+
+ This page includes statements to that effect by David Megginson, who would
+ have been able to claim copyright for the original work. SAX 1.0
+
+ Version 1.0 of the Simple API for XML (SAX), created collectively by the
+ membership of the XML-DEV mailing list, is hereby released into the public
+ domain.
+
+ No one owns SAX: you may use it freely in both commercial and non-commercial
+ applications, bundle it with your software distribution, include it on a
+ CD-ROM, list the source code in a book, mirror the documentation at your own
+ web site, or use it in any other way you see fit.
+
+ David Megginson, sax@megginson.com
+ 1998-05-11
+
+ SAX 2.0
+
+ I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and
+ release all of the SAX 2.0 source code, compiled code, and documentation
+ contained in this distribution into the Public Domain. SAX comes with NO
+ WARRANTY or guarantee of fitness for any purpose.
+
+ David Megginson, david@megginson.com
+ 2000-05-05
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SoftFloat version 2b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux/ARM.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+SoftFloat was written by me, John R. Hauser. This work was made possible in
+part by the International Computer Science Institute, located at Suite 600,
+1947 Center Street, Berkeley, California 94704. Funding was partially
+provided by the National Science Foundation under grant MIP-9311980. The
+original version of this code was written as part of a project to build
+a fixed-point vector processor in collaboration with the University of
+California at Berkeley, overseen by Profs. Nelson Morgan and John Wawrzynek.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL
+LOSSES, COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO
+FURTHERMORE EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER
+SCIENCE INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES,
+COSTS, OR OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE
+SOFTWARE.
+
+Derivative works are acceptable, even for commercial purposes, provided
+that the minimal documentation requirements stated in the source code are
+satisfied.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Sparkle 1.5,
+which may be included with JRE 8 on Mac OS X.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2012 Sparkle.org and Andy Matuschak
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions licensed from Taligent, Inc.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Thai Dictionary, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (C) 1982 The Royal Institute, Thai Royal Government.
+
+Copyright (C) 1998 National Electronics and Computer Technology Center,
+National Science and Technology Development Agency,
+Ministry of Science Technology and Environment,
+Thai Royal Government.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Unicode 6.2.0 & CLDR 21.0.1
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Unicode Terms of Use
+
+For the general privacy policy governing access to this site, see the Unicode
+Privacy Policy. For trademark usage, see the Unicode® Consortium Name and
+Trademark Usage Policy.
+
+A. Unicode Copyright.
+ 1. Copyright © 1991-2013 Unicode, Inc. All rights reserved.
+
+ 2. Certain documents and files on this website contain a legend indicating
+ that "Modification is permitted." Any person is hereby authorized,
+ without fee, to modify such documents and files to create derivative
+ works conforming to the Unicode® Standard, subject to Terms and
+ Conditions herein.
+
+ 3. Any person is hereby authorized, without fee, to view, use, reproduce,
+ and distribute all documents and files solely for informational
+ purposes in the creation of products supporting the Unicode Standard,
+ subject to the Terms and Conditions herein.
+
+ 4. Further specifications of rights and restrictions pertaining to the use
+ of the particular set of data files known as the "Unicode Character
+ Database" can be found in Exhibit 1.
+
+ 5. Each version of the Unicode Standard has further specifications of
+ rights and restrictions of use. For the book editions (Unicode 5.0 and
+ earlier), these are found on the back of the title page. The online
+ code charts carry specific restrictions. All other files, including
+ online documentation of the core specification for Unicode 6.0 and
+ later, are covered under these general Terms of Use.
+
+ 6. No license is granted to "mirror" the Unicode website where a fee is
+ charged for access to the "mirror" site.
+
+ 7. Modification is not permitted with respect to this document. All copies
+ of this document must be verbatim.
+
+B. Restricted Rights Legend. Any technical data or software which is licensed
+ to the United States of America, its agencies and/or instrumentalities
+ under this Agreement is commercial technical data or commercial computer
+ software developed exclusively at private expense as defined in FAR 2.101,
+ or DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
+ duplication, or disclosure by the Government is subject to restrictions as
+ set forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov
+ 1995) and this Agreement. For Software, in accordance with FAR 12-212 or
+ DFARS 227-7202, as applicable, use, duplication or disclosure by the
+ Government is subject to the restrictions set forth in this Agreement.
+
+C. Warranties and Disclaimers.
+ 1. This publication and/or website may include technical or typographical
+ errors or other inaccuracies . Changes are periodically added to the
+ information herein; these changes will be incorporated in new editions
+ of the publication and/or website. Unicode may make improvements and/or
+ changes in the product(s) and/or program(s) described in this
+ publication and/or website at any time.
+
+ 2. If this file has been purchased on magnetic or optical media from
+ Unicode, Inc. the sole and exclusive remedy for any claim will be
+ exchange of the defective media within ninety (90) days of original
+ purchase.
+
+ 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR SOFTWARE IS
+ PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, IMPLIED,
+ OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+ UNICODE AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR
+ OMISSIONS IN THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH
+ ARE REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE.
+
+D. Waiver of Damages. In no event shall Unicode or its licensors be liable for
+ any special, incidental, indirect or consequential damages of any kind, or
+ any damages whatsoever, whether or not Unicode was advised of the
+ possibility of the damage, including, without limitation, those resulting
+ from the following: loss of use, data or profits, in connection with the
+ use, modification or distribution of this information or its derivatives.
+
+E.Trademarks & Logos.
+ 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode,
+ Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of
+ Unicode, Inc. Use of the information and materials found on this
+ website indicates your acknowledgement of Unicode, Inc.’s exclusive
+ worldwide rights in the Unicode Word Mark, the Unicode Logo, and the
+ Unicode trade names.
+
+ 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark
+ Policy”) are incorporated herein by reference and you agree to abide by
+ the provisions of the Trademark Policy, which may be changed from time
+ to time in the sole discretion of Unicode, Inc.
+
+ 3. All third party trademarks referenced herein are the property of their
+ respective owners.
+
+Miscellaneous.
+ 1. Jurisdiction and Venue. This server is operated from a location in the
+ State of California, United States of America. Unicode makes no
+ representation that the materials are appropriate for use in other
+ locations. If you access this server from other locations, you are
+ responsible for compliance with local laws. This Agreement, all use of
+ this site and any claims and damages resulting from use of this site are
+ governed solely by the laws of the State of California without regard to
+ any principles which would apply the laws of a different jurisdiction.
+ The user agrees that any disputes regarding this site shall be resolved
+ solely in the courts located in Santa Clara County, California. The user
+ agrees said courts have personal jurisdiction and agree to waive any
+ right to transfer the dispute to any other forum.
+
+ 2. Modification by Unicode. Unicode shall have the right to modify this
+ Agreement at any time by posting it to this site. The user may not
+ assign any part of this Agreement without Unicode’s prior written
+ consent.
+
+ 3. Taxes. The user agrees to pay any taxes arising from access to this
+ website or use of the information herein, except for those based on
+ Unicode’s net income.
+
+ 4. Severability. If any provision of this Agreement is declared invalid or
+ unenforceable, the remaining provisions of this Agreement shall remain
+ in effect.
+
+ 5. Entire Agreement. This Agreement constitutes the entire agreement
+ between the parties.
+
+EXHIBIT 1
+UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+Unicode Data Files include all data files under the directories
+http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+http://www.unicode.org/cldr/data/. Unicode Data Files do not include PDF
+online code charts under the directory http://www.unicode.org/Public/.
+Software includes any source code published in the Unicode Standard or under
+the directories http://www.unicode.org/Public/,
+http://www.unicode.org/reports/, and http://www.unicode.org/cldr/data/.
+
+NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING,
+INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA
+FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO
+BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT
+AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR
+SOFTWARE.
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright © 1991-2012 Unicode, Inc. All rights reserved. Distributed under the
+Terms of Use in http://www.unicode.org/copyright.html.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the Unicode data files and any associated documentation (the "Data Files")
+or Unicode software and any associated documentation (the "Software") to deal
+in the Data Files or Software without restriction, including without
+limitation the rights to use, copy, modify, merge, publish, distribute, and/or
+sell copies of the Data Files or Software, and to permit persons to whom the
+Data Files or Software are furnished to do so, provided that (a) the above
+copyright notice(s) and this permission notice appear with all copies of the
+Data Files or Software, (b) both the above copyright notice(s) and this
+permission notice appear in associated documentation, and (c) there is clear
+notice in each modified Data File or in the Software as well as in the
+documentation associated with the Data File(s) or Software that the data or
+software has been modified.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
+DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in these Data Files or Software without prior written authorization of the
+copyright holder.
+
+Unicode and the Unicode logo are trademarks of Unicode, Inc. in the United
+States and other countries. All third party trademarks referenced herein are
+the property of their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to UPX v3.01, which may be included
+with JRE 8 on Windows.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+
+ ooooo ooo ooooooooo. ooooooo ooooo
+ `888' `8' `888 `Y88. `8888 d8'
+ 888 8 888 .d88' Y888..8P
+ 888 8 888ooo88P' `8888'
+ 888 8 888 .8PY888.
+ `88. .8' 888 d8' `888b
+ `YbodP' o888o o888o o88888o
+
+
+ The Ultimate Packer for eXecutables
+ Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
+ http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
+ http://www.nexus.hu/upx
+ http://upx.tsx.org
+
+
+PLEASE CAREFULLY READ THIS LICENSE AGREEMENT, ESPECIALLY IF YOU PLAN
+TO MODIFY THE UPX SOURCE CODE OR USE A MODIFIED UPX VERSION.
+
+
+ABSTRACT
+========
+
+ UPX and UCL are copyrighted software distributed under the terms
+ of the GNU General Public License (hereinafter the "GPL").
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ As a special exception we grant the free usage of UPX for all
+ executables, including commercial programs.
+ See below for details and restrictions.
+
+
+COPYRIGHT
+=========
+
+ UPX and UCL are copyrighted software. All rights remain with the authors.
+
+ UPX is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+ UPX is Copyright (C) 1996-2000 Laszlo Molnar
+
+ UCL is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+
+
+GNU GENERAL PUBLIC LICENSE
+==========================
+
+ UPX and the UCL library are free software; you can redistribute them
+ and/or modify them under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ UPX and UCL are distributed in the hope that they 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+
+
+SPECIAL EXCEPTION FOR COMPRESSED EXECUTABLES
+============================================
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ Hereby Markus F.X.J. Oberhumer and Laszlo Molnar grant you special
+ permission to freely use and distribute all UPX compressed programs
+ (including commercial ones), subject to the following restrictions:
+
+ 1. You must compress your program with a completely unmodified UPX
+ version; either with our precompiled version, or (at your option)
+ with a self compiled version of the unmodified UPX sources as
+ distributed by us.
+ 2. This also implies that the UPX stub must be completely unmodfied, i.e.
+ the stub imbedded in your compressed program must be byte-identical
+ to the stub that is produced by the official unmodified UPX version.
+ 3. The decompressor and any other code from the stub must exclusively get
+ used by the unmodified UPX stub for decompressing your program at
+ program startup. No portion of the stub may get read, copied,
+ called or otherwise get used or accessed by your program.
+
+
+ANNOTATIONS
+===========
+
+ - You can use a modified UPX version or modified UPX stub only for
+ programs that are compatible with the GNU General Public License.
+
+ - We grant you special permission to freely use and distribute all UPX
+ compressed programs. But any modification of the UPX stub (such as,
+ but not limited to, removing our copyright string or making your
+ program non-decompressible) will immediately revoke your right to
+ use and distribute a UPX compressed program.
+
+ - UPX is not a software protection tool; by requiring that you use
+ the unmodified UPX version for your proprietary programs we
+ make sure that any user can decompress your program. This protects
+ both you and your users as nobody can hide malicious code -
+ any program that cannot be decompressed is highly suspicious
+ by definition.
+
+ - You can integrate all or part of UPX and UCL into projects that
+ are compatible with the GNU GPL, but obviously you cannot grant
+ any special exceptions beyond the GPL for our code in your project.
+
+ - We want to actively support manufacturers of virus scanners and
+ similar security software. Please contact us if you would like to
+ incorporate parts of UPX or UCL into such a product.
+
+
+
+Markus F.X.J. Oberhumer Laszlo Molnar
+markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
+
+Linz, Austria, 25 Feb 2000
+
+Additional License(s)
+
+The UPX license file is at http://upx.sourceforge.net/upx-license.html.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Xfree86-VidMode Extension 1.0,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Version 1.1 of XFree86 ProjectLicence.
+
+Copyright (C) 1994-2004 The XFree86 Project, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicence, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so,subject to the following conditions:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice,this list of conditions, and the following disclaimer.
+
+ 2. 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, and in the same place
+ and form as other copyright, license and disclaimer information.
+
+ 3. The end-user documentation included with the redistribution, if any,must
+ include the following acknowledgment: "This product includes
+ software developed by The XFree86 Project, Inc (http://www.xfree86.org/) and
+ its contributors", in the same place and form as other third-party
+ acknowledgments. Alternately, this acknowledgment may appear in the software
+ itself, in the same form and location as other such third-party
+ acknowledgments.
+
+ 4. Except as contained in this notice, the name of The XFree86 Project,Inc
+ shall not be used in advertising or otherwise to promote the sale, use
+ or other dealings in this Software without prior written authorization from
+ The XFree86 Project, Inc.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 XFREE86 PROJECT, INC OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to X Window System 6.8.2, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+ Licenses
+The X.Org Foundation March 2004
+
+1. Introduction
+
+The X.org Foundation X Window System distribution is a compilation of code and
+documentation from many sources. This document is intended primarily as a
+guide to the licenses used in the distribution: you must check each file
+and/or package for precise redistribution terms. None-the-less, this summary
+may be useful to many users. No software incorporating the XFree86 1.1 license
+has been incorporated.
+
+This document is based on the compilation from XFree86.
+
+2. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following
+copyright/license:
+
+Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the XFree86 Project.
+
+3. Other Licenses
+
+Portions of code are covered by the following licenses/copyrights. See
+individual files for the copyright dates.
+
+3.1. X/MIT Copyrights
+
+3.1.1. X Consortium
+
+Copyright (C) <date> X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
+3.1.2. The Open Group
+
+Copyright <date> The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation.
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from The Open Group. 3.2.
+Berkeley-based copyrights:
+
+o
+3.2.1. General
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.2. UCB/LBL
+
+Copyright (c) 1993 The Regents of the University of California. All rights
+reserved.
+
+This software was developed by the Computer Systems Engineering group at
+Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
+Berkeley.
+
+All advertising materials mentioning features or use of this software must
+display the following acknowledgement: This product includes software
+developed by the University of California, Lawrence Berkeley Laboratory.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the University of California, Berkeley and its contributors.
+
+ 4. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. 3.2.3. The
+NetBSD Foundation, Inc.
+
+Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation by Ben
+Collver <collver1@attbi.com>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the NetBSD Foundation, Inc. and its contributors.
+
+ 4. Neither the name of The NetBSD Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. 3.2.4. Theodore
+Ts'o.
+
+Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights
+reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ and the entire permission notice in its entirety, including the disclaimer
+ of warranties.
+
+ 2. 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.
+
+ 3. he name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR 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 NOT ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.2.5. Theo de Raadt and Damien Miller
+
+Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c)
+2001-2002 Damien Miller. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.6. Todd C. Miller
+
+Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 3.2.7. Thomas
+Winischhofer
+
+Copyright (C) 2001-2004 Thomas Winischhofer
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED 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 AUTHOR 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. 3.3. NVIDIA Corp
+
+Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+NOTICE TO USER: The source code is copyrighted under U.S. and international
+laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as design
+patents pending on the design and interface of the NV chips. Users and
+possessors of this source code are hereby granted a nonexclusive, royalty-free
+copyright and design patent license to use this code in individual and
+commercial software.
+
+Any use of this source code must include, in the user documentation and
+internal comments to the code, notices to the end user as follows:
+
+Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. and
+foreign countries.
+
+NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
+WARRANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
+FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. 3.4. GLX Public
+License
+
+GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
+
+Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
+grants permission to Recipient (defined below), under Recipient's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below), and to permit persons to whom the Subject Software is
+furnished in accordance with this License to do the same, subject to all of
+the following terms and conditions, which Recipient accepts by engaging in any
+such use, copying, modifying, merging, publishing, distributing, sublicensing
+or selling:
+
+1. Definitions.
+
+ (a) "Original Software" means source code of computer software code which
+ is described in Exhibit A as Original Software.
+
+ (b) "Modifications" means any addition to or deletion from the substance
+ or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of files, a
+ Modification means (i) any addition to or deletion from the contents of a
+ file containing Original Software or previous Modifications and (ii) any
+ new file that contains any part of the Original Code or previous
+ Modifications.
+
+ (c) "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ (d) "Recipient" means an individual or a legal entity exercising rights
+ under, and complying with all of the terms of, this License. For legal
+ entities, "Recipient" includes any entity which controls, is controlled
+ by, or is under common control with Recipient. For purposes of this
+ definition, "control" of an entity means (a) the power, direct or
+ indirect, to direct or manage such entity, or (b) ownership of fifty
+ percent (50%) or more of the outstanding shares or beneficial ownership of
+ such entity.
+
+2. Redistribution of Source Code Subject to These Terms. Redistributions of
+Subject Software in source code form must retain the notice set forth in
+Exhibit A, below, in every file. A copy of this License must be included in
+any documentation for such Subject Software where the recipients' rights
+relating to Subject Software are described. Recipient may distribute the
+source code version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the source code version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+3. Redistribution in Executable Form. The notice set forth in Exhibit A must
+be conspicuously included in any notice in an executable version of Subject
+Software, related documentation or collateral in which Recipient describes the
+user's rights relating to the Subject Software. Recipient may distribute the
+executable version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the executable version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+4. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software which is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+5. No Trademark Rights. This License does not grant any rights to use any
+trade name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from
+the Subject Software without prior written permission of SGI.
+
+6. No Other Rights. This License does not grant any rights with respect to the
+OpenGL API or to any software or hardware implementation thereof or to any
+other software whatsoever, nor shall any other rights or licenses not
+expressly granted hereunder arise by implication, estoppel or otherwise with
+respect to the Subject Software. Title to and ownership of the Original
+Software at all times remains with SGI. All rights in the Original Software
+not expressly granted under this License are reserved.
+
+7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+8. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Exhibit A notice required under Sections 2 and 3,
+above, and in the text of any related documentation, license agreement or
+collateral in which Recipient describes end user's rights relating to the
+Subject Software. If Recipient obtains such knowledge after it makes Subject
+Software available to any other person or entity, Recipient shall take other
+steps (such as notifying appropriate mailing lists or newsgroups) reasonably
+calculated to inform those who received the Subject Software that new
+knowledge has been obtained.
+
+9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
+THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
+TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
+THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
+
+11. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. from
+and against any loss, liability, damages, costs or expenses (including the
+payment of reasonable attorneys fees) arising out of Recipient's use,
+modification, reproduction and distribution of the Subject Software or out of
+any representation or warranty made by Recipient.
+
+12. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+13. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed so as to achieve as nearly as
+possible the same economic effect as the original provision and the remainder
+of this License will remain in effect. This License shall be governed by and
+construed in accordance with the laws of the United States and the State of
+California as applied to agreements entered into and to be performed entirely
+within California between California residents. Any litigation relating to
+this License shall be subject to the exclusive jurisdiction of the Federal
+Courts of the Northern District of California (or, absent subject matter
+jurisdiction in such courts, the courts of the State of California), with
+venue lying exclusively in Santa Clara County, California, with the losing
+party responsible for costs, including without limitation, court costs and
+reasonable attorneys fees and expenses. The application of the United Nations
+Convention on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of a contract
+shall be construed against the drafter shall not apply to this License.
+
+Exhibit A
+
+The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and 13
+of the GLX Public License Version 1.0 (the "License"). You may not use this
+file except in compliance with those sections of the License. You may obtain a
+copy of the License at Silicon Graphics, Inc., attn: Legal Services, 2011 N.
+Shoreline Blvd., Mountain View, CA 94043 or at
+http://www.sgi.com/software/opensource/glx/license.html.
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software is GLX version 1.2 source code, released February, 1999.
+The developer of the Original Software is Silicon Graphics, Inc. Those
+portions of the Subject Software created by Silicon Graphics, Inc. are
+Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. 3.5. CID
+Font Code Public License
+
+CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
+
+Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
+hereby grants permission to Recipient (defined below), under SGI's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below) in both source code and executable form, and to permit persons
+to whom the Subject Software is furnished in accordance with this License to
+do the same, subject to all of the following terms and conditions, which
+Recipient accepts by engaging in any such use, copying, modifying, merging,
+publication, distributing, sublicensing or selling:
+
+1. Definitions.
+
+ a. "Original Software" means source code of computer software code that is
+ described in Exhibit A as Original Software.
+
+ b. "Modifications" means any addition to or deletion from the substance or
+ structure of either the Original Software or any previous Modifications.
+ When Subject Software is released as a series of files, a Modification
+ means (i) any addition to or deletion from the contents of a file
+ containing Original Software or previous Modifications and (ii) any new
+ file that contains any part of the Original Code or previous
+ Modifications.
+
+ c. "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ d. "Recipient" means an individual or a legal entity exercising rights
+ under the terms of this License. For legal entities, "Recipient" includes
+ any entity that controls, is controlled by, or is under common control
+ with Recipient. For purposes of this definition, "control" of an entity
+ means (i) the power, direct or indirect, to direct or manage such entity,
+ or (ii) ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+ e. "Required Notice" means the notice set forth in Exhibit A to this
+ License.
+
+ f. "Accompanying Technology" means any software or other technology that
+ is not a Modification and that is distributed or made publicly available
+ by Recipient with the Subject Software. Separate software files that do
+ not contain any Original Software or any previous Modification shall not
+ be deemed a Modification, even if such software files are aggregated as
+ part of a product, or in any medium of storage, with any file that does
+ contain Original Software or any previous Modification.
+
+2. License Terms. All distribution of the Subject Software must be made
+subject to the terms of this License. A copy of this License and the Required
+Notice must be included in any documentation for Subject Software where
+Recipient's rights relating to Subject Software and/or any Accompanying
+Technology are described. Distributions of Subject Software in source code
+form must also include the Required Notice in every file distributed. In
+addition, a ReadMe file entitled "Important Legal Notice" must be distributed
+with each distribution of one or more files that incorporate Subject Software.
+That file must be included with distributions made in both source code and
+executable form. A copy of the License and the Required Notice must be
+included in that file. Recipient may distribute Accompanying Technology under
+a license of Recipient's choice, which may contain terms different from this
+License, provided that (i) Recipient is in compliance with the terms of this
+License, (ii) such other license terms do not modify or supersede the terms of
+this License as applicable to the Subject Software, (iii) Recipient hereby
+indemnifies SGI for any liability incurred by SGI as a result of the
+distribution of Accompanying Technology or the use of other license terms.
+
+3. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software that is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+4. Trademark Rights. This License does not grant any rights to use any trade
+name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from or
+incorporating any Subject Software without prior written permission of SGI.
+
+5. No Other Rights. No rights or licenses not expressly granted hereunder
+shall arise by implication, estoppel or otherwise. Title to and ownership of
+the Original Software at all times remains with SGI. All rights in the
+Original Software not expressly granted under this License are reserved.
+
+6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity, or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+7. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Required Notice, and in the text of any related
+documentation, license agreement or collateral in which Recipient describes
+end user's rights relating to the Subject Software. If Recipient obtains such
+knowledge after it makes Subject Software available to any other person or
+entity, Recipient shall take other steps (such as notifying appropriate
+mailing lists or newsgroups) reasonably calculated to provide such knowledge
+to those who received the Subject Software.
+
+8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
+LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
+
+10. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold SGI and its successors and assigns
+harmless from and against any loss, liability, damages, costs or expenses
+(including the payment of reasonable attorneys fees) arising out of
+(Recipient's use, modification, reproduction and distribution of the Subject
+Software or out of any representation or warranty made by Recipient.
+
+11. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+12. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable by any judicial or administrative authority having proper
+jurisdiction with respect thereto, such provision shall be reformed so as to
+achieve as nearly as possible the same economic effect as the original
+provision and the remainder of this License will remain in effect. This
+License shall be governed by and construed in accordance with the laws of the
+United States and the State of California as applied to agreements entered
+into and to be performed entirely within California between California
+residents. Any litigation relating to this License shall be subject to the
+exclusive jurisdiction of the Federal Courts of the Northern District of
+California (or, absent subject matter jurisdiction in such courts, the courts
+of the State of California), with venue lying exclusively in Santa Clara
+County, California, with the losing party responsible for costs, including
+without limitation, court costs and reasonable attorneys fees and expenses.
+The application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or regulation that
+provides that the language of a contract shall be construed against the
+drafter shall not apply to this License.
+
+Exhibit A
+
+Copyright (c) 1994-1999 Silicon Graphics, Inc.
+
+The contents of this file are subject to the CID Font Code Public License
+Version 1.0 (the "License"). You may not use this file except in compliance
+with the License. You may obtain a copy of the License at Silicon Graphics,
+Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+or at http://www.sgi.com/software/opensource/cid/license.html
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
+NON-INFRINGEMENT. See the License for the specific language governing rights
+and limitations under the License.
+
+The Original Software (as defined in the License) is CID font code that was
+developed by Silicon Graphics, Inc. Those portions of the Subject Software (as
+defined in the License) that were created by Silicon Graphics, Inc. are
+Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
+
+[NOTE: When using this text in connection with Subject Software delivered
+solely in object code form, Recipient may replace the words "this file" with
+"this software" in both the first and second sentences.] 3.6. Bitstream Vera
+Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as long as
+"Bitstream" or "Vera" are not in the names), and full redistribution (so long
+as they are not *sold* by themselves). They can be be bundled, redistributed
+and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a
+trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit persons to
+whom the Font Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular the
+designs of glyphs or characters in the Fonts may be modified and additional
+glyphs or characters may be added to the Fonts, only if the fonts are renamed
+to names not containing either the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream Vera"
+names.
+
+The Font Software may be sold as part of a larger software package but no copy
+of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
+SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO
+USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome Foundation,
+and Bitstream Inc., shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Font Software without prior written
+authorization from the Gnome Foundation or Bitstream Inc., respectively. For
+further information, contact: fonts at gnome dot org. 3.7. Bigelow & Holmes
+Inc and URW++ GmbH Luxi font license
+
+Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction
+code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a
+registered trademark of Bigelow & Holmes Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of these Fonts and associated documentation files (the "Font Software"), to
+deal in the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, sublicense, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software.
+
+The Font Software may not be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may not be modified nor may
+additional glyphs or characters be added to the Fonts. This License becomes
+null and void when the Fonts or Font Software have been modified.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++
+GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY
+GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
+SOFTWARE.
+
+Except as contained in this notice, the names of Bigelow & Holmes Inc. and
+URW++ GmbH. shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Font Software without prior written
+authorization from Bigelow & Holmes Inc. and URW++ GmbH.
+
+For further information, contact:
+
+info@urwpp.de or design@bigelowandholmes.com
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to zlib v1.2.8, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ version 1.2.8, April 28th, 2013
+
+ Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to the following which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+ Apache Commons Math 3.2
+ Apache Derby 10.11.1.2
+ Apache Jakarta BCEL 5.1
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XML Security for Java 1.5.4
+ Apache Xalan-Java 2.7.1
+ Apache Xerces Java 2.10.0
+ Apache XML Resolver 1.1
+ Dynalink 0.5
+
+
+--- begin of LICENSE ---
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
diff --git a/staging/linux-x86/bin/appletviewer b/staging/linux-x86/bin/appletviewer
new file mode 100755
index 0000000..c679764
--- /dev/null
+++ b/staging/linux-x86/bin/appletviewer
Binary files differ
diff --git a/staging/linux-x86/bin/extcheck b/staging/linux-x86/bin/extcheck
new file mode 100755
index 0000000..a718d20
--- /dev/null
+++ b/staging/linux-x86/bin/extcheck
Binary files differ
diff --git a/staging/linux-x86/bin/idlj b/staging/linux-x86/bin/idlj
new file mode 100755
index 0000000..425d2f3
--- /dev/null
+++ b/staging/linux-x86/bin/idlj
Binary files differ
diff --git a/staging/linux-x86/bin/jar b/staging/linux-x86/bin/jar
new file mode 100755
index 0000000..bf81422
--- /dev/null
+++ b/staging/linux-x86/bin/jar
Binary files differ
diff --git a/staging/linux-x86/bin/jarsigner b/staging/linux-x86/bin/jarsigner
new file mode 100755
index 0000000..1243662
--- /dev/null
+++ b/staging/linux-x86/bin/jarsigner
Binary files differ
diff --git a/staging/linux-x86/bin/java b/staging/linux-x86/bin/java
new file mode 100755
index 0000000..7c05167
--- /dev/null
+++ b/staging/linux-x86/bin/java
Binary files differ
diff --git a/staging/linux-x86/bin/java-rmi.cgi b/staging/linux-x86/bin/java-rmi.cgi
new file mode 100755
index 0000000..f5d00fe
--- /dev/null
+++ b/staging/linux-x86/bin/java-rmi.cgi
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+#
+# Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+#
+
+#
+# This script executes the Java interpreter, defines properties
+# that correspond to the CGI 1.0 environment variables, and executes
+# the class "sun.rmi.transport.proxy.CGIHandler". It should be
+# installed in the directory to which the HTTP server maps the
+# URL path "/cgi-bin".
+#
+# (Configuration is necessary as noted below.)
+#
+# This class will support a QUERY_STRING of the form "forward=<port>"
+# with a REQUEST_METHOD "POST". The body of the request will be
+# forwarded (as another POST request) to the server listening on the
+# specified port (must be >= 1024). The response from this forwarded
+# request will be the response to the original request.
+#
+# CONFIGURATION:
+#
+# Fill in correct absolute path to Java interpreter below. For example,
+# the "PATH=" line might be changed to the follow if the JDK is installed
+# at the path "/home/peter/java":
+#
+# PATH=/home/peter/java/bin:$PATH
+#
+PATH=/usr/local/java/bin:$PATH
+exec java \
+ -DAUTH_TYPE="$AUTH_TYPE" \
+ -DCONTENT_LENGTH="$CONTENT_LENGTH" \
+ -DCONTENT_TYPE="$CONTENT_TYPE" \
+ -DGATEWAY_INTERFACE="$GATEWAY_INTERFACE" \
+ -DHTTP_ACCEPT="$HTTP_ACCEPT" \
+ -DPATH_INFO="$PATH_INFO" \
+ -DPATH_TRANSLATED="$PATH_TRANSLATED" \
+ -DQUERY_STRING="$QUERY_STRING" \
+ -DREMOTE_ADDR="$REMOTE_ADDR" \
+ -DREMOTE_HOST="$REMOTE_HOST" \
+ -DREMOTE_IDENT="$REMOTE_IDENT" \
+ -DREMOTE_USER="$REMOTE_USER" \
+ -DREQUEST_METHOD="$REQUEST_METHOD" \
+ -DSCRIPT_NAME="$SCRIPT_NAME" \
+ -DSERVER_NAME="$SERVER_NAME" \
+ -DSERVER_PORT="$SERVER_PORT" \
+ -DSERVER_PROTOCOL="$SERVER_PROTOCOL" \
+ -DSERVER_SOFTWARE="$SERVER_SOFTWARE" \
+ sun.rmi.transport.proxy.CGIHandler
diff --git a/staging/linux-x86/bin/javac b/staging/linux-x86/bin/javac
new file mode 100755
index 0000000..d8b0846
--- /dev/null
+++ b/staging/linux-x86/bin/javac
Binary files differ
diff --git a/staging/linux-x86/bin/javadoc b/staging/linux-x86/bin/javadoc
new file mode 100755
index 0000000..72d0fc4
--- /dev/null
+++ b/staging/linux-x86/bin/javadoc
Binary files differ
diff --git a/staging/linux-x86/bin/javah b/staging/linux-x86/bin/javah
new file mode 100755
index 0000000..15db415
--- /dev/null
+++ b/staging/linux-x86/bin/javah
Binary files differ
diff --git a/staging/linux-x86/bin/javap b/staging/linux-x86/bin/javap
new file mode 100755
index 0000000..9fd39b5
--- /dev/null
+++ b/staging/linux-x86/bin/javap
Binary files differ
diff --git a/staging/linux-x86/bin/jcmd b/staging/linux-x86/bin/jcmd
new file mode 100755
index 0000000..9fc7297
--- /dev/null
+++ b/staging/linux-x86/bin/jcmd
Binary files differ
diff --git a/staging/linux-x86/bin/jconsole b/staging/linux-x86/bin/jconsole
new file mode 100755
index 0000000..5e69ace
--- /dev/null
+++ b/staging/linux-x86/bin/jconsole
Binary files differ
diff --git a/staging/linux-x86/bin/jdb b/staging/linux-x86/bin/jdb
new file mode 100755
index 0000000..e9088e7
--- /dev/null
+++ b/staging/linux-x86/bin/jdb
Binary files differ
diff --git a/staging/linux-x86/bin/jdeps b/staging/linux-x86/bin/jdeps
new file mode 100755
index 0000000..d636b32
--- /dev/null
+++ b/staging/linux-x86/bin/jdeps
Binary files differ
diff --git a/staging/linux-x86/bin/jhat b/staging/linux-x86/bin/jhat
new file mode 100755
index 0000000..fd9510c
--- /dev/null
+++ b/staging/linux-x86/bin/jhat
Binary files differ
diff --git a/staging/linux-x86/bin/jinfo b/staging/linux-x86/bin/jinfo
new file mode 100755
index 0000000..e53b8e8
--- /dev/null
+++ b/staging/linux-x86/bin/jinfo
Binary files differ
diff --git a/staging/linux-x86/bin/jjs b/staging/linux-x86/bin/jjs
new file mode 100755
index 0000000..10fdc0c
--- /dev/null
+++ b/staging/linux-x86/bin/jjs
Binary files differ
diff --git a/staging/linux-x86/bin/jmap b/staging/linux-x86/bin/jmap
new file mode 100755
index 0000000..a74346f
--- /dev/null
+++ b/staging/linux-x86/bin/jmap
Binary files differ
diff --git a/staging/linux-x86/bin/jps b/staging/linux-x86/bin/jps
new file mode 100755
index 0000000..9fe4c43
--- /dev/null
+++ b/staging/linux-x86/bin/jps
Binary files differ
diff --git a/staging/linux-x86/bin/jrunscript b/staging/linux-x86/bin/jrunscript
new file mode 100755
index 0000000..ad35d39
--- /dev/null
+++ b/staging/linux-x86/bin/jrunscript
Binary files differ
diff --git a/staging/linux-x86/bin/jsadebugd b/staging/linux-x86/bin/jsadebugd
new file mode 100755
index 0000000..62e5731
--- /dev/null
+++ b/staging/linux-x86/bin/jsadebugd
Binary files differ
diff --git a/staging/linux-x86/bin/jstack b/staging/linux-x86/bin/jstack
new file mode 100755
index 0000000..1169e57
--- /dev/null
+++ b/staging/linux-x86/bin/jstack
Binary files differ
diff --git a/staging/linux-x86/bin/jstat b/staging/linux-x86/bin/jstat
new file mode 100755
index 0000000..42eaf56
--- /dev/null
+++ b/staging/linux-x86/bin/jstat
Binary files differ
diff --git a/staging/linux-x86/bin/jstatd b/staging/linux-x86/bin/jstatd
new file mode 100755
index 0000000..d3df3f2
--- /dev/null
+++ b/staging/linux-x86/bin/jstatd
Binary files differ
diff --git a/staging/linux-x86/bin/keytool b/staging/linux-x86/bin/keytool
new file mode 100755
index 0000000..fedd8e2
--- /dev/null
+++ b/staging/linux-x86/bin/keytool
Binary files differ
diff --git a/staging/linux-x86/bin/native2ascii b/staging/linux-x86/bin/native2ascii
new file mode 100755
index 0000000..9e0a26f
--- /dev/null
+++ b/staging/linux-x86/bin/native2ascii
Binary files differ
diff --git a/staging/linux-x86/bin/orbd b/staging/linux-x86/bin/orbd
new file mode 100755
index 0000000..c545599
--- /dev/null
+++ b/staging/linux-x86/bin/orbd
Binary files differ
diff --git a/staging/linux-x86/bin/pack200 b/staging/linux-x86/bin/pack200
new file mode 100755
index 0000000..386005a
--- /dev/null
+++ b/staging/linux-x86/bin/pack200
Binary files differ
diff --git a/staging/linux-x86/bin/policytool b/staging/linux-x86/bin/policytool
new file mode 100755
index 0000000..c556ed6
--- /dev/null
+++ b/staging/linux-x86/bin/policytool
Binary files differ
diff --git a/staging/linux-x86/bin/rmic b/staging/linux-x86/bin/rmic
new file mode 100755
index 0000000..a2d6fa2
--- /dev/null
+++ b/staging/linux-x86/bin/rmic
Binary files differ
diff --git a/staging/linux-x86/bin/rmid b/staging/linux-x86/bin/rmid
new file mode 100755
index 0000000..d3329a2
--- /dev/null
+++ b/staging/linux-x86/bin/rmid
Binary files differ
diff --git a/staging/linux-x86/bin/rmiregistry b/staging/linux-x86/bin/rmiregistry
new file mode 100755
index 0000000..8a7d840
--- /dev/null
+++ b/staging/linux-x86/bin/rmiregistry
Binary files differ
diff --git a/staging/linux-x86/bin/schemagen b/staging/linux-x86/bin/schemagen
new file mode 100755
index 0000000..974aa87
--- /dev/null
+++ b/staging/linux-x86/bin/schemagen
Binary files differ
diff --git a/staging/linux-x86/bin/serialver b/staging/linux-x86/bin/serialver
new file mode 100755
index 0000000..c87fb13
--- /dev/null
+++ b/staging/linux-x86/bin/serialver
Binary files differ
diff --git a/staging/linux-x86/bin/servertool b/staging/linux-x86/bin/servertool
new file mode 100755
index 0000000..10c3ef9
--- /dev/null
+++ b/staging/linux-x86/bin/servertool
Binary files differ
diff --git a/staging/linux-x86/bin/tnameserv b/staging/linux-x86/bin/tnameserv
new file mode 100755
index 0000000..6e784a1
--- /dev/null
+++ b/staging/linux-x86/bin/tnameserv
Binary files differ
diff --git a/staging/linux-x86/bin/unpack200 b/staging/linux-x86/bin/unpack200
new file mode 100755
index 0000000..0bb3097
--- /dev/null
+++ b/staging/linux-x86/bin/unpack200
Binary files differ
diff --git a/staging/linux-x86/bin/wsgen b/staging/linux-x86/bin/wsgen
new file mode 100755
index 0000000..f1a7410
--- /dev/null
+++ b/staging/linux-x86/bin/wsgen
Binary files differ
diff --git a/staging/linux-x86/bin/wsimport b/staging/linux-x86/bin/wsimport
new file mode 100755
index 0000000..b204ca0
--- /dev/null
+++ b/staging/linux-x86/bin/wsimport
Binary files differ
diff --git a/staging/linux-x86/bin/xjc b/staging/linux-x86/bin/xjc
new file mode 100755
index 0000000..257a180
--- /dev/null
+++ b/staging/linux-x86/bin/xjc
Binary files differ
diff --git a/staging/linux-x86/include/classfile_constants.h b/staging/linux-x86/include/classfile_constants.h
new file mode 100644
index 0000000..1fa6e3c
--- /dev/null
+++ b/staging/linux-x86/include/classfile_constants.h
@@ -0,0 +1,560 @@
+/*
+ * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef CLASSFILE_CONSTANTS_H
+#define CLASSFILE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Classfile version number for this information */
+#define JVM_CLASSFILE_MAJOR_VERSION 52
+#define JVM_CLASSFILE_MINOR_VERSION 0
+
+/* Flags */
+
+enum {
+ JVM_ACC_PUBLIC = 0x0001,
+ JVM_ACC_PRIVATE = 0x0002,
+ JVM_ACC_PROTECTED = 0x0004,
+ JVM_ACC_STATIC = 0x0008,
+ JVM_ACC_FINAL = 0x0010,
+ JVM_ACC_SYNCHRONIZED = 0x0020,
+ JVM_ACC_SUPER = 0x0020,
+ JVM_ACC_VOLATILE = 0x0040,
+ JVM_ACC_BRIDGE = 0x0040,
+ JVM_ACC_TRANSIENT = 0x0080,
+ JVM_ACC_VARARGS = 0x0080,
+ JVM_ACC_NATIVE = 0x0100,
+ JVM_ACC_INTERFACE = 0x0200,
+ JVM_ACC_ABSTRACT = 0x0400,
+ JVM_ACC_STRICT = 0x0800,
+ JVM_ACC_SYNTHETIC = 0x1000,
+ JVM_ACC_ANNOTATION = 0x2000,
+ JVM_ACC_ENUM = 0x4000
+};
+
+/* Used in newarray instruction. */
+
+enum {
+ JVM_T_BOOLEAN = 4,
+ JVM_T_CHAR = 5,
+ JVM_T_FLOAT = 6,
+ JVM_T_DOUBLE = 7,
+ JVM_T_BYTE = 8,
+ JVM_T_SHORT = 9,
+ JVM_T_INT = 10,
+ JVM_T_LONG = 11
+};
+
+/* Constant Pool Entries */
+
+enum {
+ JVM_CONSTANT_Utf8 = 1,
+ JVM_CONSTANT_Unicode = 2, /* unused */
+ JVM_CONSTANT_Integer = 3,
+ JVM_CONSTANT_Float = 4,
+ JVM_CONSTANT_Long = 5,
+ JVM_CONSTANT_Double = 6,
+ JVM_CONSTANT_Class = 7,
+ JVM_CONSTANT_String = 8,
+ JVM_CONSTANT_Fieldref = 9,
+ JVM_CONSTANT_Methodref = 10,
+ JVM_CONSTANT_InterfaceMethodref = 11,
+ JVM_CONSTANT_NameAndType = 12,
+ JVM_CONSTANT_MethodHandle = 15, // JSR 292
+ JVM_CONSTANT_MethodType = 16, // JSR 292
+ JVM_CONSTANT_InvokeDynamic = 18
+};
+
+/* JVM_CONSTANT_MethodHandle subtypes */
+enum {
+ JVM_REF_getField = 1,
+ JVM_REF_getStatic = 2,
+ JVM_REF_putField = 3,
+ JVM_REF_putStatic = 4,
+ JVM_REF_invokeVirtual = 5,
+ JVM_REF_invokeStatic = 6,
+ JVM_REF_invokeSpecial = 7,
+ JVM_REF_newInvokeSpecial = 8,
+ JVM_REF_invokeInterface = 9
+};
+
+/* StackMapTable type item numbers */
+
+enum {
+ JVM_ITEM_Top = 0,
+ JVM_ITEM_Integer = 1,
+ JVM_ITEM_Float = 2,
+ JVM_ITEM_Double = 3,
+ JVM_ITEM_Long = 4,
+ JVM_ITEM_Null = 5,
+ JVM_ITEM_UninitializedThis = 6,
+ JVM_ITEM_Object = 7,
+ JVM_ITEM_Uninitialized = 8
+};
+
+/* Type signatures */
+
+enum {
+ JVM_SIGNATURE_ARRAY = '[',
+ JVM_SIGNATURE_BYTE = 'B',
+ JVM_SIGNATURE_CHAR = 'C',
+ JVM_SIGNATURE_CLASS = 'L',
+ JVM_SIGNATURE_ENDCLASS = ';',
+ JVM_SIGNATURE_ENUM = 'E',
+ JVM_SIGNATURE_FLOAT = 'F',
+ JVM_SIGNATURE_DOUBLE = 'D',
+ JVM_SIGNATURE_FUNC = '(',
+ JVM_SIGNATURE_ENDFUNC = ')',
+ JVM_SIGNATURE_INT = 'I',
+ JVM_SIGNATURE_LONG = 'J',
+ JVM_SIGNATURE_SHORT = 'S',
+ JVM_SIGNATURE_VOID = 'V',
+ JVM_SIGNATURE_BOOLEAN = 'Z'
+};
+
+/* Opcodes */
+
+enum {
+ JVM_OPC_nop = 0,
+ JVM_OPC_aconst_null = 1,
+ JVM_OPC_iconst_m1 = 2,
+ JVM_OPC_iconst_0 = 3,
+ JVM_OPC_iconst_1 = 4,
+ JVM_OPC_iconst_2 = 5,
+ JVM_OPC_iconst_3 = 6,
+ JVM_OPC_iconst_4 = 7,
+ JVM_OPC_iconst_5 = 8,
+ JVM_OPC_lconst_0 = 9,
+ JVM_OPC_lconst_1 = 10,
+ JVM_OPC_fconst_0 = 11,
+ JVM_OPC_fconst_1 = 12,
+ JVM_OPC_fconst_2 = 13,
+ JVM_OPC_dconst_0 = 14,
+ JVM_OPC_dconst_1 = 15,
+ JVM_OPC_bipush = 16,
+ JVM_OPC_sipush = 17,
+ JVM_OPC_ldc = 18,
+ JVM_OPC_ldc_w = 19,
+ JVM_OPC_ldc2_w = 20,
+ JVM_OPC_iload = 21,
+ JVM_OPC_lload = 22,
+ JVM_OPC_fload = 23,
+ JVM_OPC_dload = 24,
+ JVM_OPC_aload = 25,
+ JVM_OPC_iload_0 = 26,
+ JVM_OPC_iload_1 = 27,
+ JVM_OPC_iload_2 = 28,
+ JVM_OPC_iload_3 = 29,
+ JVM_OPC_lload_0 = 30,
+ JVM_OPC_lload_1 = 31,
+ JVM_OPC_lload_2 = 32,
+ JVM_OPC_lload_3 = 33,
+ JVM_OPC_fload_0 = 34,
+ JVM_OPC_fload_1 = 35,
+ JVM_OPC_fload_2 = 36,
+ JVM_OPC_fload_3 = 37,
+ JVM_OPC_dload_0 = 38,
+ JVM_OPC_dload_1 = 39,
+ JVM_OPC_dload_2 = 40,
+ JVM_OPC_dload_3 = 41,
+ JVM_OPC_aload_0 = 42,
+ JVM_OPC_aload_1 = 43,
+ JVM_OPC_aload_2 = 44,
+ JVM_OPC_aload_3 = 45,
+ JVM_OPC_iaload = 46,
+ JVM_OPC_laload = 47,
+ JVM_OPC_faload = 48,
+ JVM_OPC_daload = 49,
+ JVM_OPC_aaload = 50,
+ JVM_OPC_baload = 51,
+ JVM_OPC_caload = 52,
+ JVM_OPC_saload = 53,
+ JVM_OPC_istore = 54,
+ JVM_OPC_lstore = 55,
+ JVM_OPC_fstore = 56,
+ JVM_OPC_dstore = 57,
+ JVM_OPC_astore = 58,
+ JVM_OPC_istore_0 = 59,
+ JVM_OPC_istore_1 = 60,
+ JVM_OPC_istore_2 = 61,
+ JVM_OPC_istore_3 = 62,
+ JVM_OPC_lstore_0 = 63,
+ JVM_OPC_lstore_1 = 64,
+ JVM_OPC_lstore_2 = 65,
+ JVM_OPC_lstore_3 = 66,
+ JVM_OPC_fstore_0 = 67,
+ JVM_OPC_fstore_1 = 68,
+ JVM_OPC_fstore_2 = 69,
+ JVM_OPC_fstore_3 = 70,
+ JVM_OPC_dstore_0 = 71,
+ JVM_OPC_dstore_1 = 72,
+ JVM_OPC_dstore_2 = 73,
+ JVM_OPC_dstore_3 = 74,
+ JVM_OPC_astore_0 = 75,
+ JVM_OPC_astore_1 = 76,
+ JVM_OPC_astore_2 = 77,
+ JVM_OPC_astore_3 = 78,
+ JVM_OPC_iastore = 79,
+ JVM_OPC_lastore = 80,
+ JVM_OPC_fastore = 81,
+ JVM_OPC_dastore = 82,
+ JVM_OPC_aastore = 83,
+ JVM_OPC_bastore = 84,
+ JVM_OPC_castore = 85,
+ JVM_OPC_sastore = 86,
+ JVM_OPC_pop = 87,
+ JVM_OPC_pop2 = 88,
+ JVM_OPC_dup = 89,
+ JVM_OPC_dup_x1 = 90,
+ JVM_OPC_dup_x2 = 91,
+ JVM_OPC_dup2 = 92,
+ JVM_OPC_dup2_x1 = 93,
+ JVM_OPC_dup2_x2 = 94,
+ JVM_OPC_swap = 95,
+ JVM_OPC_iadd = 96,
+ JVM_OPC_ladd = 97,
+ JVM_OPC_fadd = 98,
+ JVM_OPC_dadd = 99,
+ JVM_OPC_isub = 100,
+ JVM_OPC_lsub = 101,
+ JVM_OPC_fsub = 102,
+ JVM_OPC_dsub = 103,
+ JVM_OPC_imul = 104,
+ JVM_OPC_lmul = 105,
+ JVM_OPC_fmul = 106,
+ JVM_OPC_dmul = 107,
+ JVM_OPC_idiv = 108,
+ JVM_OPC_ldiv = 109,
+ JVM_OPC_fdiv = 110,
+ JVM_OPC_ddiv = 111,
+ JVM_OPC_irem = 112,
+ JVM_OPC_lrem = 113,
+ JVM_OPC_frem = 114,
+ JVM_OPC_drem = 115,
+ JVM_OPC_ineg = 116,
+ JVM_OPC_lneg = 117,
+ JVM_OPC_fneg = 118,
+ JVM_OPC_dneg = 119,
+ JVM_OPC_ishl = 120,
+ JVM_OPC_lshl = 121,
+ JVM_OPC_ishr = 122,
+ JVM_OPC_lshr = 123,
+ JVM_OPC_iushr = 124,
+ JVM_OPC_lushr = 125,
+ JVM_OPC_iand = 126,
+ JVM_OPC_land = 127,
+ JVM_OPC_ior = 128,
+ JVM_OPC_lor = 129,
+ JVM_OPC_ixor = 130,
+ JVM_OPC_lxor = 131,
+ JVM_OPC_iinc = 132,
+ JVM_OPC_i2l = 133,
+ JVM_OPC_i2f = 134,
+ JVM_OPC_i2d = 135,
+ JVM_OPC_l2i = 136,
+ JVM_OPC_l2f = 137,
+ JVM_OPC_l2d = 138,
+ JVM_OPC_f2i = 139,
+ JVM_OPC_f2l = 140,
+ JVM_OPC_f2d = 141,
+ JVM_OPC_d2i = 142,
+ JVM_OPC_d2l = 143,
+ JVM_OPC_d2f = 144,
+ JVM_OPC_i2b = 145,
+ JVM_OPC_i2c = 146,
+ JVM_OPC_i2s = 147,
+ JVM_OPC_lcmp = 148,
+ JVM_OPC_fcmpl = 149,
+ JVM_OPC_fcmpg = 150,
+ JVM_OPC_dcmpl = 151,
+ JVM_OPC_dcmpg = 152,
+ JVM_OPC_ifeq = 153,
+ JVM_OPC_ifne = 154,
+ JVM_OPC_iflt = 155,
+ JVM_OPC_ifge = 156,
+ JVM_OPC_ifgt = 157,
+ JVM_OPC_ifle = 158,
+ JVM_OPC_if_icmpeq = 159,
+ JVM_OPC_if_icmpne = 160,
+ JVM_OPC_if_icmplt = 161,
+ JVM_OPC_if_icmpge = 162,
+ JVM_OPC_if_icmpgt = 163,
+ JVM_OPC_if_icmple = 164,
+ JVM_OPC_if_acmpeq = 165,
+ JVM_OPC_if_acmpne = 166,
+ JVM_OPC_goto = 167,
+ JVM_OPC_jsr = 168,
+ JVM_OPC_ret = 169,
+ JVM_OPC_tableswitch = 170,
+ JVM_OPC_lookupswitch = 171,
+ JVM_OPC_ireturn = 172,
+ JVM_OPC_lreturn = 173,
+ JVM_OPC_freturn = 174,
+ JVM_OPC_dreturn = 175,
+ JVM_OPC_areturn = 176,
+ JVM_OPC_return = 177,
+ JVM_OPC_getstatic = 178,
+ JVM_OPC_putstatic = 179,
+ JVM_OPC_getfield = 180,
+ JVM_OPC_putfield = 181,
+ JVM_OPC_invokevirtual = 182,
+ JVM_OPC_invokespecial = 183,
+ JVM_OPC_invokestatic = 184,
+ JVM_OPC_invokeinterface = 185,
+ JVM_OPC_invokedynamic = 186,
+ JVM_OPC_new = 187,
+ JVM_OPC_newarray = 188,
+ JVM_OPC_anewarray = 189,
+ JVM_OPC_arraylength = 190,
+ JVM_OPC_athrow = 191,
+ JVM_OPC_checkcast = 192,
+ JVM_OPC_instanceof = 193,
+ JVM_OPC_monitorenter = 194,
+ JVM_OPC_monitorexit = 195,
+ JVM_OPC_wide = 196,
+ JVM_OPC_multianewarray = 197,
+ JVM_OPC_ifnull = 198,
+ JVM_OPC_ifnonnull = 199,
+ JVM_OPC_goto_w = 200,
+ JVM_OPC_jsr_w = 201,
+ JVM_OPC_MAX = 201
+};
+
+/* Opcode length initializer, use with something like:
+ * unsigned char opcode_length[JVM_OPC_MAX+1] = JVM_OPCODE_LENGTH_INITIALIZER;
+ */
+#define JVM_OPCODE_LENGTH_INITIALIZER { \
+ 1, /* nop */ \
+ 1, /* aconst_null */ \
+ 1, /* iconst_m1 */ \
+ 1, /* iconst_0 */ \
+ 1, /* iconst_1 */ \
+ 1, /* iconst_2 */ \
+ 1, /* iconst_3 */ \
+ 1, /* iconst_4 */ \
+ 1, /* iconst_5 */ \
+ 1, /* lconst_0 */ \
+ 1, /* lconst_1 */ \
+ 1, /* fconst_0 */ \
+ 1, /* fconst_1 */ \
+ 1, /* fconst_2 */ \
+ 1, /* dconst_0 */ \
+ 1, /* dconst_1 */ \
+ 2, /* bipush */ \
+ 3, /* sipush */ \
+ 2, /* ldc */ \
+ 3, /* ldc_w */ \
+ 3, /* ldc2_w */ \
+ 2, /* iload */ \
+ 2, /* lload */ \
+ 2, /* fload */ \
+ 2, /* dload */ \
+ 2, /* aload */ \
+ 1, /* iload_0 */ \
+ 1, /* iload_1 */ \
+ 1, /* iload_2 */ \
+ 1, /* iload_3 */ \
+ 1, /* lload_0 */ \
+ 1, /* lload_1 */ \
+ 1, /* lload_2 */ \
+ 1, /* lload_3 */ \
+ 1, /* fload_0 */ \
+ 1, /* fload_1 */ \
+ 1, /* fload_2 */ \
+ 1, /* fload_3 */ \
+ 1, /* dload_0 */ \
+ 1, /* dload_1 */ \
+ 1, /* dload_2 */ \
+ 1, /* dload_3 */ \
+ 1, /* aload_0 */ \
+ 1, /* aload_1 */ \
+ 1, /* aload_2 */ \
+ 1, /* aload_3 */ \
+ 1, /* iaload */ \
+ 1, /* laload */ \
+ 1, /* faload */ \
+ 1, /* daload */ \
+ 1, /* aaload */ \
+ 1, /* baload */ \
+ 1, /* caload */ \
+ 1, /* saload */ \
+ 2, /* istore */ \
+ 2, /* lstore */ \
+ 2, /* fstore */ \
+ 2, /* dstore */ \
+ 2, /* astore */ \
+ 1, /* istore_0 */ \
+ 1, /* istore_1 */ \
+ 1, /* istore_2 */ \
+ 1, /* istore_3 */ \
+ 1, /* lstore_0 */ \
+ 1, /* lstore_1 */ \
+ 1, /* lstore_2 */ \
+ 1, /* lstore_3 */ \
+ 1, /* fstore_0 */ \
+ 1, /* fstore_1 */ \
+ 1, /* fstore_2 */ \
+ 1, /* fstore_3 */ \
+ 1, /* dstore_0 */ \
+ 1, /* dstore_1 */ \
+ 1, /* dstore_2 */ \
+ 1, /* dstore_3 */ \
+ 1, /* astore_0 */ \
+ 1, /* astore_1 */ \
+ 1, /* astore_2 */ \
+ 1, /* astore_3 */ \
+ 1, /* iastore */ \
+ 1, /* lastore */ \
+ 1, /* fastore */ \
+ 1, /* dastore */ \
+ 1, /* aastore */ \
+ 1, /* bastore */ \
+ 1, /* castore */ \
+ 1, /* sastore */ \
+ 1, /* pop */ \
+ 1, /* pop2 */ \
+ 1, /* dup */ \
+ 1, /* dup_x1 */ \
+ 1, /* dup_x2 */ \
+ 1, /* dup2 */ \
+ 1, /* dup2_x1 */ \
+ 1, /* dup2_x2 */ \
+ 1, /* swap */ \
+ 1, /* iadd */ \
+ 1, /* ladd */ \
+ 1, /* fadd */ \
+ 1, /* dadd */ \
+ 1, /* isub */ \
+ 1, /* lsub */ \
+ 1, /* fsub */ \
+ 1, /* dsub */ \
+ 1, /* imul */ \
+ 1, /* lmul */ \
+ 1, /* fmul */ \
+ 1, /* dmul */ \
+ 1, /* idiv */ \
+ 1, /* ldiv */ \
+ 1, /* fdiv */ \
+ 1, /* ddiv */ \
+ 1, /* irem */ \
+ 1, /* lrem */ \
+ 1, /* frem */ \
+ 1, /* drem */ \
+ 1, /* ineg */ \
+ 1, /* lneg */ \
+ 1, /* fneg */ \
+ 1, /* dneg */ \
+ 1, /* ishl */ \
+ 1, /* lshl */ \
+ 1, /* ishr */ \
+ 1, /* lshr */ \
+ 1, /* iushr */ \
+ 1, /* lushr */ \
+ 1, /* iand */ \
+ 1, /* land */ \
+ 1, /* ior */ \
+ 1, /* lor */ \
+ 1, /* ixor */ \
+ 1, /* lxor */ \
+ 3, /* iinc */ \
+ 1, /* i2l */ \
+ 1, /* i2f */ \
+ 1, /* i2d */ \
+ 1, /* l2i */ \
+ 1, /* l2f */ \
+ 1, /* l2d */ \
+ 1, /* f2i */ \
+ 1, /* f2l */ \
+ 1, /* f2d */ \
+ 1, /* d2i */ \
+ 1, /* d2l */ \
+ 1, /* d2f */ \
+ 1, /* i2b */ \
+ 1, /* i2c */ \
+ 1, /* i2s */ \
+ 1, /* lcmp */ \
+ 1, /* fcmpl */ \
+ 1, /* fcmpg */ \
+ 1, /* dcmpl */ \
+ 1, /* dcmpg */ \
+ 3, /* ifeq */ \
+ 3, /* ifne */ \
+ 3, /* iflt */ \
+ 3, /* ifge */ \
+ 3, /* ifgt */ \
+ 3, /* ifle */ \
+ 3, /* if_icmpeq */ \
+ 3, /* if_icmpne */ \
+ 3, /* if_icmplt */ \
+ 3, /* if_icmpge */ \
+ 3, /* if_icmpgt */ \
+ 3, /* if_icmple */ \
+ 3, /* if_acmpeq */ \
+ 3, /* if_acmpne */ \
+ 3, /* goto */ \
+ 3, /* jsr */ \
+ 2, /* ret */ \
+ 99, /* tableswitch */ \
+ 99, /* lookupswitch */ \
+ 1, /* ireturn */ \
+ 1, /* lreturn */ \
+ 1, /* freturn */ \
+ 1, /* dreturn */ \
+ 1, /* areturn */ \
+ 1, /* return */ \
+ 3, /* getstatic */ \
+ 3, /* putstatic */ \
+ 3, /* getfield */ \
+ 3, /* putfield */ \
+ 3, /* invokevirtual */ \
+ 3, /* invokespecial */ \
+ 3, /* invokestatic */ \
+ 5, /* invokeinterface */ \
+ 5, /* invokedynamic */ \
+ 3, /* new */ \
+ 2, /* newarray */ \
+ 3, /* anewarray */ \
+ 1, /* arraylength */ \
+ 1, /* athrow */ \
+ 3, /* checkcast */ \
+ 3, /* instanceof */ \
+ 1, /* monitorenter */ \
+ 1, /* monitorexit */ \
+ 0, /* wide */ \
+ 4, /* multianewarray */ \
+ 3, /* ifnull */ \
+ 3, /* ifnonnull */ \
+ 5, /* goto_w */ \
+ 5 /* jsr_w */ \
+}
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* CLASSFILE_CONSTANTS */
diff --git a/staging/linux-x86/include/jawt.h b/staging/linux-x86/include/jawt.h
new file mode 100644
index 0000000..e0f682f
--- /dev/null
+++ b/staging/linux-x86/include/jawt.h
@@ -0,0 +1,299 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _JAVASOFT_JAWT_H_
+#define _JAVASOFT_JAWT_H_
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * AWT native interface (new in JDK 1.3)
+ *
+ * The AWT native interface allows a native C or C++ application a means
+ * by which to access native structures in AWT. This is to facilitate moving
+ * legacy C and C++ applications to Java and to target the needs of the
+ * community who, at present, wish to do their own native rendering to canvases
+ * for performance reasons. Standard extensions such as Java3D also require a
+ * means to access the underlying native data structures of AWT.
+ *
+ * There may be future extensions to this API depending on demand.
+ *
+ * A VM does not have to implement this API in order to pass the JCK.
+ * It is recommended, however, that this API is implemented on VMs that support
+ * standard extensions, such as Java3D.
+ *
+ * Since this is a native API, any program which uses it cannot be considered
+ * 100% pure java.
+ */
+
+/*
+ * AWT Native Drawing Surface (JAWT_DrawingSurface).
+ *
+ * For each platform, there is a native drawing surface structure. This
+ * platform-specific structure can be found in jawt_md.h. It is recommended
+ * that additional platforms follow the same model. It is also recommended
+ * that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
+ *
+ *******************
+ * EXAMPLE OF USAGE:
+ *******************
+ *
+ * In Win32, a programmer wishes to access the HWND of a canvas to perform
+ * native rendering into it. The programmer has declared the paint() method
+ * for their canvas subclass to be native:
+ *
+ *
+ * MyCanvas.java:
+ *
+ * import java.awt.*;
+ *
+ * public class MyCanvas extends Canvas {
+ *
+ * static {
+ * System.loadLibrary("mylib");
+ * }
+ *
+ * public native void paint(Graphics g);
+ * }
+ *
+ *
+ * myfile.c:
+ *
+ * #include "jawt_md.h"
+ * #include <assert.h>
+ *
+ * JNIEXPORT void JNICALL
+ * Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
+ * {
+ * JAWT awt;
+ * JAWT_DrawingSurface* ds;
+ * JAWT_DrawingSurfaceInfo* dsi;
+ * JAWT_Win32DrawingSurfaceInfo* dsi_win;
+ * jboolean result;
+ * jint lock;
+ *
+ * // Get the AWT
+ * awt.version = JAWT_VERSION_1_3;
+ * result = JAWT_GetAWT(env, &awt);
+ * assert(result != JNI_FALSE);
+ *
+ * // Get the drawing surface
+ * ds = awt.GetDrawingSurface(env, canvas);
+ * assert(ds != NULL);
+ *
+ * // Lock the drawing surface
+ * lock = ds->Lock(ds);
+ * assert((lock & JAWT_LOCK_ERROR) == 0);
+ *
+ * // Get the drawing surface info
+ * dsi = ds->GetDrawingSurfaceInfo(ds);
+ *
+ * // Get the platform-specific drawing info
+ * dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
+ *
+ * //////////////////////////////
+ * // !!! DO PAINTING HERE !!! //
+ * //////////////////////////////
+ *
+ * // Free the drawing surface info
+ * ds->FreeDrawingSurfaceInfo(dsi);
+ *
+ * // Unlock the drawing surface
+ * ds->Unlock(ds);
+ *
+ * // Free the drawing surface
+ * awt.FreeDrawingSurface(ds);
+ * }
+ *
+ */
+
+/*
+ * JAWT_Rectangle
+ * Structure for a native rectangle.
+ */
+typedef struct jawt_Rectangle {
+ jint x;
+ jint y;
+ jint width;
+ jint height;
+} JAWT_Rectangle;
+
+struct jawt_DrawingSurface;
+
+/*
+ * JAWT_DrawingSurfaceInfo
+ * Structure for containing the underlying drawing information of a component.
+ */
+typedef struct jawt_DrawingSurfaceInfo {
+ /*
+ * Pointer to the platform-specific information. This can be safely
+ * cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
+ * JAWT_X11DrawingSurfaceInfo on Solaris. On Mac OS X this is a
+ * pointer to a NSObject that conforms to the JAWT_SurfaceLayers
+ * protocol. See jawt_md.h for details.
+ */
+ void* platformInfo;
+ /* Cached pointer to the underlying drawing surface */
+ struct jawt_DrawingSurface* ds;
+ /* Bounding rectangle of the drawing surface */
+ JAWT_Rectangle bounds;
+ /* Number of rectangles in the clip */
+ jint clipSize;
+ /* Clip rectangle array */
+ JAWT_Rectangle* clip;
+} JAWT_DrawingSurfaceInfo;
+
+#define JAWT_LOCK_ERROR 0x00000001
+#define JAWT_LOCK_CLIP_CHANGED 0x00000002
+#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
+#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
+
+/*
+ * JAWT_DrawingSurface
+ * Structure for containing the underlying drawing information of a component.
+ * All operations on a JAWT_DrawingSurface MUST be performed from the same
+ * thread as the call to GetDrawingSurface.
+ */
+typedef struct jawt_DrawingSurface {
+ /*
+ * Cached reference to the Java environment of the calling thread.
+ * If Lock(), Unlock(), GetDrawingSurfaceInfo() or
+ * FreeDrawingSurfaceInfo() are called from a different thread,
+ * this data member should be set before calling those functions.
+ */
+ JNIEnv* env;
+ /* Cached reference to the target object */
+ jobject target;
+ /*
+ * Lock the surface of the target component for native rendering.
+ * When finished drawing, the surface must be unlocked with
+ * Unlock(). This function returns a bitmask with one or more of the
+ * following values:
+ *
+ * JAWT_LOCK_ERROR - When an error has occurred and the surface could not
+ * be locked.
+ *
+ * JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
+ *
+ * JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
+ *
+ * JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
+ */
+ jint (JNICALL *Lock)
+ (struct jawt_DrawingSurface* ds);
+ /*
+ * Get the drawing surface info.
+ * The value returned may be cached, but the values may change if
+ * additional calls to Lock() or Unlock() are made.
+ * Lock() must be called before this can return a valid value.
+ * Returns NULL if an error has occurred.
+ * When finished with the returned value, FreeDrawingSurfaceInfo must be
+ * called.
+ */
+ JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
+ (struct jawt_DrawingSurface* ds);
+ /*
+ * Free the drawing surface info.
+ */
+ void (JNICALL *FreeDrawingSurfaceInfo)
+ (JAWT_DrawingSurfaceInfo* dsi);
+ /*
+ * Unlock the drawing surface of the target component for native rendering.
+ */
+ void (JNICALL *Unlock)
+ (struct jawt_DrawingSurface* ds);
+} JAWT_DrawingSurface;
+
+/*
+ * JAWT
+ * Structure for containing native AWT functions.
+ */
+typedef struct jawt {
+ /*
+ * Version of this structure. This must always be set before
+ * calling JAWT_GetAWT()
+ */
+ jint version;
+ /*
+ * Return a drawing surface from a target jobject. This value
+ * may be cached.
+ * Returns NULL if an error has occurred.
+ * Target must be a java.awt.Component (should be a Canvas
+ * or Window for native rendering).
+ * FreeDrawingSurface() must be called when finished with the
+ * returned JAWT_DrawingSurface.
+ */
+ JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
+ (JNIEnv* env, jobject target);
+ /*
+ * Free the drawing surface allocated in GetDrawingSurface.
+ */
+ void (JNICALL *FreeDrawingSurface)
+ (JAWT_DrawingSurface* ds);
+ /*
+ * Since 1.4
+ * Locks the entire AWT for synchronization purposes
+ */
+ void (JNICALL *Lock)(JNIEnv* env);
+ /*
+ * Since 1.4
+ * Unlocks the entire AWT for synchronization purposes
+ */
+ void (JNICALL *Unlock)(JNIEnv* env);
+ /*
+ * Since 1.4
+ * Returns a reference to a java.awt.Component from a native
+ * platform handle. On Windows, this corresponds to an HWND;
+ * on Solaris and Linux, this is a Drawable. For other platforms,
+ * see the appropriate machine-dependent header file for a description.
+ * The reference returned by this function is a local
+ * reference that is only valid in this environment.
+ * This function returns a NULL reference if no component could be
+ * found with matching platform information.
+ */
+ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
+
+} JAWT;
+
+/*
+ * Get the AWT native structure. This function returns JNI_FALSE if
+ * an error occurs.
+ */
+_JNI_IMPORT_OR_EXPORT_
+jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
+
+#define JAWT_VERSION_1_3 0x00010003
+#define JAWT_VERSION_1_4 0x00010004
+#define JAWT_VERSION_1_7 0x00010007
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* !_JAVASOFT_JAWT_H_ */
diff --git a/staging/linux-x86/include/jdwpTransport.h b/staging/linux-x86/include/jdwpTransport.h
new file mode 100644
index 0000000..32ccdea
--- /dev/null
+++ b/staging/linux-x86/include/jdwpTransport.h
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Java Debug Wire Protocol Transport Service Provider Interface.
+ */
+
+#ifndef JDWPTRANSPORT_H
+#define JDWPTRANSPORT_H
+
+#include "jni.h"
+
+enum {
+ JDWPTRANSPORT_VERSION_1_0 = 0x00010000
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct jdwpTransportNativeInterface_;
+
+struct _jdwpTransportEnv;
+
+#ifdef __cplusplus
+typedef _jdwpTransportEnv jdwpTransportEnv;
+#else
+typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
+#endif /* __cplusplus */
+
+/*
+ * Errors. Universal errors with JVMTI/JVMDI equivalents keep the
+ * values the same.
+ */
+typedef enum {
+ JDWPTRANSPORT_ERROR_NONE = 0,
+ JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
+ JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
+ JDWPTRANSPORT_ERROR_INTERNAL = 113,
+ JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
+ JDWPTRANSPORT_ERROR_IO_ERROR = 202,
+ JDWPTRANSPORT_ERROR_TIMEOUT = 203,
+ JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
+} jdwpTransportError;
+
+
+/*
+ * Structure to define capabilities
+ */
+typedef struct {
+ unsigned int can_timeout_attach :1;
+ unsigned int can_timeout_accept :1;
+ unsigned int can_timeout_handshake :1;
+ unsigned int reserved3 :1;
+ unsigned int reserved4 :1;
+ unsigned int reserved5 :1;
+ unsigned int reserved6 :1;
+ unsigned int reserved7 :1;
+ unsigned int reserved8 :1;
+ unsigned int reserved9 :1;
+ unsigned int reserved10 :1;
+ unsigned int reserved11 :1;
+ unsigned int reserved12 :1;
+ unsigned int reserved13 :1;
+ unsigned int reserved14 :1;
+ unsigned int reserved15 :1;
+} JDWPTransportCapabilities;
+
+
+/*
+ * Structures to define packet layout.
+ *
+ * See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
+ */
+
+enum {
+ /*
+ * If additional flags are added that apply to jdwpCmdPacket,
+ * then debugLoop.c: reader() will need to be updated to
+ * accept more than JDWPTRANSPORT_FLAGS_NONE.
+ */
+ JDWPTRANSPORT_FLAGS_NONE = 0x0,
+ JDWPTRANSPORT_FLAGS_REPLY = 0x80
+};
+
+typedef struct {
+ jint len;
+ jint id;
+ jbyte flags;
+ jbyte cmdSet;
+ jbyte cmd;
+ jbyte *data;
+} jdwpCmdPacket;
+
+typedef struct {
+ jint len;
+ jint id;
+ jbyte flags;
+ jshort errorCode;
+ jbyte *data;
+} jdwpReplyPacket;
+
+typedef struct {
+ union {
+ jdwpCmdPacket cmd;
+ jdwpReplyPacket reply;
+ } type;
+} jdwpPacket;
+
+/*
+ * JDWP functions called by the transport.
+ */
+typedef struct jdwpTransportCallback {
+ void *(*alloc)(jint numBytes); /* Call this for all allocations */
+ void (*free)(void *buffer); /* Call this for all deallocations */
+} jdwpTransportCallback;
+
+typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
+ jdwpTransportCallback *callback,
+ jint version,
+ jdwpTransportEnv** env);
+
+
+
+/* Function Interface */
+
+struct jdwpTransportNativeInterface_ {
+ /* 1 : RESERVED */
+ void *reserved1;
+
+ /* 2 : Get Capabilities */
+ jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
+ JDWPTransportCapabilities *capabilities_ptr);
+
+ /* 3 : Attach */
+ jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
+ const char* address,
+ jlong attach_timeout,
+ jlong handshake_timeout);
+
+ /* 4: StartListening */
+ jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
+ const char* address,
+ char** actual_address);
+
+ /* 5: StopListening */
+ jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
+
+ /* 6: Accept */
+ jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
+ jlong accept_timeout,
+ jlong handshake_timeout);
+
+ /* 7: IsOpen */
+ jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
+
+ /* 8: Close */
+ jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
+
+ /* 9: ReadPacket */
+ jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
+ jdwpPacket *pkt);
+
+ /* 10: Write Packet */
+ jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
+ const jdwpPacket* pkt);
+
+ /* 11: GetLastError */
+ jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
+ char** error);
+
+};
+
+
+/*
+ * Use inlined functions so that C++ code can use syntax such as
+ * env->Attach("mymachine:5000", 10*1000, 0);
+ *
+ * rather than using C's :-
+ *
+ * (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
+ */
+struct _jdwpTransportEnv {
+ const struct jdwpTransportNativeInterface_ *functions;
+#ifdef __cplusplus
+
+ jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
+ return functions->GetCapabilities(this, capabilities_ptr);
+ }
+
+ jdwpTransportError Attach(const char* address, jlong attach_timeout,
+ jlong handshake_timeout) {
+ return functions->Attach(this, address, attach_timeout, handshake_timeout);
+ }
+
+ jdwpTransportError StartListening(const char* address,
+ char** actual_address) {
+ return functions->StartListening(this, address, actual_address);
+ }
+
+ jdwpTransportError StopListening(void) {
+ return functions->StopListening(this);
+ }
+
+ jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
+ return functions->Accept(this, accept_timeout, handshake_timeout);
+ }
+
+ jboolean IsOpen(void) {
+ return functions->IsOpen(this);
+ }
+
+ jdwpTransportError Close(void) {
+ return functions->Close(this);
+ }
+
+ jdwpTransportError ReadPacket(jdwpPacket *pkt) {
+ return functions->ReadPacket(this, pkt);
+ }
+
+ jdwpTransportError WritePacket(const jdwpPacket* pkt) {
+ return functions->WritePacket(this, pkt);
+ }
+
+ jdwpTransportError GetLastError(char** error) {
+ return functions->GetLastError(this, error);
+ }
+
+
+#endif /* __cplusplus */
+};
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* JDWPTRANSPORT_H */
diff --git a/staging/linux-x86/include/jni.h b/staging/linux-x86/include/jni.h
new file mode 100644
index 0000000..2e83cb7
--- /dev/null
+++ b/staging/linux-x86/include/jni.h
@@ -0,0 +1,1960 @@
+/*
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * We used part of Netscape's Java Runtime Interface (JRI) as the starting
+ * point of our design and implementation.
+ */
+
+/******************************************************************************
+ * Java Runtime Interface
+ * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
+ *****************************************************************************/
+
+#ifndef _JAVASOFT_JNI_H_
+#define _JAVASOFT_JNI_H_
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/* jni_md.h contains the machine-dependent typedefs for jbyte, jint
+ and jlong */
+
+#include "jni_md.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * JNI Types
+ */
+
+#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H
+
+typedef unsigned char jboolean;
+typedef unsigned short jchar;
+typedef short jshort;
+typedef float jfloat;
+typedef double jdouble;
+
+typedef jint jsize;
+
+#ifdef __cplusplus
+
+class _jobject {};
+class _jclass : public _jobject {};
+class _jthrowable : public _jobject {};
+class _jstring : public _jobject {};
+class _jarray : public _jobject {};
+class _jbooleanArray : public _jarray {};
+class _jbyteArray : public _jarray {};
+class _jcharArray : public _jarray {};
+class _jshortArray : public _jarray {};
+class _jintArray : public _jarray {};
+class _jlongArray : public _jarray {};
+class _jfloatArray : public _jarray {};
+class _jdoubleArray : public _jarray {};
+class _jobjectArray : public _jarray {};
+
+typedef _jobject *jobject;
+typedef _jclass *jclass;
+typedef _jthrowable *jthrowable;
+typedef _jstring *jstring;
+typedef _jarray *jarray;
+typedef _jbooleanArray *jbooleanArray;
+typedef _jbyteArray *jbyteArray;
+typedef _jcharArray *jcharArray;
+typedef _jshortArray *jshortArray;
+typedef _jintArray *jintArray;
+typedef _jlongArray *jlongArray;
+typedef _jfloatArray *jfloatArray;
+typedef _jdoubleArray *jdoubleArray;
+typedef _jobjectArray *jobjectArray;
+
+#else
+
+struct _jobject;
+
+typedef struct _jobject *jobject;
+typedef jobject jclass;
+typedef jobject jthrowable;
+typedef jobject jstring;
+typedef jobject jarray;
+typedef jarray jbooleanArray;
+typedef jarray jbyteArray;
+typedef jarray jcharArray;
+typedef jarray jshortArray;
+typedef jarray jintArray;
+typedef jarray jlongArray;
+typedef jarray jfloatArray;
+typedef jarray jdoubleArray;
+typedef jarray jobjectArray;
+
+#endif
+
+typedef jobject jweak;
+
+typedef union jvalue {
+ jboolean z;
+ jbyte b;
+ jchar c;
+ jshort s;
+ jint i;
+ jlong j;
+ jfloat f;
+ jdouble d;
+ jobject l;
+} jvalue;
+
+struct _jfieldID;
+typedef struct _jfieldID *jfieldID;
+
+struct _jmethodID;
+typedef struct _jmethodID *jmethodID;
+
+/* Return values from jobjectRefType */
+typedef enum _jobjectType {
+ JNIInvalidRefType = 0,
+ JNILocalRefType = 1,
+ JNIGlobalRefType = 2,
+ JNIWeakGlobalRefType = 3
+} jobjectRefType;
+
+
+#endif /* JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H */
+
+/*
+ * jboolean constants
+ */
+
+#define JNI_FALSE 0
+#define JNI_TRUE 1
+
+/*
+ * possible return values for JNI functions.
+ */
+
+#define JNI_OK 0 /* success */
+#define JNI_ERR (-1) /* unknown error */
+#define JNI_EDETACHED (-2) /* thread detached from the VM */
+#define JNI_EVERSION (-3) /* JNI version error */
+#define JNI_ENOMEM (-4) /* not enough memory */
+#define JNI_EEXIST (-5) /* VM already created */
+#define JNI_EINVAL (-6) /* invalid arguments */
+
+/*
+ * used in ReleaseScalarArrayElements
+ */
+
+#define JNI_COMMIT 1
+#define JNI_ABORT 2
+
+/*
+ * used in RegisterNatives to describe native method name, signature,
+ * and function pointer.
+ */
+
+typedef struct {
+ char *name;
+ char *signature;
+ void *fnPtr;
+} JNINativeMethod;
+
+/*
+ * JNI Native Method Interface.
+ */
+
+struct JNINativeInterface_;
+
+struct JNIEnv_;
+
+#ifdef __cplusplus
+typedef JNIEnv_ JNIEnv;
+#else
+typedef const struct JNINativeInterface_ *JNIEnv;
+#endif
+
+/*
+ * JNI Invocation Interface.
+ */
+
+struct JNIInvokeInterface_;
+
+struct JavaVM_;
+
+#ifdef __cplusplus
+typedef JavaVM_ JavaVM;
+#else
+typedef const struct JNIInvokeInterface_ *JavaVM;
+#endif
+
+struct JNINativeInterface_ {
+ void *reserved0;
+ void *reserved1;
+ void *reserved2;
+
+ void *reserved3;
+ jint (JNICALL *GetVersion)(JNIEnv *env);
+
+ jclass (JNICALL *DefineClass)
+ (JNIEnv *env, const char *name, jobject loader, const jbyte *buf,
+ jsize len);
+ jclass (JNICALL *FindClass)
+ (JNIEnv *env, const char *name);
+
+ jmethodID (JNICALL *FromReflectedMethod)
+ (JNIEnv *env, jobject method);
+ jfieldID (JNICALL *FromReflectedField)
+ (JNIEnv *env, jobject field);
+
+ jobject (JNICALL *ToReflectedMethod)
+ (JNIEnv *env, jclass cls, jmethodID methodID, jboolean isStatic);
+
+ jclass (JNICALL *GetSuperclass)
+ (JNIEnv *env, jclass sub);
+ jboolean (JNICALL *IsAssignableFrom)
+ (JNIEnv *env, jclass sub, jclass sup);
+
+ jobject (JNICALL *ToReflectedField)
+ (JNIEnv *env, jclass cls, jfieldID fieldID, jboolean isStatic);
+
+ jint (JNICALL *Throw)
+ (JNIEnv *env, jthrowable obj);
+ jint (JNICALL *ThrowNew)
+ (JNIEnv *env, jclass clazz, const char *msg);
+ jthrowable (JNICALL *ExceptionOccurred)
+ (JNIEnv *env);
+ void (JNICALL *ExceptionDescribe)
+ (JNIEnv *env);
+ void (JNICALL *ExceptionClear)
+ (JNIEnv *env);
+ void (JNICALL *FatalError)
+ (JNIEnv *env, const char *msg);
+
+ jint (JNICALL *PushLocalFrame)
+ (JNIEnv *env, jint capacity);
+ jobject (JNICALL *PopLocalFrame)
+ (JNIEnv *env, jobject result);
+
+ jobject (JNICALL *NewGlobalRef)
+ (JNIEnv *env, jobject lobj);
+ void (JNICALL *DeleteGlobalRef)
+ (JNIEnv *env, jobject gref);
+ void (JNICALL *DeleteLocalRef)
+ (JNIEnv *env, jobject obj);
+ jboolean (JNICALL *IsSameObject)
+ (JNIEnv *env, jobject obj1, jobject obj2);
+ jobject (JNICALL *NewLocalRef)
+ (JNIEnv *env, jobject ref);
+ jint (JNICALL *EnsureLocalCapacity)
+ (JNIEnv *env, jint capacity);
+
+ jobject (JNICALL *AllocObject)
+ (JNIEnv *env, jclass clazz);
+ jobject (JNICALL *NewObject)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *NewObjectV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jobject (JNICALL *NewObjectA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jclass (JNICALL *GetObjectClass)
+ (JNIEnv *env, jobject obj);
+ jboolean (JNICALL *IsInstanceOf)
+ (JNIEnv *env, jobject obj, jclass clazz);
+
+ jmethodID (JNICALL *GetMethodID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *CallObjectMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jobject (JNICALL *CallObjectMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jobject (JNICALL *CallObjectMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jboolean (JNICALL *CallBooleanMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jboolean (JNICALL *CallBooleanMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jboolean (JNICALL *CallBooleanMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jbyte (JNICALL *CallByteMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jbyte (JNICALL *CallByteMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jbyte (JNICALL *CallByteMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jchar (JNICALL *CallCharMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jchar (JNICALL *CallCharMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jchar (JNICALL *CallCharMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jshort (JNICALL *CallShortMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jshort (JNICALL *CallShortMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jshort (JNICALL *CallShortMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jint (JNICALL *CallIntMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jint (JNICALL *CallIntMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jint (JNICALL *CallIntMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jlong (JNICALL *CallLongMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jlong (JNICALL *CallLongMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jlong (JNICALL *CallLongMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jfloat (JNICALL *CallFloatMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jfloat (JNICALL *CallFloatMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jfloat (JNICALL *CallFloatMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ jdouble (JNICALL *CallDoubleMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ jdouble (JNICALL *CallDoubleMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ jdouble (JNICALL *CallDoubleMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue *args);
+
+ void (JNICALL *CallVoidMethod)
+ (JNIEnv *env, jobject obj, jmethodID methodID, ...);
+ void (JNICALL *CallVoidMethodV)
+ (JNIEnv *env, jobject obj, jmethodID methodID, va_list args);
+ void (JNICALL *CallVoidMethodA)
+ (JNIEnv *env, jobject obj, jmethodID methodID, const jvalue * args);
+
+ jobject (JNICALL *CallNonvirtualObjectMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *CallNonvirtualObjectMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jobject (JNICALL *CallNonvirtualObjectMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jboolean (JNICALL *CallNonvirtualBooleanMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jboolean (JNICALL *CallNonvirtualBooleanMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jbyte (JNICALL *CallNonvirtualByteMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jbyte (JNICALL *CallNonvirtualByteMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jbyte (JNICALL *CallNonvirtualByteMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jchar (JNICALL *CallNonvirtualCharMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jchar (JNICALL *CallNonvirtualCharMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jchar (JNICALL *CallNonvirtualCharMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jshort (JNICALL *CallNonvirtualShortMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jshort (JNICALL *CallNonvirtualShortMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jshort (JNICALL *CallNonvirtualShortMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jint (JNICALL *CallNonvirtualIntMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jint (JNICALL *CallNonvirtualIntMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jint (JNICALL *CallNonvirtualIntMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jlong (JNICALL *CallNonvirtualLongMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jlong (JNICALL *CallNonvirtualLongMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jlong (JNICALL *CallNonvirtualLongMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jfloat (JNICALL *CallNonvirtualFloatMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jfloat (JNICALL *CallNonvirtualFloatMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jfloat (JNICALL *CallNonvirtualFloatMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ jdouble (JNICALL *CallNonvirtualDoubleMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ jdouble (JNICALL *CallNonvirtualDoubleMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue *args);
+
+ void (JNICALL *CallNonvirtualVoidMethod)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID, ...);
+ void (JNICALL *CallNonvirtualVoidMethodV)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ va_list args);
+ void (JNICALL *CallNonvirtualVoidMethodA)
+ (JNIEnv *env, jobject obj, jclass clazz, jmethodID methodID,
+ const jvalue * args);
+
+ jfieldID (JNICALL *GetFieldID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *GetObjectField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jboolean (JNICALL *GetBooleanField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jbyte (JNICALL *GetByteField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jchar (JNICALL *GetCharField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jshort (JNICALL *GetShortField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jint (JNICALL *GetIntField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jlong (JNICALL *GetLongField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jfloat (JNICALL *GetFloatField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+ jdouble (JNICALL *GetDoubleField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID);
+
+ void (JNICALL *SetObjectField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jobject val);
+ void (JNICALL *SetBooleanField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jboolean val);
+ void (JNICALL *SetByteField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jbyte val);
+ void (JNICALL *SetCharField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jchar val);
+ void (JNICALL *SetShortField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jshort val);
+ void (JNICALL *SetIntField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jint val);
+ void (JNICALL *SetLongField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jlong val);
+ void (JNICALL *SetFloatField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jfloat val);
+ void (JNICALL *SetDoubleField)
+ (JNIEnv *env, jobject obj, jfieldID fieldID, jdouble val);
+
+ jmethodID (JNICALL *GetStaticMethodID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+
+ jobject (JNICALL *CallStaticObjectMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jobject (JNICALL *CallStaticObjectMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jobject (JNICALL *CallStaticObjectMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jboolean (JNICALL *CallStaticBooleanMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jboolean (JNICALL *CallStaticBooleanMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jboolean (JNICALL *CallStaticBooleanMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jbyte (JNICALL *CallStaticByteMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jbyte (JNICALL *CallStaticByteMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jbyte (JNICALL *CallStaticByteMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jchar (JNICALL *CallStaticCharMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jchar (JNICALL *CallStaticCharMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jchar (JNICALL *CallStaticCharMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jshort (JNICALL *CallStaticShortMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jshort (JNICALL *CallStaticShortMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jshort (JNICALL *CallStaticShortMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jint (JNICALL *CallStaticIntMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jint (JNICALL *CallStaticIntMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jint (JNICALL *CallStaticIntMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jlong (JNICALL *CallStaticLongMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jlong (JNICALL *CallStaticLongMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jlong (JNICALL *CallStaticLongMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jfloat (JNICALL *CallStaticFloatMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jfloat (JNICALL *CallStaticFloatMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jfloat (JNICALL *CallStaticFloatMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ jdouble (JNICALL *CallStaticDoubleMethod)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, ...);
+ jdouble (JNICALL *CallStaticDoubleMethodV)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, va_list args);
+ jdouble (JNICALL *CallStaticDoubleMethodA)
+ (JNIEnv *env, jclass clazz, jmethodID methodID, const jvalue *args);
+
+ void (JNICALL *CallStaticVoidMethod)
+ (JNIEnv *env, jclass cls, jmethodID methodID, ...);
+ void (JNICALL *CallStaticVoidMethodV)
+ (JNIEnv *env, jclass cls, jmethodID methodID, va_list args);
+ void (JNICALL *CallStaticVoidMethodA)
+ (JNIEnv *env, jclass cls, jmethodID methodID, const jvalue * args);
+
+ jfieldID (JNICALL *GetStaticFieldID)
+ (JNIEnv *env, jclass clazz, const char *name, const char *sig);
+ jobject (JNICALL *GetStaticObjectField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jboolean (JNICALL *GetStaticBooleanField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jbyte (JNICALL *GetStaticByteField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jchar (JNICALL *GetStaticCharField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jshort (JNICALL *GetStaticShortField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jint (JNICALL *GetStaticIntField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jlong (JNICALL *GetStaticLongField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jfloat (JNICALL *GetStaticFloatField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+ jdouble (JNICALL *GetStaticDoubleField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID);
+
+ void (JNICALL *SetStaticObjectField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jobject value);
+ void (JNICALL *SetStaticBooleanField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jboolean value);
+ void (JNICALL *SetStaticByteField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jbyte value);
+ void (JNICALL *SetStaticCharField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jchar value);
+ void (JNICALL *SetStaticShortField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jshort value);
+ void (JNICALL *SetStaticIntField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jint value);
+ void (JNICALL *SetStaticLongField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jlong value);
+ void (JNICALL *SetStaticFloatField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jfloat value);
+ void (JNICALL *SetStaticDoubleField)
+ (JNIEnv *env, jclass clazz, jfieldID fieldID, jdouble value);
+
+ jstring (JNICALL *NewString)
+ (JNIEnv *env, const jchar *unicode, jsize len);
+ jsize (JNICALL *GetStringLength)
+ (JNIEnv *env, jstring str);
+ const jchar *(JNICALL *GetStringChars)
+ (JNIEnv *env, jstring str, jboolean *isCopy);
+ void (JNICALL *ReleaseStringChars)
+ (JNIEnv *env, jstring str, const jchar *chars);
+
+ jstring (JNICALL *NewStringUTF)
+ (JNIEnv *env, const char *utf);
+ jsize (JNICALL *GetStringUTFLength)
+ (JNIEnv *env, jstring str);
+ const char* (JNICALL *GetStringUTFChars)
+ (JNIEnv *env, jstring str, jboolean *isCopy);
+ void (JNICALL *ReleaseStringUTFChars)
+ (JNIEnv *env, jstring str, const char* chars);
+
+
+ jsize (JNICALL *GetArrayLength)
+ (JNIEnv *env, jarray array);
+
+ jobjectArray (JNICALL *NewObjectArray)
+ (JNIEnv *env, jsize len, jclass clazz, jobject init);
+ jobject (JNICALL *GetObjectArrayElement)
+ (JNIEnv *env, jobjectArray array, jsize index);
+ void (JNICALL *SetObjectArrayElement)
+ (JNIEnv *env, jobjectArray array, jsize index, jobject val);
+
+ jbooleanArray (JNICALL *NewBooleanArray)
+ (JNIEnv *env, jsize len);
+ jbyteArray (JNICALL *NewByteArray)
+ (JNIEnv *env, jsize len);
+ jcharArray (JNICALL *NewCharArray)
+ (JNIEnv *env, jsize len);
+ jshortArray (JNICALL *NewShortArray)
+ (JNIEnv *env, jsize len);
+ jintArray (JNICALL *NewIntArray)
+ (JNIEnv *env, jsize len);
+ jlongArray (JNICALL *NewLongArray)
+ (JNIEnv *env, jsize len);
+ jfloatArray (JNICALL *NewFloatArray)
+ (JNIEnv *env, jsize len);
+ jdoubleArray (JNICALL *NewDoubleArray)
+ (JNIEnv *env, jsize len);
+
+ jboolean * (JNICALL *GetBooleanArrayElements)
+ (JNIEnv *env, jbooleanArray array, jboolean *isCopy);
+ jbyte * (JNICALL *GetByteArrayElements)
+ (JNIEnv *env, jbyteArray array, jboolean *isCopy);
+ jchar * (JNICALL *GetCharArrayElements)
+ (JNIEnv *env, jcharArray array, jboolean *isCopy);
+ jshort * (JNICALL *GetShortArrayElements)
+ (JNIEnv *env, jshortArray array, jboolean *isCopy);
+ jint * (JNICALL *GetIntArrayElements)
+ (JNIEnv *env, jintArray array, jboolean *isCopy);
+ jlong * (JNICALL *GetLongArrayElements)
+ (JNIEnv *env, jlongArray array, jboolean *isCopy);
+ jfloat * (JNICALL *GetFloatArrayElements)
+ (JNIEnv *env, jfloatArray array, jboolean *isCopy);
+ jdouble * (JNICALL *GetDoubleArrayElements)
+ (JNIEnv *env, jdoubleArray array, jboolean *isCopy);
+
+ void (JNICALL *ReleaseBooleanArrayElements)
+ (JNIEnv *env, jbooleanArray array, jboolean *elems, jint mode);
+ void (JNICALL *ReleaseByteArrayElements)
+ (JNIEnv *env, jbyteArray array, jbyte *elems, jint mode);
+ void (JNICALL *ReleaseCharArrayElements)
+ (JNIEnv *env, jcharArray array, jchar *elems, jint mode);
+ void (JNICALL *ReleaseShortArrayElements)
+ (JNIEnv *env, jshortArray array, jshort *elems, jint mode);
+ void (JNICALL *ReleaseIntArrayElements)
+ (JNIEnv *env, jintArray array, jint *elems, jint mode);
+ void (JNICALL *ReleaseLongArrayElements)
+ (JNIEnv *env, jlongArray array, jlong *elems, jint mode);
+ void (JNICALL *ReleaseFloatArrayElements)
+ (JNIEnv *env, jfloatArray array, jfloat *elems, jint mode);
+ void (JNICALL *ReleaseDoubleArrayElements)
+ (JNIEnv *env, jdoubleArray array, jdouble *elems, jint mode);
+
+ void (JNICALL *GetBooleanArrayRegion)
+ (JNIEnv *env, jbooleanArray array, jsize start, jsize l, jboolean *buf);
+ void (JNICALL *GetByteArrayRegion)
+ (JNIEnv *env, jbyteArray array, jsize start, jsize len, jbyte *buf);
+ void (JNICALL *GetCharArrayRegion)
+ (JNIEnv *env, jcharArray array, jsize start, jsize len, jchar *buf);
+ void (JNICALL *GetShortArrayRegion)
+ (JNIEnv *env, jshortArray array, jsize start, jsize len, jshort *buf);
+ void (JNICALL *GetIntArrayRegion)
+ (JNIEnv *env, jintArray array, jsize start, jsize len, jint *buf);
+ void (JNICALL *GetLongArrayRegion)
+ (JNIEnv *env, jlongArray array, jsize start, jsize len, jlong *buf);
+ void (JNICALL *GetFloatArrayRegion)
+ (JNIEnv *env, jfloatArray array, jsize start, jsize len, jfloat *buf);
+ void (JNICALL *GetDoubleArrayRegion)
+ (JNIEnv *env, jdoubleArray array, jsize start, jsize len, jdouble *buf);
+
+ void (JNICALL *SetBooleanArrayRegion)
+ (JNIEnv *env, jbooleanArray array, jsize start, jsize l, const jboolean *buf);
+ void (JNICALL *SetByteArrayRegion)
+ (JNIEnv *env, jbyteArray array, jsize start, jsize len, const jbyte *buf);
+ void (JNICALL *SetCharArrayRegion)
+ (JNIEnv *env, jcharArray array, jsize start, jsize len, const jchar *buf);
+ void (JNICALL *SetShortArrayRegion)
+ (JNIEnv *env, jshortArray array, jsize start, jsize len, const jshort *buf);
+ void (JNICALL *SetIntArrayRegion)
+ (JNIEnv *env, jintArray array, jsize start, jsize len, const jint *buf);
+ void (JNICALL *SetLongArrayRegion)
+ (JNIEnv *env, jlongArray array, jsize start, jsize len, const jlong *buf);
+ void (JNICALL *SetFloatArrayRegion)
+ (JNIEnv *env, jfloatArray array, jsize start, jsize len, const jfloat *buf);
+ void (JNICALL *SetDoubleArrayRegion)
+ (JNIEnv *env, jdoubleArray array, jsize start, jsize len, const jdouble *buf);
+
+ jint (JNICALL *RegisterNatives)
+ (JNIEnv *env, jclass clazz, const JNINativeMethod *methods,
+ jint nMethods);
+ jint (JNICALL *UnregisterNatives)
+ (JNIEnv *env, jclass clazz);
+
+ jint (JNICALL *MonitorEnter)
+ (JNIEnv *env, jobject obj);
+ jint (JNICALL *MonitorExit)
+ (JNIEnv *env, jobject obj);
+
+ jint (JNICALL *GetJavaVM)
+ (JNIEnv *env, JavaVM **vm);
+
+ void (JNICALL *GetStringRegion)
+ (JNIEnv *env, jstring str, jsize start, jsize len, jchar *buf);
+ void (JNICALL *GetStringUTFRegion)
+ (JNIEnv *env, jstring str, jsize start, jsize len, char *buf);
+
+ void * (JNICALL *GetPrimitiveArrayCritical)
+ (JNIEnv *env, jarray array, jboolean *isCopy);
+ void (JNICALL *ReleasePrimitiveArrayCritical)
+ (JNIEnv *env, jarray array, void *carray, jint mode);
+
+ const jchar * (JNICALL *GetStringCritical)
+ (JNIEnv *env, jstring string, jboolean *isCopy);
+ void (JNICALL *ReleaseStringCritical)
+ (JNIEnv *env, jstring string, const jchar *cstring);
+
+ jweak (JNICALL *NewWeakGlobalRef)
+ (JNIEnv *env, jobject obj);
+ void (JNICALL *DeleteWeakGlobalRef)
+ (JNIEnv *env, jweak ref);
+
+ jboolean (JNICALL *ExceptionCheck)
+ (JNIEnv *env);
+
+ jobject (JNICALL *NewDirectByteBuffer)
+ (JNIEnv* env, void* address, jlong capacity);
+ void* (JNICALL *GetDirectBufferAddress)
+ (JNIEnv* env, jobject buf);
+ jlong (JNICALL *GetDirectBufferCapacity)
+ (JNIEnv* env, jobject buf);
+
+ /* New JNI 1.6 Features */
+
+ jobjectRefType (JNICALL *GetObjectRefType)
+ (JNIEnv* env, jobject obj);
+};
+
+/*
+ * We use inlined functions for C++ so that programmers can write:
+ *
+ * env->FindClass("java/lang/String")
+ *
+ * in C++ rather than:
+ *
+ * (*env)->FindClass(env, "java/lang/String")
+ *
+ * in C.
+ */
+
+struct JNIEnv_ {
+ const struct JNINativeInterface_ *functions;
+#ifdef __cplusplus
+
+ jint GetVersion() {
+ return functions->GetVersion(this);
+ }
+ jclass DefineClass(const char *name, jobject loader, const jbyte *buf,
+ jsize len) {
+ return functions->DefineClass(this, name, loader, buf, len);
+ }
+ jclass FindClass(const char *name) {
+ return functions->FindClass(this, name);
+ }
+ jmethodID FromReflectedMethod(jobject method) {
+ return functions->FromReflectedMethod(this,method);
+ }
+ jfieldID FromReflectedField(jobject field) {
+ return functions->FromReflectedField(this,field);
+ }
+
+ jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic) {
+ return functions->ToReflectedMethod(this, cls, methodID, isStatic);
+ }
+
+ jclass GetSuperclass(jclass sub) {
+ return functions->GetSuperclass(this, sub);
+ }
+ jboolean IsAssignableFrom(jclass sub, jclass sup) {
+ return functions->IsAssignableFrom(this, sub, sup);
+ }
+
+ jobject ToReflectedField(jclass cls, jfieldID fieldID, jboolean isStatic) {
+ return functions->ToReflectedField(this,cls,fieldID,isStatic);
+ }
+
+ jint Throw(jthrowable obj) {
+ return functions->Throw(this, obj);
+ }
+ jint ThrowNew(jclass clazz, const char *msg) {
+ return functions->ThrowNew(this, clazz, msg);
+ }
+ jthrowable ExceptionOccurred() {
+ return functions->ExceptionOccurred(this);
+ }
+ void ExceptionDescribe() {
+ functions->ExceptionDescribe(this);
+ }
+ void ExceptionClear() {
+ functions->ExceptionClear(this);
+ }
+ void FatalError(const char *msg) {
+ functions->FatalError(this, msg);
+ }
+
+ jint PushLocalFrame(jint capacity) {
+ return functions->PushLocalFrame(this,capacity);
+ }
+ jobject PopLocalFrame(jobject result) {
+ return functions->PopLocalFrame(this,result);
+ }
+
+ jobject NewGlobalRef(jobject lobj) {
+ return functions->NewGlobalRef(this,lobj);
+ }
+ void DeleteGlobalRef(jobject gref) {
+ functions->DeleteGlobalRef(this,gref);
+ }
+ void DeleteLocalRef(jobject obj) {
+ functions->DeleteLocalRef(this, obj);
+ }
+
+ jboolean IsSameObject(jobject obj1, jobject obj2) {
+ return functions->IsSameObject(this,obj1,obj2);
+ }
+
+ jobject NewLocalRef(jobject ref) {
+ return functions->NewLocalRef(this,ref);
+ }
+ jint EnsureLocalCapacity(jint capacity) {
+ return functions->EnsureLocalCapacity(this,capacity);
+ }
+
+ jobject AllocObject(jclass clazz) {
+ return functions->AllocObject(this,clazz);
+ }
+ jobject NewObject(jclass clazz, jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args, methodID);
+ result = functions->NewObjectV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject NewObjectV(jclass clazz, jmethodID methodID,
+ va_list args) {
+ return functions->NewObjectV(this,clazz,methodID,args);
+ }
+ jobject NewObjectA(jclass clazz, jmethodID methodID,
+ const jvalue *args) {
+ return functions->NewObjectA(this,clazz,methodID,args);
+ }
+
+ jclass GetObjectClass(jobject obj) {
+ return functions->GetObjectClass(this,obj);
+ }
+ jboolean IsInstanceOf(jobject obj, jclass clazz) {
+ return functions->IsInstanceOf(this,obj,clazz);
+ }
+
+ jmethodID GetMethodID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetMethodID(this,clazz,name,sig);
+ }
+
+ jobject CallObjectMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallObjectMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallObjectMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallObjectMethodV(this,obj,methodID,args);
+ }
+ jobject CallObjectMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallObjectMethodA(this,obj,methodID,args);
+ }
+
+ jboolean CallBooleanMethod(jobject obj,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallBooleanMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallBooleanMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallBooleanMethodV(this,obj,methodID,args);
+ }
+ jboolean CallBooleanMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallBooleanMethodA(this,obj,methodID, args);
+ }
+
+ jbyte CallByteMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallByteMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallByteMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallByteMethodV(this,obj,methodID,args);
+ }
+ jbyte CallByteMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallByteMethodA(this,obj,methodID,args);
+ }
+
+ jchar CallCharMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallCharMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallCharMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallCharMethodV(this,obj,methodID,args);
+ }
+ jchar CallCharMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallCharMethodA(this,obj,methodID,args);
+ }
+
+ jshort CallShortMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallShortMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallShortMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallShortMethodV(this,obj,methodID,args);
+ }
+ jshort CallShortMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallShortMethodA(this,obj,methodID,args);
+ }
+
+ jint CallIntMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallIntMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallIntMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallIntMethodV(this,obj,methodID,args);
+ }
+ jint CallIntMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallIntMethodA(this,obj,methodID,args);
+ }
+
+ jlong CallLongMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallLongMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallLongMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallLongMethodV(this,obj,methodID,args);
+ }
+ jlong CallLongMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallLongMethodA(this,obj,methodID,args);
+ }
+
+ jfloat CallFloatMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallFloatMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallFloatMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallFloatMethodV(this,obj,methodID,args);
+ }
+ jfloat CallFloatMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallFloatMethodA(this,obj,methodID,args);
+ }
+
+ jdouble CallDoubleMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallDoubleMethodV(this,obj,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallDoubleMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ return functions->CallDoubleMethodV(this,obj,methodID,args);
+ }
+ jdouble CallDoubleMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallDoubleMethodA(this,obj,methodID,args);
+ }
+
+ void CallVoidMethod(jobject obj, jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallVoidMethodV(this,obj,methodID,args);
+ va_end(args);
+ }
+ void CallVoidMethodV(jobject obj, jmethodID methodID,
+ va_list args) {
+ functions->CallVoidMethodV(this,obj,methodID,args);
+ }
+ void CallVoidMethodA(jobject obj, jmethodID methodID,
+ const jvalue * args) {
+ functions->CallVoidMethodA(this,obj,methodID,args);
+ }
+
+ jobject CallNonvirtualObjectMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallNonvirtualObjectMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualObjectMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jobject CallNonvirtualObjectMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualObjectMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jboolean CallNonvirtualBooleanMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallNonvirtualBooleanMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualBooleanMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jboolean CallNonvirtualBooleanMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualBooleanMethodA(this,obj,clazz,
+ methodID, args);
+ }
+
+ jbyte CallNonvirtualByteMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualByteMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallNonvirtualByteMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualByteMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jbyte CallNonvirtualByteMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualByteMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jchar CallNonvirtualCharMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualCharMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallNonvirtualCharMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualCharMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jchar CallNonvirtualCharMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualCharMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jshort CallNonvirtualShortMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualShortMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallNonvirtualShortMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualShortMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jshort CallNonvirtualShortMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualShortMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jint CallNonvirtualIntMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualIntMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallNonvirtualIntMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualIntMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jint CallNonvirtualIntMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualIntMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jlong CallNonvirtualLongMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualLongMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallNonvirtualLongMethodV(jobject obj, jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallNonvirtualLongMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jlong CallNonvirtualLongMethodA(jobject obj, jclass clazz,
+ jmethodID methodID, const jvalue * args) {
+ return functions->CallNonvirtualLongMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jfloat CallNonvirtualFloatMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallNonvirtualFloatMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ return functions->CallNonvirtualFloatMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jfloat CallNonvirtualFloatMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallNonvirtualFloatMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ jdouble CallNonvirtualDoubleMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+ methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallNonvirtualDoubleMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ return functions->CallNonvirtualDoubleMethodV(this,obj,clazz,
+ methodID,args);
+ }
+ jdouble CallNonvirtualDoubleMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ return functions->CallNonvirtualDoubleMethodA(this,obj,clazz,
+ methodID,args);
+ }
+
+ void CallNonvirtualVoidMethod(jobject obj, jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+ va_end(args);
+ }
+ void CallNonvirtualVoidMethodV(jobject obj, jclass clazz,
+ jmethodID methodID,
+ va_list args) {
+ functions->CallNonvirtualVoidMethodV(this,obj,clazz,methodID,args);
+ }
+ void CallNonvirtualVoidMethodA(jobject obj, jclass clazz,
+ jmethodID methodID,
+ const jvalue * args) {
+ functions->CallNonvirtualVoidMethodA(this,obj,clazz,methodID,args);
+ }
+
+ jfieldID GetFieldID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetFieldID(this,clazz,name,sig);
+ }
+
+ jobject GetObjectField(jobject obj, jfieldID fieldID) {
+ return functions->GetObjectField(this,obj,fieldID);
+ }
+ jboolean GetBooleanField(jobject obj, jfieldID fieldID) {
+ return functions->GetBooleanField(this,obj,fieldID);
+ }
+ jbyte GetByteField(jobject obj, jfieldID fieldID) {
+ return functions->GetByteField(this,obj,fieldID);
+ }
+ jchar GetCharField(jobject obj, jfieldID fieldID) {
+ return functions->GetCharField(this,obj,fieldID);
+ }
+ jshort GetShortField(jobject obj, jfieldID fieldID) {
+ return functions->GetShortField(this,obj,fieldID);
+ }
+ jint GetIntField(jobject obj, jfieldID fieldID) {
+ return functions->GetIntField(this,obj,fieldID);
+ }
+ jlong GetLongField(jobject obj, jfieldID fieldID) {
+ return functions->GetLongField(this,obj,fieldID);
+ }
+ jfloat GetFloatField(jobject obj, jfieldID fieldID) {
+ return functions->GetFloatField(this,obj,fieldID);
+ }
+ jdouble GetDoubleField(jobject obj, jfieldID fieldID) {
+ return functions->GetDoubleField(this,obj,fieldID);
+ }
+
+ void SetObjectField(jobject obj, jfieldID fieldID, jobject val) {
+ functions->SetObjectField(this,obj,fieldID,val);
+ }
+ void SetBooleanField(jobject obj, jfieldID fieldID,
+ jboolean val) {
+ functions->SetBooleanField(this,obj,fieldID,val);
+ }
+ void SetByteField(jobject obj, jfieldID fieldID,
+ jbyte val) {
+ functions->SetByteField(this,obj,fieldID,val);
+ }
+ void SetCharField(jobject obj, jfieldID fieldID,
+ jchar val) {
+ functions->SetCharField(this,obj,fieldID,val);
+ }
+ void SetShortField(jobject obj, jfieldID fieldID,
+ jshort val) {
+ functions->SetShortField(this,obj,fieldID,val);
+ }
+ void SetIntField(jobject obj, jfieldID fieldID,
+ jint val) {
+ functions->SetIntField(this,obj,fieldID,val);
+ }
+ void SetLongField(jobject obj, jfieldID fieldID,
+ jlong val) {
+ functions->SetLongField(this,obj,fieldID,val);
+ }
+ void SetFloatField(jobject obj, jfieldID fieldID,
+ jfloat val) {
+ functions->SetFloatField(this,obj,fieldID,val);
+ }
+ void SetDoubleField(jobject obj, jfieldID fieldID,
+ jdouble val) {
+ functions->SetDoubleField(this,obj,fieldID,val);
+ }
+
+ jmethodID GetStaticMethodID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetStaticMethodID(this,clazz,name,sig);
+ }
+
+ jobject CallStaticObjectMethod(jclass clazz, jmethodID methodID,
+ ...) {
+ va_list args;
+ jobject result;
+ va_start(args,methodID);
+ result = functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jobject CallStaticObjectMethodV(jclass clazz, jmethodID methodID,
+ va_list args) {
+ return functions->CallStaticObjectMethodV(this,clazz,methodID,args);
+ }
+ jobject CallStaticObjectMethodA(jclass clazz, jmethodID methodID,
+ const jvalue *args) {
+ return functions->CallStaticObjectMethodA(this,clazz,methodID,args);
+ }
+
+ jboolean CallStaticBooleanMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jboolean result;
+ va_start(args,methodID);
+ result = functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jboolean CallStaticBooleanMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticBooleanMethodV(this,clazz,methodID,args);
+ }
+ jboolean CallStaticBooleanMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticBooleanMethodA(this,clazz,methodID,args);
+ }
+
+ jbyte CallStaticByteMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jbyte result;
+ va_start(args,methodID);
+ result = functions->CallStaticByteMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jbyte CallStaticByteMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticByteMethodV(this,clazz,methodID,args);
+ }
+ jbyte CallStaticByteMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticByteMethodA(this,clazz,methodID,args);
+ }
+
+ jchar CallStaticCharMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jchar result;
+ va_start(args,methodID);
+ result = functions->CallStaticCharMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jchar CallStaticCharMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticCharMethodV(this,clazz,methodID,args);
+ }
+ jchar CallStaticCharMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticCharMethodA(this,clazz,methodID,args);
+ }
+
+ jshort CallStaticShortMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jshort result;
+ va_start(args,methodID);
+ result = functions->CallStaticShortMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jshort CallStaticShortMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticShortMethodV(this,clazz,methodID,args);
+ }
+ jshort CallStaticShortMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticShortMethodA(this,clazz,methodID,args);
+ }
+
+ jint CallStaticIntMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jint result;
+ va_start(args,methodID);
+ result = functions->CallStaticIntMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jint CallStaticIntMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticIntMethodV(this,clazz,methodID,args);
+ }
+ jint CallStaticIntMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticIntMethodA(this,clazz,methodID,args);
+ }
+
+ jlong CallStaticLongMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jlong result;
+ va_start(args,methodID);
+ result = functions->CallStaticLongMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jlong CallStaticLongMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticLongMethodV(this,clazz,methodID,args);
+ }
+ jlong CallStaticLongMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticLongMethodA(this,clazz,methodID,args);
+ }
+
+ jfloat CallStaticFloatMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jfloat result;
+ va_start(args,methodID);
+ result = functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jfloat CallStaticFloatMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticFloatMethodV(this,clazz,methodID,args);
+ }
+ jfloat CallStaticFloatMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticFloatMethodA(this,clazz,methodID,args);
+ }
+
+ jdouble CallStaticDoubleMethod(jclass clazz,
+ jmethodID methodID, ...) {
+ va_list args;
+ jdouble result;
+ va_start(args,methodID);
+ result = functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+ va_end(args);
+ return result;
+ }
+ jdouble CallStaticDoubleMethodV(jclass clazz,
+ jmethodID methodID, va_list args) {
+ return functions->CallStaticDoubleMethodV(this,clazz,methodID,args);
+ }
+ jdouble CallStaticDoubleMethodA(jclass clazz,
+ jmethodID methodID, const jvalue *args) {
+ return functions->CallStaticDoubleMethodA(this,clazz,methodID,args);
+ }
+
+ void CallStaticVoidMethod(jclass cls, jmethodID methodID, ...) {
+ va_list args;
+ va_start(args,methodID);
+ functions->CallStaticVoidMethodV(this,cls,methodID,args);
+ va_end(args);
+ }
+ void CallStaticVoidMethodV(jclass cls, jmethodID methodID,
+ va_list args) {
+ functions->CallStaticVoidMethodV(this,cls,methodID,args);
+ }
+ void CallStaticVoidMethodA(jclass cls, jmethodID methodID,
+ const jvalue * args) {
+ functions->CallStaticVoidMethodA(this,cls,methodID,args);
+ }
+
+ jfieldID GetStaticFieldID(jclass clazz, const char *name,
+ const char *sig) {
+ return functions->GetStaticFieldID(this,clazz,name,sig);
+ }
+ jobject GetStaticObjectField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticObjectField(this,clazz,fieldID);
+ }
+ jboolean GetStaticBooleanField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticBooleanField(this,clazz,fieldID);
+ }
+ jbyte GetStaticByteField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticByteField(this,clazz,fieldID);
+ }
+ jchar GetStaticCharField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticCharField(this,clazz,fieldID);
+ }
+ jshort GetStaticShortField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticShortField(this,clazz,fieldID);
+ }
+ jint GetStaticIntField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticIntField(this,clazz,fieldID);
+ }
+ jlong GetStaticLongField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticLongField(this,clazz,fieldID);
+ }
+ jfloat GetStaticFloatField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticFloatField(this,clazz,fieldID);
+ }
+ jdouble GetStaticDoubleField(jclass clazz, jfieldID fieldID) {
+ return functions->GetStaticDoubleField(this,clazz,fieldID);
+ }
+
+ void SetStaticObjectField(jclass clazz, jfieldID fieldID,
+ jobject value) {
+ functions->SetStaticObjectField(this,clazz,fieldID,value);
+ }
+ void SetStaticBooleanField(jclass clazz, jfieldID fieldID,
+ jboolean value) {
+ functions->SetStaticBooleanField(this,clazz,fieldID,value);
+ }
+ void SetStaticByteField(jclass clazz, jfieldID fieldID,
+ jbyte value) {
+ functions->SetStaticByteField(this,clazz,fieldID,value);
+ }
+ void SetStaticCharField(jclass clazz, jfieldID fieldID,
+ jchar value) {
+ functions->SetStaticCharField(this,clazz,fieldID,value);
+ }
+ void SetStaticShortField(jclass clazz, jfieldID fieldID,
+ jshort value) {
+ functions->SetStaticShortField(this,clazz,fieldID,value);
+ }
+ void SetStaticIntField(jclass clazz, jfieldID fieldID,
+ jint value) {
+ functions->SetStaticIntField(this,clazz,fieldID,value);
+ }
+ void SetStaticLongField(jclass clazz, jfieldID fieldID,
+ jlong value) {
+ functions->SetStaticLongField(this,clazz,fieldID,value);
+ }
+ void SetStaticFloatField(jclass clazz, jfieldID fieldID,
+ jfloat value) {
+ functions->SetStaticFloatField(this,clazz,fieldID,value);
+ }
+ void SetStaticDoubleField(jclass clazz, jfieldID fieldID,
+ jdouble value) {
+ functions->SetStaticDoubleField(this,clazz,fieldID,value);
+ }
+
+ jstring NewString(const jchar *unicode, jsize len) {
+ return functions->NewString(this,unicode,len);
+ }
+ jsize GetStringLength(jstring str) {
+ return functions->GetStringLength(this,str);
+ }
+ const jchar *GetStringChars(jstring str, jboolean *isCopy) {
+ return functions->GetStringChars(this,str,isCopy);
+ }
+ void ReleaseStringChars(jstring str, const jchar *chars) {
+ functions->ReleaseStringChars(this,str,chars);
+ }
+
+ jstring NewStringUTF(const char *utf) {
+ return functions->NewStringUTF(this,utf);
+ }
+ jsize GetStringUTFLength(jstring str) {
+ return functions->GetStringUTFLength(this,str);
+ }
+ const char* GetStringUTFChars(jstring str, jboolean *isCopy) {
+ return functions->GetStringUTFChars(this,str,isCopy);
+ }
+ void ReleaseStringUTFChars(jstring str, const char* chars) {
+ functions->ReleaseStringUTFChars(this,str,chars);
+ }
+
+ jsize GetArrayLength(jarray array) {
+ return functions->GetArrayLength(this,array);
+ }
+
+ jobjectArray NewObjectArray(jsize len, jclass clazz,
+ jobject init) {
+ return functions->NewObjectArray(this,len,clazz,init);
+ }
+ jobject GetObjectArrayElement(jobjectArray array, jsize index) {
+ return functions->GetObjectArrayElement(this,array,index);
+ }
+ void SetObjectArrayElement(jobjectArray array, jsize index,
+ jobject val) {
+ functions->SetObjectArrayElement(this,array,index,val);
+ }
+
+ jbooleanArray NewBooleanArray(jsize len) {
+ return functions->NewBooleanArray(this,len);
+ }
+ jbyteArray NewByteArray(jsize len) {
+ return functions->NewByteArray(this,len);
+ }
+ jcharArray NewCharArray(jsize len) {
+ return functions->NewCharArray(this,len);
+ }
+ jshortArray NewShortArray(jsize len) {
+ return functions->NewShortArray(this,len);
+ }
+ jintArray NewIntArray(jsize len) {
+ return functions->NewIntArray(this,len);
+ }
+ jlongArray NewLongArray(jsize len) {
+ return functions->NewLongArray(this,len);
+ }
+ jfloatArray NewFloatArray(jsize len) {
+ return functions->NewFloatArray(this,len);
+ }
+ jdoubleArray NewDoubleArray(jsize len) {
+ return functions->NewDoubleArray(this,len);
+ }
+
+ jboolean * GetBooleanArrayElements(jbooleanArray array, jboolean *isCopy) {
+ return functions->GetBooleanArrayElements(this,array,isCopy);
+ }
+ jbyte * GetByteArrayElements(jbyteArray array, jboolean *isCopy) {
+ return functions->GetByteArrayElements(this,array,isCopy);
+ }
+ jchar * GetCharArrayElements(jcharArray array, jboolean *isCopy) {
+ return functions->GetCharArrayElements(this,array,isCopy);
+ }
+ jshort * GetShortArrayElements(jshortArray array, jboolean *isCopy) {
+ return functions->GetShortArrayElements(this,array,isCopy);
+ }
+ jint * GetIntArrayElements(jintArray array, jboolean *isCopy) {
+ return functions->GetIntArrayElements(this,array,isCopy);
+ }
+ jlong * GetLongArrayElements(jlongArray array, jboolean *isCopy) {
+ return functions->GetLongArrayElements(this,array,isCopy);
+ }
+ jfloat * GetFloatArrayElements(jfloatArray array, jboolean *isCopy) {
+ return functions->GetFloatArrayElements(this,array,isCopy);
+ }
+ jdouble * GetDoubleArrayElements(jdoubleArray array, jboolean *isCopy) {
+ return functions->GetDoubleArrayElements(this,array,isCopy);
+ }
+
+ void ReleaseBooleanArrayElements(jbooleanArray array,
+ jboolean *elems,
+ jint mode) {
+ functions->ReleaseBooleanArrayElements(this,array,elems,mode);
+ }
+ void ReleaseByteArrayElements(jbyteArray array,
+ jbyte *elems,
+ jint mode) {
+ functions->ReleaseByteArrayElements(this,array,elems,mode);
+ }
+ void ReleaseCharArrayElements(jcharArray array,
+ jchar *elems,
+ jint mode) {
+ functions->ReleaseCharArrayElements(this,array,elems,mode);
+ }
+ void ReleaseShortArrayElements(jshortArray array,
+ jshort *elems,
+ jint mode) {
+ functions->ReleaseShortArrayElements(this,array,elems,mode);
+ }
+ void ReleaseIntArrayElements(jintArray array,
+ jint *elems,
+ jint mode) {
+ functions->ReleaseIntArrayElements(this,array,elems,mode);
+ }
+ void ReleaseLongArrayElements(jlongArray array,
+ jlong *elems,
+ jint mode) {
+ functions->ReleaseLongArrayElements(this,array,elems,mode);
+ }
+ void ReleaseFloatArrayElements(jfloatArray array,
+ jfloat *elems,
+ jint mode) {
+ functions->ReleaseFloatArrayElements(this,array,elems,mode);
+ }
+ void ReleaseDoubleArrayElements(jdoubleArray array,
+ jdouble *elems,
+ jint mode) {
+ functions->ReleaseDoubleArrayElements(this,array,elems,mode);
+ }
+
+ void GetBooleanArrayRegion(jbooleanArray array,
+ jsize start, jsize len, jboolean *buf) {
+ functions->GetBooleanArrayRegion(this,array,start,len,buf);
+ }
+ void GetByteArrayRegion(jbyteArray array,
+ jsize start, jsize len, jbyte *buf) {
+ functions->GetByteArrayRegion(this,array,start,len,buf);
+ }
+ void GetCharArrayRegion(jcharArray array,
+ jsize start, jsize len, jchar *buf) {
+ functions->GetCharArrayRegion(this,array,start,len,buf);
+ }
+ void GetShortArrayRegion(jshortArray array,
+ jsize start, jsize len, jshort *buf) {
+ functions->GetShortArrayRegion(this,array,start,len,buf);
+ }
+ void GetIntArrayRegion(jintArray array,
+ jsize start, jsize len, jint *buf) {
+ functions->GetIntArrayRegion(this,array,start,len,buf);
+ }
+ void GetLongArrayRegion(jlongArray array,
+ jsize start, jsize len, jlong *buf) {
+ functions->GetLongArrayRegion(this,array,start,len,buf);
+ }
+ void GetFloatArrayRegion(jfloatArray array,
+ jsize start, jsize len, jfloat *buf) {
+ functions->GetFloatArrayRegion(this,array,start,len,buf);
+ }
+ void GetDoubleArrayRegion(jdoubleArray array,
+ jsize start, jsize len, jdouble *buf) {
+ functions->GetDoubleArrayRegion(this,array,start,len,buf);
+ }
+
+ void SetBooleanArrayRegion(jbooleanArray array, jsize start, jsize len,
+ const jboolean *buf) {
+ functions->SetBooleanArrayRegion(this,array,start,len,buf);
+ }
+ void SetByteArrayRegion(jbyteArray array, jsize start, jsize len,
+ const jbyte *buf) {
+ functions->SetByteArrayRegion(this,array,start,len,buf);
+ }
+ void SetCharArrayRegion(jcharArray array, jsize start, jsize len,
+ const jchar *buf) {
+ functions->SetCharArrayRegion(this,array,start,len,buf);
+ }
+ void SetShortArrayRegion(jshortArray array, jsize start, jsize len,
+ const jshort *buf) {
+ functions->SetShortArrayRegion(this,array,start,len,buf);
+ }
+ void SetIntArrayRegion(jintArray array, jsize start, jsize len,
+ const jint *buf) {
+ functions->SetIntArrayRegion(this,array,start,len,buf);
+ }
+ void SetLongArrayRegion(jlongArray array, jsize start, jsize len,
+ const jlong *buf) {
+ functions->SetLongArrayRegion(this,array,start,len,buf);
+ }
+ void SetFloatArrayRegion(jfloatArray array, jsize start, jsize len,
+ const jfloat *buf) {
+ functions->SetFloatArrayRegion(this,array,start,len,buf);
+ }
+ void SetDoubleArrayRegion(jdoubleArray array, jsize start, jsize len,
+ const jdouble *buf) {
+ functions->SetDoubleArrayRegion(this,array,start,len,buf);
+ }
+
+ jint RegisterNatives(jclass clazz, const JNINativeMethod *methods,
+ jint nMethods) {
+ return functions->RegisterNatives(this,clazz,methods,nMethods);
+ }
+ jint UnregisterNatives(jclass clazz) {
+ return functions->UnregisterNatives(this,clazz);
+ }
+
+ jint MonitorEnter(jobject obj) {
+ return functions->MonitorEnter(this,obj);
+ }
+ jint MonitorExit(jobject obj) {
+ return functions->MonitorExit(this,obj);
+ }
+
+ jint GetJavaVM(JavaVM **vm) {
+ return functions->GetJavaVM(this,vm);
+ }
+
+ void GetStringRegion(jstring str, jsize start, jsize len, jchar *buf) {
+ functions->GetStringRegion(this,str,start,len,buf);
+ }
+ void GetStringUTFRegion(jstring str, jsize start, jsize len, char *buf) {
+ functions->GetStringUTFRegion(this,str,start,len,buf);
+ }
+
+ void * GetPrimitiveArrayCritical(jarray array, jboolean *isCopy) {
+ return functions->GetPrimitiveArrayCritical(this,array,isCopy);
+ }
+ void ReleasePrimitiveArrayCritical(jarray array, void *carray, jint mode) {
+ functions->ReleasePrimitiveArrayCritical(this,array,carray,mode);
+ }
+
+ const jchar * GetStringCritical(jstring string, jboolean *isCopy) {
+ return functions->GetStringCritical(this,string,isCopy);
+ }
+ void ReleaseStringCritical(jstring string, const jchar *cstring) {
+ functions->ReleaseStringCritical(this,string,cstring);
+ }
+
+ jweak NewWeakGlobalRef(jobject obj) {
+ return functions->NewWeakGlobalRef(this,obj);
+ }
+ void DeleteWeakGlobalRef(jweak ref) {
+ functions->DeleteWeakGlobalRef(this,ref);
+ }
+
+ jboolean ExceptionCheck() {
+ return functions->ExceptionCheck(this);
+ }
+
+ jobject NewDirectByteBuffer(void* address, jlong capacity) {
+ return functions->NewDirectByteBuffer(this, address, capacity);
+ }
+ void* GetDirectBufferAddress(jobject buf) {
+ return functions->GetDirectBufferAddress(this, buf);
+ }
+ jlong GetDirectBufferCapacity(jobject buf) {
+ return functions->GetDirectBufferCapacity(this, buf);
+ }
+ jobjectRefType GetObjectRefType(jobject obj) {
+ return functions->GetObjectRefType(this, obj);
+ }
+
+#endif /* __cplusplus */
+};
+
+typedef struct JavaVMOption {
+ char *optionString;
+ void *extraInfo;
+} JavaVMOption;
+
+typedef struct JavaVMInitArgs {
+ jint version;
+
+ jint nOptions;
+ JavaVMOption *options;
+ jboolean ignoreUnrecognized;
+} JavaVMInitArgs;
+
+typedef struct JavaVMAttachArgs {
+ jint version;
+
+ char *name;
+ jobject group;
+} JavaVMAttachArgs;
+
+/* These will be VM-specific. */
+
+#define JDK1_2
+#define JDK1_4
+
+/* End VM-specific. */
+
+struct JNIInvokeInterface_ {
+ void *reserved0;
+ void *reserved1;
+ void *reserved2;
+
+ jint (JNICALL *DestroyJavaVM)(JavaVM *vm);
+
+ jint (JNICALL *AttachCurrentThread)(JavaVM *vm, void **penv, void *args);
+
+ jint (JNICALL *DetachCurrentThread)(JavaVM *vm);
+
+ jint (JNICALL *GetEnv)(JavaVM *vm, void **penv, jint version);
+
+ jint (JNICALL *AttachCurrentThreadAsDaemon)(JavaVM *vm, void **penv, void *args);
+};
+
+struct JavaVM_ {
+ const struct JNIInvokeInterface_ *functions;
+#ifdef __cplusplus
+
+ jint DestroyJavaVM() {
+ return functions->DestroyJavaVM(this);
+ }
+ jint AttachCurrentThread(void **penv, void *args) {
+ return functions->AttachCurrentThread(this, penv, args);
+ }
+ jint DetachCurrentThread() {
+ return functions->DetachCurrentThread(this);
+ }
+
+ jint GetEnv(void **penv, jint version) {
+ return functions->GetEnv(this, penv, version);
+ }
+ jint AttachCurrentThreadAsDaemon(void **penv, void *args) {
+ return functions->AttachCurrentThreadAsDaemon(this, penv, args);
+ }
+#endif
+};
+
+#ifdef _JNI_IMPLEMENTATION_
+#define _JNI_IMPORT_OR_EXPORT_ JNIEXPORT
+#else
+#define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT
+#endif
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetDefaultJavaVMInitArgs(void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
+
+_JNI_IMPORT_OR_EXPORT_ jint JNICALL
+JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *);
+
+/* Defined by native libraries. */
+JNIEXPORT jint JNICALL
+JNI_OnLoad(JavaVM *vm, void *reserved);
+
+JNIEXPORT void JNICALL
+JNI_OnUnload(JavaVM *vm, void *reserved);
+
+#define JNI_VERSION_1_1 0x00010001
+#define JNI_VERSION_1_2 0x00010002
+#define JNI_VERSION_1_4 0x00010004
+#define JNI_VERSION_1_6 0x00010006
+#define JNI_VERSION_1_8 0x00010008
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !_JAVASOFT_JNI_H_ */
diff --git a/staging/linux-x86/include/jvmti.h b/staging/linux-x86/include/jvmti.h
new file mode 100644
index 0000000..ee708cb
--- /dev/null
+++ b/staging/linux-x86/include/jvmti.h
@@ -0,0 +1,2534 @@
+/*
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /* AUTOMATICALLY GENERATED FILE - DO NOT EDIT */
+
+
+ /* Include file for the Java(tm) Virtual Machine Tool Interface */
+
+#ifndef _JAVA_JVMTI_H_
+#define _JAVA_JVMTI_H_
+
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ JVMTI_VERSION_1 = 0x30010000,
+ JVMTI_VERSION_1_0 = 0x30010000,
+ JVMTI_VERSION_1_1 = 0x30010100,
+ JVMTI_VERSION_1_2 = 0x30010200,
+
+ JVMTI_VERSION = 0x30000000 + (1 * 0x10000) + (2 * 0x100) + 1 /* version: 1.2.1 */
+};
+
+JNIEXPORT jint JNICALL
+Agent_OnLoad(JavaVM *vm, char *options, void *reserved);
+
+JNIEXPORT jint JNICALL
+Agent_OnAttach(JavaVM* vm, char* options, void* reserved);
+
+JNIEXPORT void JNICALL
+Agent_OnUnload(JavaVM *vm);
+
+ /* Forward declaration of the environment */
+
+struct _jvmtiEnv;
+
+struct jvmtiInterface_1_;
+
+#ifdef __cplusplus
+typedef _jvmtiEnv jvmtiEnv;
+#else
+typedef const struct jvmtiInterface_1_ *jvmtiEnv;
+#endif /* __cplusplus */
+
+/* Derived Base Types */
+
+typedef jobject jthread;
+typedef jobject jthreadGroup;
+typedef jlong jlocation;
+struct _jrawMonitorID;
+typedef struct _jrawMonitorID *jrawMonitorID;
+typedef struct JNINativeInterface_ jniNativeInterface;
+
+ /* Constants */
+
+
+ /* Thread State Flags */
+
+enum {
+ JVMTI_THREAD_STATE_ALIVE = 0x0001,
+ JVMTI_THREAD_STATE_TERMINATED = 0x0002,
+ JVMTI_THREAD_STATE_RUNNABLE = 0x0004,
+ JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400,
+ JVMTI_THREAD_STATE_WAITING = 0x0080,
+ JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010,
+ JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020,
+ JVMTI_THREAD_STATE_SLEEPING = 0x0040,
+ JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100,
+ JVMTI_THREAD_STATE_PARKED = 0x0200,
+ JVMTI_THREAD_STATE_SUSPENDED = 0x100000,
+ JVMTI_THREAD_STATE_INTERRUPTED = 0x200000,
+ JVMTI_THREAD_STATE_IN_NATIVE = 0x400000,
+ JVMTI_THREAD_STATE_VENDOR_1 = 0x10000000,
+ JVMTI_THREAD_STATE_VENDOR_2 = 0x20000000,
+ JVMTI_THREAD_STATE_VENDOR_3 = 0x40000000
+};
+
+ /* java.lang.Thread.State Conversion Masks */
+
+enum {
+ JVMTI_JAVA_LANG_THREAD_STATE_MASK = JVMTI_THREAD_STATE_TERMINATED | JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT,
+ JVMTI_JAVA_LANG_THREAD_STATE_NEW = 0,
+ JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED = JVMTI_THREAD_STATE_TERMINATED,
+ JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE,
+ JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER,
+ JVMTI_JAVA_LANG_THREAD_STATE_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY,
+ JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING = JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT
+};
+
+ /* Thread Priority Constants */
+
+enum {
+ JVMTI_THREAD_MIN_PRIORITY = 1,
+ JVMTI_THREAD_NORM_PRIORITY = 5,
+ JVMTI_THREAD_MAX_PRIORITY = 10
+};
+
+ /* Heap Filter Flags */
+
+enum {
+ JVMTI_HEAP_FILTER_TAGGED = 0x4,
+ JVMTI_HEAP_FILTER_UNTAGGED = 0x8,
+ JVMTI_HEAP_FILTER_CLASS_TAGGED = 0x10,
+ JVMTI_HEAP_FILTER_CLASS_UNTAGGED = 0x20
+};
+
+ /* Heap Visit Control Flags */
+
+enum {
+ JVMTI_VISIT_OBJECTS = 0x100,
+ JVMTI_VISIT_ABORT = 0x8000
+};
+
+ /* Heap Reference Enumeration */
+
+typedef enum {
+ JVMTI_HEAP_REFERENCE_CLASS = 1,
+ JVMTI_HEAP_REFERENCE_FIELD = 2,
+ JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT = 3,
+ JVMTI_HEAP_REFERENCE_CLASS_LOADER = 4,
+ JVMTI_HEAP_REFERENCE_SIGNERS = 5,
+ JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN = 6,
+ JVMTI_HEAP_REFERENCE_INTERFACE = 7,
+ JVMTI_HEAP_REFERENCE_STATIC_FIELD = 8,
+ JVMTI_HEAP_REFERENCE_CONSTANT_POOL = 9,
+ JVMTI_HEAP_REFERENCE_SUPERCLASS = 10,
+ JVMTI_HEAP_REFERENCE_JNI_GLOBAL = 21,
+ JVMTI_HEAP_REFERENCE_SYSTEM_CLASS = 22,
+ JVMTI_HEAP_REFERENCE_MONITOR = 23,
+ JVMTI_HEAP_REFERENCE_STACK_LOCAL = 24,
+ JVMTI_HEAP_REFERENCE_JNI_LOCAL = 25,
+ JVMTI_HEAP_REFERENCE_THREAD = 26,
+ JVMTI_HEAP_REFERENCE_OTHER = 27
+} jvmtiHeapReferenceKind;
+
+ /* Primitive Type Enumeration */
+
+typedef enum {
+ JVMTI_PRIMITIVE_TYPE_BOOLEAN = 90,
+ JVMTI_PRIMITIVE_TYPE_BYTE = 66,
+ JVMTI_PRIMITIVE_TYPE_CHAR = 67,
+ JVMTI_PRIMITIVE_TYPE_SHORT = 83,
+ JVMTI_PRIMITIVE_TYPE_INT = 73,
+ JVMTI_PRIMITIVE_TYPE_LONG = 74,
+ JVMTI_PRIMITIVE_TYPE_FLOAT = 70,
+ JVMTI_PRIMITIVE_TYPE_DOUBLE = 68
+} jvmtiPrimitiveType;
+
+ /* Heap Object Filter Enumeration */
+
+typedef enum {
+ JVMTI_HEAP_OBJECT_TAGGED = 1,
+ JVMTI_HEAP_OBJECT_UNTAGGED = 2,
+ JVMTI_HEAP_OBJECT_EITHER = 3
+} jvmtiHeapObjectFilter;
+
+ /* Heap Root Kind Enumeration */
+
+typedef enum {
+ JVMTI_HEAP_ROOT_JNI_GLOBAL = 1,
+ JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2,
+ JVMTI_HEAP_ROOT_MONITOR = 3,
+ JVMTI_HEAP_ROOT_STACK_LOCAL = 4,
+ JVMTI_HEAP_ROOT_JNI_LOCAL = 5,
+ JVMTI_HEAP_ROOT_THREAD = 6,
+ JVMTI_HEAP_ROOT_OTHER = 7
+} jvmtiHeapRootKind;
+
+ /* Object Reference Enumeration */
+
+typedef enum {
+ JVMTI_REFERENCE_CLASS = 1,
+ JVMTI_REFERENCE_FIELD = 2,
+ JVMTI_REFERENCE_ARRAY_ELEMENT = 3,
+ JVMTI_REFERENCE_CLASS_LOADER = 4,
+ JVMTI_REFERENCE_SIGNERS = 5,
+ JVMTI_REFERENCE_PROTECTION_DOMAIN = 6,
+ JVMTI_REFERENCE_INTERFACE = 7,
+ JVMTI_REFERENCE_STATIC_FIELD = 8,
+ JVMTI_REFERENCE_CONSTANT_POOL = 9
+} jvmtiObjectReferenceKind;
+
+ /* Iteration Control Enumeration */
+
+typedef enum {
+ JVMTI_ITERATION_CONTINUE = 1,
+ JVMTI_ITERATION_IGNORE = 2,
+ JVMTI_ITERATION_ABORT = 0
+} jvmtiIterationControl;
+
+ /* Class Status Flags */
+
+enum {
+ JVMTI_CLASS_STATUS_VERIFIED = 1,
+ JVMTI_CLASS_STATUS_PREPARED = 2,
+ JVMTI_CLASS_STATUS_INITIALIZED = 4,
+ JVMTI_CLASS_STATUS_ERROR = 8,
+ JVMTI_CLASS_STATUS_ARRAY = 16,
+ JVMTI_CLASS_STATUS_PRIMITIVE = 32
+};
+
+ /* Event Enable/Disable */
+
+typedef enum {
+ JVMTI_ENABLE = 1,
+ JVMTI_DISABLE = 0
+} jvmtiEventMode;
+
+ /* Extension Function/Event Parameter Types */
+
+typedef enum {
+ JVMTI_TYPE_JBYTE = 101,
+ JVMTI_TYPE_JCHAR = 102,
+ JVMTI_TYPE_JSHORT = 103,
+ JVMTI_TYPE_JINT = 104,
+ JVMTI_TYPE_JLONG = 105,
+ JVMTI_TYPE_JFLOAT = 106,
+ JVMTI_TYPE_JDOUBLE = 107,
+ JVMTI_TYPE_JBOOLEAN = 108,
+ JVMTI_TYPE_JOBJECT = 109,
+ JVMTI_TYPE_JTHREAD = 110,
+ JVMTI_TYPE_JCLASS = 111,
+ JVMTI_TYPE_JVALUE = 112,
+ JVMTI_TYPE_JFIELDID = 113,
+ JVMTI_TYPE_JMETHODID = 114,
+ JVMTI_TYPE_CCHAR = 115,
+ JVMTI_TYPE_CVOID = 116,
+ JVMTI_TYPE_JNIENV = 117
+} jvmtiParamTypes;
+
+ /* Extension Function/Event Parameter Kinds */
+
+typedef enum {
+ JVMTI_KIND_IN = 91,
+ JVMTI_KIND_IN_PTR = 92,
+ JVMTI_KIND_IN_BUF = 93,
+ JVMTI_KIND_ALLOC_BUF = 94,
+ JVMTI_KIND_ALLOC_ALLOC_BUF = 95,
+ JVMTI_KIND_OUT = 96,
+ JVMTI_KIND_OUT_BUF = 97
+} jvmtiParamKind;
+
+ /* Timer Kinds */
+
+typedef enum {
+ JVMTI_TIMER_USER_CPU = 30,
+ JVMTI_TIMER_TOTAL_CPU = 31,
+ JVMTI_TIMER_ELAPSED = 32
+} jvmtiTimerKind;
+
+ /* Phases of execution */
+
+typedef enum {
+ JVMTI_PHASE_ONLOAD = 1,
+ JVMTI_PHASE_PRIMORDIAL = 2,
+ JVMTI_PHASE_START = 6,
+ JVMTI_PHASE_LIVE = 4,
+ JVMTI_PHASE_DEAD = 8
+} jvmtiPhase;
+
+ /* Version Interface Types */
+
+enum {
+ JVMTI_VERSION_INTERFACE_JNI = 0x00000000,
+ JVMTI_VERSION_INTERFACE_JVMTI = 0x30000000
+};
+
+ /* Version Masks */
+
+enum {
+ JVMTI_VERSION_MASK_INTERFACE_TYPE = 0x70000000,
+ JVMTI_VERSION_MASK_MAJOR = 0x0FFF0000,
+ JVMTI_VERSION_MASK_MINOR = 0x0000FF00,
+ JVMTI_VERSION_MASK_MICRO = 0x000000FF
+};
+
+ /* Version Shifts */
+
+enum {
+ JVMTI_VERSION_SHIFT_MAJOR = 16,
+ JVMTI_VERSION_SHIFT_MINOR = 8,
+ JVMTI_VERSION_SHIFT_MICRO = 0
+};
+
+ /* Verbose Flag Enumeration */
+
+typedef enum {
+ JVMTI_VERBOSE_OTHER = 0,
+ JVMTI_VERBOSE_GC = 1,
+ JVMTI_VERBOSE_CLASS = 2,
+ JVMTI_VERBOSE_JNI = 4
+} jvmtiVerboseFlag;
+
+ /* JLocation Format Enumeration */
+
+typedef enum {
+ JVMTI_JLOCATION_JVMBCI = 1,
+ JVMTI_JLOCATION_MACHINEPC = 2,
+ JVMTI_JLOCATION_OTHER = 0
+} jvmtiJlocationFormat;
+
+ /* Resource Exhaustion Flags */
+
+enum {
+ JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR = 0x0001,
+ JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP = 0x0002,
+ JVMTI_RESOURCE_EXHAUSTED_THREADS = 0x0004
+};
+
+ /* Errors */
+
+typedef enum {
+ JVMTI_ERROR_NONE = 0,
+ JVMTI_ERROR_INVALID_THREAD = 10,
+ JVMTI_ERROR_INVALID_THREAD_GROUP = 11,
+ JVMTI_ERROR_INVALID_PRIORITY = 12,
+ JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13,
+ JVMTI_ERROR_THREAD_SUSPENDED = 14,
+ JVMTI_ERROR_THREAD_NOT_ALIVE = 15,
+ JVMTI_ERROR_INVALID_OBJECT = 20,
+ JVMTI_ERROR_INVALID_CLASS = 21,
+ JVMTI_ERROR_CLASS_NOT_PREPARED = 22,
+ JVMTI_ERROR_INVALID_METHODID = 23,
+ JVMTI_ERROR_INVALID_LOCATION = 24,
+ JVMTI_ERROR_INVALID_FIELDID = 25,
+ JVMTI_ERROR_NO_MORE_FRAMES = 31,
+ JVMTI_ERROR_OPAQUE_FRAME = 32,
+ JVMTI_ERROR_TYPE_MISMATCH = 34,
+ JVMTI_ERROR_INVALID_SLOT = 35,
+ JVMTI_ERROR_DUPLICATE = 40,
+ JVMTI_ERROR_NOT_FOUND = 41,
+ JVMTI_ERROR_INVALID_MONITOR = 50,
+ JVMTI_ERROR_NOT_MONITOR_OWNER = 51,
+ JVMTI_ERROR_INTERRUPT = 52,
+ JVMTI_ERROR_INVALID_CLASS_FORMAT = 60,
+ JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61,
+ JVMTI_ERROR_FAILS_VERIFICATION = 62,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64,
+ JVMTI_ERROR_INVALID_TYPESTATE = 65,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67,
+ JVMTI_ERROR_UNSUPPORTED_VERSION = 68,
+ JVMTI_ERROR_NAMES_DONT_MATCH = 69,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70,
+ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71,
+ JVMTI_ERROR_UNMODIFIABLE_CLASS = 79,
+ JVMTI_ERROR_NOT_AVAILABLE = 98,
+ JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99,
+ JVMTI_ERROR_NULL_POINTER = 100,
+ JVMTI_ERROR_ABSENT_INFORMATION = 101,
+ JVMTI_ERROR_INVALID_EVENT_TYPE = 102,
+ JVMTI_ERROR_ILLEGAL_ARGUMENT = 103,
+ JVMTI_ERROR_NATIVE_METHOD = 104,
+ JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED = 106,
+ JVMTI_ERROR_OUT_OF_MEMORY = 110,
+ JVMTI_ERROR_ACCESS_DENIED = 111,
+ JVMTI_ERROR_WRONG_PHASE = 112,
+ JVMTI_ERROR_INTERNAL = 113,
+ JVMTI_ERROR_UNATTACHED_THREAD = 115,
+ JVMTI_ERROR_INVALID_ENVIRONMENT = 116,
+ JVMTI_ERROR_MAX = 116
+} jvmtiError;
+
+ /* Event IDs */
+
+typedef enum {
+ JVMTI_MIN_EVENT_TYPE_VAL = 50,
+ JVMTI_EVENT_VM_INIT = 50,
+ JVMTI_EVENT_VM_DEATH = 51,
+ JVMTI_EVENT_THREAD_START = 52,
+ JVMTI_EVENT_THREAD_END = 53,
+ JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54,
+ JVMTI_EVENT_CLASS_LOAD = 55,
+ JVMTI_EVENT_CLASS_PREPARE = 56,
+ JVMTI_EVENT_VM_START = 57,
+ JVMTI_EVENT_EXCEPTION = 58,
+ JVMTI_EVENT_EXCEPTION_CATCH = 59,
+ JVMTI_EVENT_SINGLE_STEP = 60,
+ JVMTI_EVENT_FRAME_POP = 61,
+ JVMTI_EVENT_BREAKPOINT = 62,
+ JVMTI_EVENT_FIELD_ACCESS = 63,
+ JVMTI_EVENT_FIELD_MODIFICATION = 64,
+ JVMTI_EVENT_METHOD_ENTRY = 65,
+ JVMTI_EVENT_METHOD_EXIT = 66,
+ JVMTI_EVENT_NATIVE_METHOD_BIND = 67,
+ JVMTI_EVENT_COMPILED_METHOD_LOAD = 68,
+ JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69,
+ JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70,
+ JVMTI_EVENT_DATA_DUMP_REQUEST = 71,
+ JVMTI_EVENT_MONITOR_WAIT = 73,
+ JVMTI_EVENT_MONITOR_WAITED = 74,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75,
+ JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76,
+ JVMTI_EVENT_RESOURCE_EXHAUSTED = 80,
+ JVMTI_EVENT_GARBAGE_COLLECTION_START = 81,
+ JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82,
+ JVMTI_EVENT_OBJECT_FREE = 83,
+ JVMTI_EVENT_VM_OBJECT_ALLOC = 84,
+ JVMTI_MAX_EVENT_TYPE_VAL = 84
+} jvmtiEvent;
+
+
+ /* Pre-Declarations */
+struct _jvmtiThreadInfo;
+typedef struct _jvmtiThreadInfo jvmtiThreadInfo;
+struct _jvmtiMonitorStackDepthInfo;
+typedef struct _jvmtiMonitorStackDepthInfo jvmtiMonitorStackDepthInfo;
+struct _jvmtiThreadGroupInfo;
+typedef struct _jvmtiThreadGroupInfo jvmtiThreadGroupInfo;
+struct _jvmtiFrameInfo;
+typedef struct _jvmtiFrameInfo jvmtiFrameInfo;
+struct _jvmtiStackInfo;
+typedef struct _jvmtiStackInfo jvmtiStackInfo;
+struct _jvmtiHeapReferenceInfoField;
+typedef struct _jvmtiHeapReferenceInfoField jvmtiHeapReferenceInfoField;
+struct _jvmtiHeapReferenceInfoArray;
+typedef struct _jvmtiHeapReferenceInfoArray jvmtiHeapReferenceInfoArray;
+struct _jvmtiHeapReferenceInfoConstantPool;
+typedef struct _jvmtiHeapReferenceInfoConstantPool jvmtiHeapReferenceInfoConstantPool;
+struct _jvmtiHeapReferenceInfoStackLocal;
+typedef struct _jvmtiHeapReferenceInfoStackLocal jvmtiHeapReferenceInfoStackLocal;
+struct _jvmtiHeapReferenceInfoJniLocal;
+typedef struct _jvmtiHeapReferenceInfoJniLocal jvmtiHeapReferenceInfoJniLocal;
+struct _jvmtiHeapReferenceInfoReserved;
+typedef struct _jvmtiHeapReferenceInfoReserved jvmtiHeapReferenceInfoReserved;
+union _jvmtiHeapReferenceInfo;
+typedef union _jvmtiHeapReferenceInfo jvmtiHeapReferenceInfo;
+struct _jvmtiHeapCallbacks;
+typedef struct _jvmtiHeapCallbacks jvmtiHeapCallbacks;
+struct _jvmtiClassDefinition;
+typedef struct _jvmtiClassDefinition jvmtiClassDefinition;
+struct _jvmtiMonitorUsage;
+typedef struct _jvmtiMonitorUsage jvmtiMonitorUsage;
+struct _jvmtiLineNumberEntry;
+typedef struct _jvmtiLineNumberEntry jvmtiLineNumberEntry;
+struct _jvmtiLocalVariableEntry;
+typedef struct _jvmtiLocalVariableEntry jvmtiLocalVariableEntry;
+struct _jvmtiParamInfo;
+typedef struct _jvmtiParamInfo jvmtiParamInfo;
+struct _jvmtiExtensionFunctionInfo;
+typedef struct _jvmtiExtensionFunctionInfo jvmtiExtensionFunctionInfo;
+struct _jvmtiExtensionEventInfo;
+typedef struct _jvmtiExtensionEventInfo jvmtiExtensionEventInfo;
+struct _jvmtiTimerInfo;
+typedef struct _jvmtiTimerInfo jvmtiTimerInfo;
+struct _jvmtiAddrLocationMap;
+typedef struct _jvmtiAddrLocationMap jvmtiAddrLocationMap;
+
+ /* Function Types */
+
+typedef void (JNICALL *jvmtiStartFunction)
+ (jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg);
+
+typedef jint (JNICALL *jvmtiHeapIterationCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, jint length, void* user_data);
+
+typedef jint (JNICALL *jvmtiHeapReferenceCallback)
+ (jvmtiHeapReferenceKind reference_kind, const jvmtiHeapReferenceInfo* reference_info, jlong class_tag, jlong referrer_class_tag, jlong size, jlong* tag_ptr, jlong* referrer_tag_ptr, jint length, void* user_data);
+
+typedef jint (JNICALL *jvmtiPrimitiveFieldCallback)
+ (jvmtiHeapReferenceKind kind, const jvmtiHeapReferenceInfo* info, jlong object_class_tag, jlong* object_tag_ptr, jvalue value, jvmtiPrimitiveType value_type, void* user_data);
+
+typedef jint (JNICALL *jvmtiArrayPrimitiveValueCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, jint element_count, jvmtiPrimitiveType element_type, const void* elements, void* user_data);
+
+typedef jint (JNICALL *jvmtiStringPrimitiveValueCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, const jchar* value, jint value_length, void* user_data);
+
+typedef jint (JNICALL *jvmtiReservedCallback)
+ ();
+
+typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback)
+ (jlong class_tag, jlong size, jlong* tag_ptr, void* user_data);
+
+typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback)
+ (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, void* user_data);
+
+typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback)
+ (jvmtiHeapRootKind root_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong thread_tag, jint depth, jmethodID method, jint slot, void* user_data);
+
+typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback)
+ (jvmtiObjectReferenceKind reference_kind, jlong class_tag, jlong size, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data);
+
+typedef jvmtiError (JNICALL *jvmtiExtensionFunction)
+ (jvmtiEnv* jvmti_env, ...);
+
+typedef void (JNICALL *jvmtiExtensionEvent)
+ (jvmtiEnv* jvmti_env, ...);
+
+
+ /* Structure Types */
+struct _jvmtiThreadInfo {
+ char* name;
+ jint priority;
+ jboolean is_daemon;
+ jthreadGroup thread_group;
+ jobject context_class_loader;
+};
+struct _jvmtiMonitorStackDepthInfo {
+ jobject monitor;
+ jint stack_depth;
+};
+struct _jvmtiThreadGroupInfo {
+ jthreadGroup parent;
+ char* name;
+ jint max_priority;
+ jboolean is_daemon;
+};
+struct _jvmtiFrameInfo {
+ jmethodID method;
+ jlocation location;
+};
+struct _jvmtiStackInfo {
+ jthread thread;
+ jint state;
+ jvmtiFrameInfo* frame_buffer;
+ jint frame_count;
+};
+struct _jvmtiHeapReferenceInfoField {
+ jint index;
+};
+struct _jvmtiHeapReferenceInfoArray {
+ jint index;
+};
+struct _jvmtiHeapReferenceInfoConstantPool {
+ jint index;
+};
+struct _jvmtiHeapReferenceInfoStackLocal {
+ jlong thread_tag;
+ jlong thread_id;
+ jint depth;
+ jmethodID method;
+ jlocation location;
+ jint slot;
+};
+struct _jvmtiHeapReferenceInfoJniLocal {
+ jlong thread_tag;
+ jlong thread_id;
+ jint depth;
+ jmethodID method;
+};
+struct _jvmtiHeapReferenceInfoReserved {
+ jlong reserved1;
+ jlong reserved2;
+ jlong reserved3;
+ jlong reserved4;
+ jlong reserved5;
+ jlong reserved6;
+ jlong reserved7;
+ jlong reserved8;
+};
+union _jvmtiHeapReferenceInfo {
+ jvmtiHeapReferenceInfoField field;
+ jvmtiHeapReferenceInfoArray array;
+ jvmtiHeapReferenceInfoConstantPool constant_pool;
+ jvmtiHeapReferenceInfoStackLocal stack_local;
+ jvmtiHeapReferenceInfoJniLocal jni_local;
+ jvmtiHeapReferenceInfoReserved other;
+};
+struct _jvmtiHeapCallbacks {
+ jvmtiHeapIterationCallback heap_iteration_callback;
+ jvmtiHeapReferenceCallback heap_reference_callback;
+ jvmtiPrimitiveFieldCallback primitive_field_callback;
+ jvmtiArrayPrimitiveValueCallback array_primitive_value_callback;
+ jvmtiStringPrimitiveValueCallback string_primitive_value_callback;
+ jvmtiReservedCallback reserved5;
+ jvmtiReservedCallback reserved6;
+ jvmtiReservedCallback reserved7;
+ jvmtiReservedCallback reserved8;
+ jvmtiReservedCallback reserved9;
+ jvmtiReservedCallback reserved10;
+ jvmtiReservedCallback reserved11;
+ jvmtiReservedCallback reserved12;
+ jvmtiReservedCallback reserved13;
+ jvmtiReservedCallback reserved14;
+ jvmtiReservedCallback reserved15;
+};
+struct _jvmtiClassDefinition {
+ jclass klass;
+ jint class_byte_count;
+ const unsigned char* class_bytes;
+};
+struct _jvmtiMonitorUsage {
+ jthread owner;
+ jint entry_count;
+ jint waiter_count;
+ jthread* waiters;
+ jint notify_waiter_count;
+ jthread* notify_waiters;
+};
+struct _jvmtiLineNumberEntry {
+ jlocation start_location;
+ jint line_number;
+};
+struct _jvmtiLocalVariableEntry {
+ jlocation start_location;
+ jint length;
+ char* name;
+ char* signature;
+ char* generic_signature;
+ jint slot;
+};
+struct _jvmtiParamInfo {
+ char* name;
+ jvmtiParamKind kind;
+ jvmtiParamTypes base_type;
+ jboolean null_ok;
+};
+struct _jvmtiExtensionFunctionInfo {
+ jvmtiExtensionFunction func;
+ char* id;
+ char* short_description;
+ jint param_count;
+ jvmtiParamInfo* params;
+ jint error_count;
+ jvmtiError* errors;
+};
+struct _jvmtiExtensionEventInfo {
+ jint extension_event_index;
+ char* id;
+ char* short_description;
+ jint param_count;
+ jvmtiParamInfo* params;
+};
+struct _jvmtiTimerInfo {
+ jlong max_value;
+ jboolean may_skip_forward;
+ jboolean may_skip_backward;
+ jvmtiTimerKind kind;
+ jlong reserved1;
+ jlong reserved2;
+};
+struct _jvmtiAddrLocationMap {
+ const void* start_address;
+ jlocation location;
+};
+
+typedef struct {
+ unsigned int can_tag_objects : 1;
+ unsigned int can_generate_field_modification_events : 1;
+ unsigned int can_generate_field_access_events : 1;
+ unsigned int can_get_bytecodes : 1;
+ unsigned int can_get_synthetic_attribute : 1;
+ unsigned int can_get_owned_monitor_info : 1;
+ unsigned int can_get_current_contended_monitor : 1;
+ unsigned int can_get_monitor_info : 1;
+ unsigned int can_pop_frame : 1;
+ unsigned int can_redefine_classes : 1;
+ unsigned int can_signal_thread : 1;
+ unsigned int can_get_source_file_name : 1;
+ unsigned int can_get_line_numbers : 1;
+ unsigned int can_get_source_debug_extension : 1;
+ unsigned int can_access_local_variables : 1;
+ unsigned int can_maintain_original_method_order : 1;
+ unsigned int can_generate_single_step_events : 1;
+ unsigned int can_generate_exception_events : 1;
+ unsigned int can_generate_frame_pop_events : 1;
+ unsigned int can_generate_breakpoint_events : 1;
+ unsigned int can_suspend : 1;
+ unsigned int can_redefine_any_class : 1;
+ unsigned int can_get_current_thread_cpu_time : 1;
+ unsigned int can_get_thread_cpu_time : 1;
+ unsigned int can_generate_method_entry_events : 1;
+ unsigned int can_generate_method_exit_events : 1;
+ unsigned int can_generate_all_class_hook_events : 1;
+ unsigned int can_generate_compiled_method_load_events : 1;
+ unsigned int can_generate_monitor_events : 1;
+ unsigned int can_generate_vm_object_alloc_events : 1;
+ unsigned int can_generate_native_method_bind_events : 1;
+ unsigned int can_generate_garbage_collection_events : 1;
+ unsigned int can_generate_object_free_events : 1;
+ unsigned int can_force_early_return : 1;
+ unsigned int can_get_owned_monitor_stack_depth_info : 1;
+ unsigned int can_get_constant_pool : 1;
+ unsigned int can_set_native_method_prefix : 1;
+ unsigned int can_retransform_classes : 1;
+ unsigned int can_retransform_any_class : 1;
+ unsigned int can_generate_resource_exhaustion_heap_events : 1;
+ unsigned int can_generate_resource_exhaustion_threads_events : 1;
+ unsigned int : 7;
+ unsigned int : 16;
+ unsigned int : 16;
+ unsigned int : 16;
+ unsigned int : 16;
+ unsigned int : 16;
+} jvmtiCapabilities;
+
+
+ /* Event Definitions */
+
+typedef void (JNICALL *jvmtiEventReserved)(void);
+
+
+typedef void (JNICALL *jvmtiEventBreakpoint)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location);
+
+typedef void (JNICALL *jvmtiEventClassFileLoadHook)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jclass class_being_redefined,
+ jobject loader,
+ const char* name,
+ jobject protection_domain,
+ jint class_data_len,
+ const unsigned char* class_data,
+ jint* new_class_data_len,
+ unsigned char** new_class_data);
+
+typedef void (JNICALL *jvmtiEventClassLoad)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jclass klass);
+
+typedef void (JNICALL *jvmtiEventClassPrepare)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jclass klass);
+
+typedef void (JNICALL *jvmtiEventCompiledMethodLoad)
+ (jvmtiEnv *jvmti_env,
+ jmethodID method,
+ jint code_size,
+ const void* code_addr,
+ jint map_length,
+ const jvmtiAddrLocationMap* map,
+ const void* compile_info);
+
+typedef void (JNICALL *jvmtiEventCompiledMethodUnload)
+ (jvmtiEnv *jvmti_env,
+ jmethodID method,
+ const void* code_addr);
+
+typedef void (JNICALL *jvmtiEventDataDumpRequest)
+ (jvmtiEnv *jvmti_env);
+
+typedef void (JNICALL *jvmtiEventDynamicCodeGenerated)
+ (jvmtiEnv *jvmti_env,
+ const char* name,
+ const void* address,
+ jint length);
+
+typedef void (JNICALL *jvmtiEventException)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jobject exception,
+ jmethodID catch_method,
+ jlocation catch_location);
+
+typedef void (JNICALL *jvmtiEventExceptionCatch)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jobject exception);
+
+typedef void (JNICALL *jvmtiEventFieldAccess)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jclass field_klass,
+ jobject object,
+ jfieldID field);
+
+typedef void (JNICALL *jvmtiEventFieldModification)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location,
+ jclass field_klass,
+ jobject object,
+ jfieldID field,
+ char signature_type,
+ jvalue new_value);
+
+typedef void (JNICALL *jvmtiEventFramePop)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jboolean was_popped_by_exception);
+
+typedef void (JNICALL *jvmtiEventGarbageCollectionFinish)
+ (jvmtiEnv *jvmti_env);
+
+typedef void (JNICALL *jvmtiEventGarbageCollectionStart)
+ (jvmtiEnv *jvmti_env);
+
+typedef void (JNICALL *jvmtiEventMethodEntry)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method);
+
+typedef void (JNICALL *jvmtiEventMethodExit)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jboolean was_popped_by_exception,
+ jvalue return_value);
+
+typedef void (JNICALL *jvmtiEventMonitorContendedEnter)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object);
+
+typedef void (JNICALL *jvmtiEventMonitorContendedEntered)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object);
+
+typedef void (JNICALL *jvmtiEventMonitorWait)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object,
+ jlong timeout);
+
+typedef void (JNICALL *jvmtiEventMonitorWaited)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object,
+ jboolean timed_out);
+
+typedef void (JNICALL *jvmtiEventNativeMethodBind)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ void* address,
+ void** new_address_ptr);
+
+typedef void (JNICALL *jvmtiEventObjectFree)
+ (jvmtiEnv *jvmti_env,
+ jlong tag);
+
+typedef void (JNICALL *jvmtiEventResourceExhausted)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jint flags,
+ const void* reserved,
+ const char* description);
+
+typedef void (JNICALL *jvmtiEventSingleStep)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jmethodID method,
+ jlocation location);
+
+typedef void (JNICALL *jvmtiEventThreadEnd)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread);
+
+typedef void (JNICALL *jvmtiEventThreadStart)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread);
+
+typedef void (JNICALL *jvmtiEventVMDeath)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env);
+
+typedef void (JNICALL *jvmtiEventVMInit)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread);
+
+typedef void (JNICALL *jvmtiEventVMObjectAlloc)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env,
+ jthread thread,
+ jobject object,
+ jclass object_klass,
+ jlong size);
+
+typedef void (JNICALL *jvmtiEventVMStart)
+ (jvmtiEnv *jvmti_env,
+ JNIEnv* jni_env);
+
+ /* Event Callback Structure */
+
+typedef struct {
+ /* 50 : VM Initialization Event */
+ jvmtiEventVMInit VMInit;
+ /* 51 : VM Death Event */
+ jvmtiEventVMDeath VMDeath;
+ /* 52 : Thread Start */
+ jvmtiEventThreadStart ThreadStart;
+ /* 53 : Thread End */
+ jvmtiEventThreadEnd ThreadEnd;
+ /* 54 : Class File Load Hook */
+ jvmtiEventClassFileLoadHook ClassFileLoadHook;
+ /* 55 : Class Load */
+ jvmtiEventClassLoad ClassLoad;
+ /* 56 : Class Prepare */
+ jvmtiEventClassPrepare ClassPrepare;
+ /* 57 : VM Start Event */
+ jvmtiEventVMStart VMStart;
+ /* 58 : Exception */
+ jvmtiEventException Exception;
+ /* 59 : Exception Catch */
+ jvmtiEventExceptionCatch ExceptionCatch;
+ /* 60 : Single Step */
+ jvmtiEventSingleStep SingleStep;
+ /* 61 : Frame Pop */
+ jvmtiEventFramePop FramePop;
+ /* 62 : Breakpoint */
+ jvmtiEventBreakpoint Breakpoint;
+ /* 63 : Field Access */
+ jvmtiEventFieldAccess FieldAccess;
+ /* 64 : Field Modification */
+ jvmtiEventFieldModification FieldModification;
+ /* 65 : Method Entry */
+ jvmtiEventMethodEntry MethodEntry;
+ /* 66 : Method Exit */
+ jvmtiEventMethodExit MethodExit;
+ /* 67 : Native Method Bind */
+ jvmtiEventNativeMethodBind NativeMethodBind;
+ /* 68 : Compiled Method Load */
+ jvmtiEventCompiledMethodLoad CompiledMethodLoad;
+ /* 69 : Compiled Method Unload */
+ jvmtiEventCompiledMethodUnload CompiledMethodUnload;
+ /* 70 : Dynamic Code Generated */
+ jvmtiEventDynamicCodeGenerated DynamicCodeGenerated;
+ /* 71 : Data Dump Request */
+ jvmtiEventDataDumpRequest DataDumpRequest;
+ /* 72 */
+ jvmtiEventReserved reserved72;
+ /* 73 : Monitor Wait */
+ jvmtiEventMonitorWait MonitorWait;
+ /* 74 : Monitor Waited */
+ jvmtiEventMonitorWaited MonitorWaited;
+ /* 75 : Monitor Contended Enter */
+ jvmtiEventMonitorContendedEnter MonitorContendedEnter;
+ /* 76 : Monitor Contended Entered */
+ jvmtiEventMonitorContendedEntered MonitorContendedEntered;
+ /* 77 */
+ jvmtiEventReserved reserved77;
+ /* 78 */
+ jvmtiEventReserved reserved78;
+ /* 79 */
+ jvmtiEventReserved reserved79;
+ /* 80 : Resource Exhausted */
+ jvmtiEventResourceExhausted ResourceExhausted;
+ /* 81 : Garbage Collection Start */
+ jvmtiEventGarbageCollectionStart GarbageCollectionStart;
+ /* 82 : Garbage Collection Finish */
+ jvmtiEventGarbageCollectionFinish GarbageCollectionFinish;
+ /* 83 : Object Free */
+ jvmtiEventObjectFree ObjectFree;
+ /* 84 : VM Object Allocation */
+ jvmtiEventVMObjectAlloc VMObjectAlloc;
+} jvmtiEventCallbacks;
+
+
+ /* Function Interface */
+
+typedef struct jvmtiInterface_1_ {
+
+ /* 1 : RESERVED */
+ void *reserved1;
+
+ /* 2 : Set Event Notification Mode */
+ jvmtiError (JNICALL *SetEventNotificationMode) (jvmtiEnv* env,
+ jvmtiEventMode mode,
+ jvmtiEvent event_type,
+ jthread event_thread,
+ ...);
+
+ /* 3 : RESERVED */
+ void *reserved3;
+
+ /* 4 : Get All Threads */
+ jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env,
+ jint* threads_count_ptr,
+ jthread** threads_ptr);
+
+ /* 5 : Suspend Thread */
+ jvmtiError (JNICALL *SuspendThread) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 6 : Resume Thread */
+ jvmtiError (JNICALL *ResumeThread) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 7 : Stop Thread */
+ jvmtiError (JNICALL *StopThread) (jvmtiEnv* env,
+ jthread thread,
+ jobject exception);
+
+ /* 8 : Interrupt Thread */
+ jvmtiError (JNICALL *InterruptThread) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 9 : Get Thread Info */
+ jvmtiError (JNICALL *GetThreadInfo) (jvmtiEnv* env,
+ jthread thread,
+ jvmtiThreadInfo* info_ptr);
+
+ /* 10 : Get Owned Monitor Info */
+ jvmtiError (JNICALL *GetOwnedMonitorInfo) (jvmtiEnv* env,
+ jthread thread,
+ jint* owned_monitor_count_ptr,
+ jobject** owned_monitors_ptr);
+
+ /* 11 : Get Current Contended Monitor */
+ jvmtiError (JNICALL *GetCurrentContendedMonitor) (jvmtiEnv* env,
+ jthread thread,
+ jobject* monitor_ptr);
+
+ /* 12 : Run Agent Thread */
+ jvmtiError (JNICALL *RunAgentThread) (jvmtiEnv* env,
+ jthread thread,
+ jvmtiStartFunction proc,
+ const void* arg,
+ jint priority);
+
+ /* 13 : Get Top Thread Groups */
+ jvmtiError (JNICALL *GetTopThreadGroups) (jvmtiEnv* env,
+ jint* group_count_ptr,
+ jthreadGroup** groups_ptr);
+
+ /* 14 : Get Thread Group Info */
+ jvmtiError (JNICALL *GetThreadGroupInfo) (jvmtiEnv* env,
+ jthreadGroup group,
+ jvmtiThreadGroupInfo* info_ptr);
+
+ /* 15 : Get Thread Group Children */
+ jvmtiError (JNICALL *GetThreadGroupChildren) (jvmtiEnv* env,
+ jthreadGroup group,
+ jint* thread_count_ptr,
+ jthread** threads_ptr,
+ jint* group_count_ptr,
+ jthreadGroup** groups_ptr);
+
+ /* 16 : Get Frame Count */
+ jvmtiError (JNICALL *GetFrameCount) (jvmtiEnv* env,
+ jthread thread,
+ jint* count_ptr);
+
+ /* 17 : Get Thread State */
+ jvmtiError (JNICALL *GetThreadState) (jvmtiEnv* env,
+ jthread thread,
+ jint* thread_state_ptr);
+
+ /* 18 : Get Current Thread */
+ jvmtiError (JNICALL *GetCurrentThread) (jvmtiEnv* env,
+ jthread* thread_ptr);
+
+ /* 19 : Get Frame Location */
+ jvmtiError (JNICALL *GetFrameLocation) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jmethodID* method_ptr,
+ jlocation* location_ptr);
+
+ /* 20 : Notify Frame Pop */
+ jvmtiError (JNICALL *NotifyFramePop) (jvmtiEnv* env,
+ jthread thread,
+ jint depth);
+
+ /* 21 : Get Local Variable - Object */
+ jvmtiError (JNICALL *GetLocalObject) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jobject* value_ptr);
+
+ /* 22 : Get Local Variable - Int */
+ jvmtiError (JNICALL *GetLocalInt) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jint* value_ptr);
+
+ /* 23 : Get Local Variable - Long */
+ jvmtiError (JNICALL *GetLocalLong) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jlong* value_ptr);
+
+ /* 24 : Get Local Variable - Float */
+ jvmtiError (JNICALL *GetLocalFloat) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jfloat* value_ptr);
+
+ /* 25 : Get Local Variable - Double */
+ jvmtiError (JNICALL *GetLocalDouble) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jdouble* value_ptr);
+
+ /* 26 : Set Local Variable - Object */
+ jvmtiError (JNICALL *SetLocalObject) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jobject value);
+
+ /* 27 : Set Local Variable - Int */
+ jvmtiError (JNICALL *SetLocalInt) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jint value);
+
+ /* 28 : Set Local Variable - Long */
+ jvmtiError (JNICALL *SetLocalLong) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jlong value);
+
+ /* 29 : Set Local Variable - Float */
+ jvmtiError (JNICALL *SetLocalFloat) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jfloat value);
+
+ /* 30 : Set Local Variable - Double */
+ jvmtiError (JNICALL *SetLocalDouble) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jint slot,
+ jdouble value);
+
+ /* 31 : Create Raw Monitor */
+ jvmtiError (JNICALL *CreateRawMonitor) (jvmtiEnv* env,
+ const char* name,
+ jrawMonitorID* monitor_ptr);
+
+ /* 32 : Destroy Raw Monitor */
+ jvmtiError (JNICALL *DestroyRawMonitor) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 33 : Raw Monitor Enter */
+ jvmtiError (JNICALL *RawMonitorEnter) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 34 : Raw Monitor Exit */
+ jvmtiError (JNICALL *RawMonitorExit) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 35 : Raw Monitor Wait */
+ jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv* env,
+ jrawMonitorID monitor,
+ jlong millis);
+
+ /* 36 : Raw Monitor Notify */
+ jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 37 : Raw Monitor Notify All */
+ jvmtiError (JNICALL *RawMonitorNotifyAll) (jvmtiEnv* env,
+ jrawMonitorID monitor);
+
+ /* 38 : Set Breakpoint */
+ jvmtiError (JNICALL *SetBreakpoint) (jvmtiEnv* env,
+ jmethodID method,
+ jlocation location);
+
+ /* 39 : Clear Breakpoint */
+ jvmtiError (JNICALL *ClearBreakpoint) (jvmtiEnv* env,
+ jmethodID method,
+ jlocation location);
+
+ /* 40 : RESERVED */
+ void *reserved40;
+
+ /* 41 : Set Field Access Watch */
+ jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 42 : Clear Field Access Watch */
+ jvmtiError (JNICALL *ClearFieldAccessWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 43 : Set Field Modification Watch */
+ jvmtiError (JNICALL *SetFieldModificationWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 44 : Clear Field Modification Watch */
+ jvmtiError (JNICALL *ClearFieldModificationWatch) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field);
+
+ /* 45 : Is Modifiable Class */
+ jvmtiError (JNICALL *IsModifiableClass) (jvmtiEnv* env,
+ jclass klass,
+ jboolean* is_modifiable_class_ptr);
+
+ /* 46 : Allocate */
+ jvmtiError (JNICALL *Allocate) (jvmtiEnv* env,
+ jlong size,
+ unsigned char** mem_ptr);
+
+ /* 47 : Deallocate */
+ jvmtiError (JNICALL *Deallocate) (jvmtiEnv* env,
+ unsigned char* mem);
+
+ /* 48 : Get Class Signature */
+ jvmtiError (JNICALL *GetClassSignature) (jvmtiEnv* env,
+ jclass klass,
+ char** signature_ptr,
+ char** generic_ptr);
+
+ /* 49 : Get Class Status */
+ jvmtiError (JNICALL *GetClassStatus) (jvmtiEnv* env,
+ jclass klass,
+ jint* status_ptr);
+
+ /* 50 : Get Source File Name */
+ jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv* env,
+ jclass klass,
+ char** source_name_ptr);
+
+ /* 51 : Get Class Modifiers */
+ jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv* env,
+ jclass klass,
+ jint* modifiers_ptr);
+
+ /* 52 : Get Class Methods */
+ jvmtiError (JNICALL *GetClassMethods) (jvmtiEnv* env,
+ jclass klass,
+ jint* method_count_ptr,
+ jmethodID** methods_ptr);
+
+ /* 53 : Get Class Fields */
+ jvmtiError (JNICALL *GetClassFields) (jvmtiEnv* env,
+ jclass klass,
+ jint* field_count_ptr,
+ jfieldID** fields_ptr);
+
+ /* 54 : Get Implemented Interfaces */
+ jvmtiError (JNICALL *GetImplementedInterfaces) (jvmtiEnv* env,
+ jclass klass,
+ jint* interface_count_ptr,
+ jclass** interfaces_ptr);
+
+ /* 55 : Is Interface */
+ jvmtiError (JNICALL *IsInterface) (jvmtiEnv* env,
+ jclass klass,
+ jboolean* is_interface_ptr);
+
+ /* 56 : Is Array Class */
+ jvmtiError (JNICALL *IsArrayClass) (jvmtiEnv* env,
+ jclass klass,
+ jboolean* is_array_class_ptr);
+
+ /* 57 : Get Class Loader */
+ jvmtiError (JNICALL *GetClassLoader) (jvmtiEnv* env,
+ jclass klass,
+ jobject* classloader_ptr);
+
+ /* 58 : Get Object Hash Code */
+ jvmtiError (JNICALL *GetObjectHashCode) (jvmtiEnv* env,
+ jobject object,
+ jint* hash_code_ptr);
+
+ /* 59 : Get Object Monitor Usage */
+ jvmtiError (JNICALL *GetObjectMonitorUsage) (jvmtiEnv* env,
+ jobject object,
+ jvmtiMonitorUsage* info_ptr);
+
+ /* 60 : Get Field Name (and Signature) */
+ jvmtiError (JNICALL *GetFieldName) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr);
+
+ /* 61 : Get Field Declaring Class */
+ jvmtiError (JNICALL *GetFieldDeclaringClass) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ jclass* declaring_class_ptr);
+
+ /* 62 : Get Field Modifiers */
+ jvmtiError (JNICALL *GetFieldModifiers) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ jint* modifiers_ptr);
+
+ /* 63 : Is Field Synthetic */
+ jvmtiError (JNICALL *IsFieldSynthetic) (jvmtiEnv* env,
+ jclass klass,
+ jfieldID field,
+ jboolean* is_synthetic_ptr);
+
+ /* 64 : Get Method Name (and Signature) */
+ jvmtiError (JNICALL *GetMethodName) (jvmtiEnv* env,
+ jmethodID method,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr);
+
+ /* 65 : Get Method Declaring Class */
+ jvmtiError (JNICALL *GetMethodDeclaringClass) (jvmtiEnv* env,
+ jmethodID method,
+ jclass* declaring_class_ptr);
+
+ /* 66 : Get Method Modifiers */
+ jvmtiError (JNICALL *GetMethodModifiers) (jvmtiEnv* env,
+ jmethodID method,
+ jint* modifiers_ptr);
+
+ /* 67 : RESERVED */
+ void *reserved67;
+
+ /* 68 : Get Max Locals */
+ jvmtiError (JNICALL *GetMaxLocals) (jvmtiEnv* env,
+ jmethodID method,
+ jint* max_ptr);
+
+ /* 69 : Get Arguments Size */
+ jvmtiError (JNICALL *GetArgumentsSize) (jvmtiEnv* env,
+ jmethodID method,
+ jint* size_ptr);
+
+ /* 70 : Get Line Number Table */
+ jvmtiError (JNICALL *GetLineNumberTable) (jvmtiEnv* env,
+ jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLineNumberEntry** table_ptr);
+
+ /* 71 : Get Method Location */
+ jvmtiError (JNICALL *GetMethodLocation) (jvmtiEnv* env,
+ jmethodID method,
+ jlocation* start_location_ptr,
+ jlocation* end_location_ptr);
+
+ /* 72 : Get Local Variable Table */
+ jvmtiError (JNICALL *GetLocalVariableTable) (jvmtiEnv* env,
+ jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLocalVariableEntry** table_ptr);
+
+ /* 73 : Set Native Method Prefix */
+ jvmtiError (JNICALL *SetNativeMethodPrefix) (jvmtiEnv* env,
+ const char* prefix);
+
+ /* 74 : Set Native Method Prefixes */
+ jvmtiError (JNICALL *SetNativeMethodPrefixes) (jvmtiEnv* env,
+ jint prefix_count,
+ char** prefixes);
+
+ /* 75 : Get Bytecodes */
+ jvmtiError (JNICALL *GetBytecodes) (jvmtiEnv* env,
+ jmethodID method,
+ jint* bytecode_count_ptr,
+ unsigned char** bytecodes_ptr);
+
+ /* 76 : Is Method Native */
+ jvmtiError (JNICALL *IsMethodNative) (jvmtiEnv* env,
+ jmethodID method,
+ jboolean* is_native_ptr);
+
+ /* 77 : Is Method Synthetic */
+ jvmtiError (JNICALL *IsMethodSynthetic) (jvmtiEnv* env,
+ jmethodID method,
+ jboolean* is_synthetic_ptr);
+
+ /* 78 : Get Loaded Classes */
+ jvmtiError (JNICALL *GetLoadedClasses) (jvmtiEnv* env,
+ jint* class_count_ptr,
+ jclass** classes_ptr);
+
+ /* 79 : Get Classloader Classes */
+ jvmtiError (JNICALL *GetClassLoaderClasses) (jvmtiEnv* env,
+ jobject initiating_loader,
+ jint* class_count_ptr,
+ jclass** classes_ptr);
+
+ /* 80 : Pop Frame */
+ jvmtiError (JNICALL *PopFrame) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 81 : Force Early Return - Object */
+ jvmtiError (JNICALL *ForceEarlyReturnObject) (jvmtiEnv* env,
+ jthread thread,
+ jobject value);
+
+ /* 82 : Force Early Return - Int */
+ jvmtiError (JNICALL *ForceEarlyReturnInt) (jvmtiEnv* env,
+ jthread thread,
+ jint value);
+
+ /* 83 : Force Early Return - Long */
+ jvmtiError (JNICALL *ForceEarlyReturnLong) (jvmtiEnv* env,
+ jthread thread,
+ jlong value);
+
+ /* 84 : Force Early Return - Float */
+ jvmtiError (JNICALL *ForceEarlyReturnFloat) (jvmtiEnv* env,
+ jthread thread,
+ jfloat value);
+
+ /* 85 : Force Early Return - Double */
+ jvmtiError (JNICALL *ForceEarlyReturnDouble) (jvmtiEnv* env,
+ jthread thread,
+ jdouble value);
+
+ /* 86 : Force Early Return - Void */
+ jvmtiError (JNICALL *ForceEarlyReturnVoid) (jvmtiEnv* env,
+ jthread thread);
+
+ /* 87 : Redefine Classes */
+ jvmtiError (JNICALL *RedefineClasses) (jvmtiEnv* env,
+ jint class_count,
+ const jvmtiClassDefinition* class_definitions);
+
+ /* 88 : Get Version Number */
+ jvmtiError (JNICALL *GetVersionNumber) (jvmtiEnv* env,
+ jint* version_ptr);
+
+ /* 89 : Get Capabilities */
+ jvmtiError (JNICALL *GetCapabilities) (jvmtiEnv* env,
+ jvmtiCapabilities* capabilities_ptr);
+
+ /* 90 : Get Source Debug Extension */
+ jvmtiError (JNICALL *GetSourceDebugExtension) (jvmtiEnv* env,
+ jclass klass,
+ char** source_debug_extension_ptr);
+
+ /* 91 : Is Method Obsolete */
+ jvmtiError (JNICALL *IsMethodObsolete) (jvmtiEnv* env,
+ jmethodID method,
+ jboolean* is_obsolete_ptr);
+
+ /* 92 : Suspend Thread List */
+ jvmtiError (JNICALL *SuspendThreadList) (jvmtiEnv* env,
+ jint request_count,
+ const jthread* request_list,
+ jvmtiError* results);
+
+ /* 93 : Resume Thread List */
+ jvmtiError (JNICALL *ResumeThreadList) (jvmtiEnv* env,
+ jint request_count,
+ const jthread* request_list,
+ jvmtiError* results);
+
+ /* 94 : RESERVED */
+ void *reserved94;
+
+ /* 95 : RESERVED */
+ void *reserved95;
+
+ /* 96 : RESERVED */
+ void *reserved96;
+
+ /* 97 : RESERVED */
+ void *reserved97;
+
+ /* 98 : RESERVED */
+ void *reserved98;
+
+ /* 99 : RESERVED */
+ void *reserved99;
+
+ /* 100 : Get All Stack Traces */
+ jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env,
+ jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr,
+ jint* thread_count_ptr);
+
+ /* 101 : Get Thread List Stack Traces */
+ jvmtiError (JNICALL *GetThreadListStackTraces) (jvmtiEnv* env,
+ jint thread_count,
+ const jthread* thread_list,
+ jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr);
+
+ /* 102 : Get Thread Local Storage */
+ jvmtiError (JNICALL *GetThreadLocalStorage) (jvmtiEnv* env,
+ jthread thread,
+ void** data_ptr);
+
+ /* 103 : Set Thread Local Storage */
+ jvmtiError (JNICALL *SetThreadLocalStorage) (jvmtiEnv* env,
+ jthread thread,
+ const void* data);
+
+ /* 104 : Get Stack Trace */
+ jvmtiError (JNICALL *GetStackTrace) (jvmtiEnv* env,
+ jthread thread,
+ jint start_depth,
+ jint max_frame_count,
+ jvmtiFrameInfo* frame_buffer,
+ jint* count_ptr);
+
+ /* 105 : RESERVED */
+ void *reserved105;
+
+ /* 106 : Get Tag */
+ jvmtiError (JNICALL *GetTag) (jvmtiEnv* env,
+ jobject object,
+ jlong* tag_ptr);
+
+ /* 107 : Set Tag */
+ jvmtiError (JNICALL *SetTag) (jvmtiEnv* env,
+ jobject object,
+ jlong tag);
+
+ /* 108 : Force Garbage Collection */
+ jvmtiError (JNICALL *ForceGarbageCollection) (jvmtiEnv* env);
+
+ /* 109 : Iterate Over Objects Reachable From Object */
+ jvmtiError (JNICALL *IterateOverObjectsReachableFromObject) (jvmtiEnv* env,
+ jobject object,
+ jvmtiObjectReferenceCallback object_reference_callback,
+ const void* user_data);
+
+ /* 110 : Iterate Over Reachable Objects */
+ jvmtiError (JNICALL *IterateOverReachableObjects) (jvmtiEnv* env,
+ jvmtiHeapRootCallback heap_root_callback,
+ jvmtiStackReferenceCallback stack_ref_callback,
+ jvmtiObjectReferenceCallback object_ref_callback,
+ const void* user_data);
+
+ /* 111 : Iterate Over Heap */
+ jvmtiError (JNICALL *IterateOverHeap) (jvmtiEnv* env,
+ jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data);
+
+ /* 112 : Iterate Over Instances Of Class */
+ jvmtiError (JNICALL *IterateOverInstancesOfClass) (jvmtiEnv* env,
+ jclass klass,
+ jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data);
+
+ /* 113 : RESERVED */
+ void *reserved113;
+
+ /* 114 : Get Objects With Tags */
+ jvmtiError (JNICALL *GetObjectsWithTags) (jvmtiEnv* env,
+ jint tag_count,
+ const jlong* tags,
+ jint* count_ptr,
+ jobject** object_result_ptr,
+ jlong** tag_result_ptr);
+
+ /* 115 : Follow References */
+ jvmtiError (JNICALL *FollowReferences) (jvmtiEnv* env,
+ jint heap_filter,
+ jclass klass,
+ jobject initial_object,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data);
+
+ /* 116 : Iterate Through Heap */
+ jvmtiError (JNICALL *IterateThroughHeap) (jvmtiEnv* env,
+ jint heap_filter,
+ jclass klass,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data);
+
+ /* 117 : RESERVED */
+ void *reserved117;
+
+ /* 118 : RESERVED */
+ void *reserved118;
+
+ /* 119 : RESERVED */
+ void *reserved119;
+
+ /* 120 : Set JNI Function Table */
+ jvmtiError (JNICALL *SetJNIFunctionTable) (jvmtiEnv* env,
+ const jniNativeInterface* function_table);
+
+ /* 121 : Get JNI Function Table */
+ jvmtiError (JNICALL *GetJNIFunctionTable) (jvmtiEnv* env,
+ jniNativeInterface** function_table);
+
+ /* 122 : Set Event Callbacks */
+ jvmtiError (JNICALL *SetEventCallbacks) (jvmtiEnv* env,
+ const jvmtiEventCallbacks* callbacks,
+ jint size_of_callbacks);
+
+ /* 123 : Generate Events */
+ jvmtiError (JNICALL *GenerateEvents) (jvmtiEnv* env,
+ jvmtiEvent event_type);
+
+ /* 124 : Get Extension Functions */
+ jvmtiError (JNICALL *GetExtensionFunctions) (jvmtiEnv* env,
+ jint* extension_count_ptr,
+ jvmtiExtensionFunctionInfo** extensions);
+
+ /* 125 : Get Extension Events */
+ jvmtiError (JNICALL *GetExtensionEvents) (jvmtiEnv* env,
+ jint* extension_count_ptr,
+ jvmtiExtensionEventInfo** extensions);
+
+ /* 126 : Set Extension Event Callback */
+ jvmtiError (JNICALL *SetExtensionEventCallback) (jvmtiEnv* env,
+ jint extension_event_index,
+ jvmtiExtensionEvent callback);
+
+ /* 127 : Dispose Environment */
+ jvmtiError (JNICALL *DisposeEnvironment) (jvmtiEnv* env);
+
+ /* 128 : Get Error Name */
+ jvmtiError (JNICALL *GetErrorName) (jvmtiEnv* env,
+ jvmtiError error,
+ char** name_ptr);
+
+ /* 129 : Get JLocation Format */
+ jvmtiError (JNICALL *GetJLocationFormat) (jvmtiEnv* env,
+ jvmtiJlocationFormat* format_ptr);
+
+ /* 130 : Get System Properties */
+ jvmtiError (JNICALL *GetSystemProperties) (jvmtiEnv* env,
+ jint* count_ptr,
+ char*** property_ptr);
+
+ /* 131 : Get System Property */
+ jvmtiError (JNICALL *GetSystemProperty) (jvmtiEnv* env,
+ const char* property,
+ char** value_ptr);
+
+ /* 132 : Set System Property */
+ jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env,
+ const char* property,
+ const char* value);
+
+ /* 133 : Get Phase */
+ jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env,
+ jvmtiPhase* phase_ptr);
+
+ /* 134 : Get Current Thread CPU Timer Information */
+ jvmtiError (JNICALL *GetCurrentThreadCpuTimerInfo) (jvmtiEnv* env,
+ jvmtiTimerInfo* info_ptr);
+
+ /* 135 : Get Current Thread CPU Time */
+ jvmtiError (JNICALL *GetCurrentThreadCpuTime) (jvmtiEnv* env,
+ jlong* nanos_ptr);
+
+ /* 136 : Get Thread CPU Timer Information */
+ jvmtiError (JNICALL *GetThreadCpuTimerInfo) (jvmtiEnv* env,
+ jvmtiTimerInfo* info_ptr);
+
+ /* 137 : Get Thread CPU Time */
+ jvmtiError (JNICALL *GetThreadCpuTime) (jvmtiEnv* env,
+ jthread thread,
+ jlong* nanos_ptr);
+
+ /* 138 : Get Timer Information */
+ jvmtiError (JNICALL *GetTimerInfo) (jvmtiEnv* env,
+ jvmtiTimerInfo* info_ptr);
+
+ /* 139 : Get Time */
+ jvmtiError (JNICALL *GetTime) (jvmtiEnv* env,
+ jlong* nanos_ptr);
+
+ /* 140 : Get Potential Capabilities */
+ jvmtiError (JNICALL *GetPotentialCapabilities) (jvmtiEnv* env,
+ jvmtiCapabilities* capabilities_ptr);
+
+ /* 141 : RESERVED */
+ void *reserved141;
+
+ /* 142 : Add Capabilities */
+ jvmtiError (JNICALL *AddCapabilities) (jvmtiEnv* env,
+ const jvmtiCapabilities* capabilities_ptr);
+
+ /* 143 : Relinquish Capabilities */
+ jvmtiError (JNICALL *RelinquishCapabilities) (jvmtiEnv* env,
+ const jvmtiCapabilities* capabilities_ptr);
+
+ /* 144 : Get Available Processors */
+ jvmtiError (JNICALL *GetAvailableProcessors) (jvmtiEnv* env,
+ jint* processor_count_ptr);
+
+ /* 145 : Get Class Version Numbers */
+ jvmtiError (JNICALL *GetClassVersionNumbers) (jvmtiEnv* env,
+ jclass klass,
+ jint* minor_version_ptr,
+ jint* major_version_ptr);
+
+ /* 146 : Get Constant Pool */
+ jvmtiError (JNICALL *GetConstantPool) (jvmtiEnv* env,
+ jclass klass,
+ jint* constant_pool_count_ptr,
+ jint* constant_pool_byte_count_ptr,
+ unsigned char** constant_pool_bytes_ptr);
+
+ /* 147 : Get Environment Local Storage */
+ jvmtiError (JNICALL *GetEnvironmentLocalStorage) (jvmtiEnv* env,
+ void** data_ptr);
+
+ /* 148 : Set Environment Local Storage */
+ jvmtiError (JNICALL *SetEnvironmentLocalStorage) (jvmtiEnv* env,
+ const void* data);
+
+ /* 149 : Add To Bootstrap Class Loader Search */
+ jvmtiError (JNICALL *AddToBootstrapClassLoaderSearch) (jvmtiEnv* env,
+ const char* segment);
+
+ /* 150 : Set Verbose Flag */
+ jvmtiError (JNICALL *SetVerboseFlag) (jvmtiEnv* env,
+ jvmtiVerboseFlag flag,
+ jboolean value);
+
+ /* 151 : Add To System Class Loader Search */
+ jvmtiError (JNICALL *AddToSystemClassLoaderSearch) (jvmtiEnv* env,
+ const char* segment);
+
+ /* 152 : Retransform Classes */
+ jvmtiError (JNICALL *RetransformClasses) (jvmtiEnv* env,
+ jint class_count,
+ const jclass* classes);
+
+ /* 153 : Get Owned Monitor Stack Depth Info */
+ jvmtiError (JNICALL *GetOwnedMonitorStackDepthInfo) (jvmtiEnv* env,
+ jthread thread,
+ jint* monitor_info_count_ptr,
+ jvmtiMonitorStackDepthInfo** monitor_info_ptr);
+
+ /* 154 : Get Object Size */
+ jvmtiError (JNICALL *GetObjectSize) (jvmtiEnv* env,
+ jobject object,
+ jlong* size_ptr);
+
+ /* 155 : Get Local Instance */
+ jvmtiError (JNICALL *GetLocalInstance) (jvmtiEnv* env,
+ jthread thread,
+ jint depth,
+ jobject* value_ptr);
+
+} jvmtiInterface_1;
+
+struct _jvmtiEnv {
+ const struct jvmtiInterface_1_ *functions;
+#ifdef __cplusplus
+
+
+ jvmtiError Allocate(jlong size,
+ unsigned char** mem_ptr) {
+ return functions->Allocate(this, size, mem_ptr);
+ }
+
+ jvmtiError Deallocate(unsigned char* mem) {
+ return functions->Deallocate(this, mem);
+ }
+
+ jvmtiError GetThreadState(jthread thread,
+ jint* thread_state_ptr) {
+ return functions->GetThreadState(this, thread, thread_state_ptr);
+ }
+
+ jvmtiError GetCurrentThread(jthread* thread_ptr) {
+ return functions->GetCurrentThread(this, thread_ptr);
+ }
+
+ jvmtiError GetAllThreads(jint* threads_count_ptr,
+ jthread** threads_ptr) {
+ return functions->GetAllThreads(this, threads_count_ptr, threads_ptr);
+ }
+
+ jvmtiError SuspendThread(jthread thread) {
+ return functions->SuspendThread(this, thread);
+ }
+
+ jvmtiError SuspendThreadList(jint request_count,
+ const jthread* request_list,
+ jvmtiError* results) {
+ return functions->SuspendThreadList(this, request_count, request_list, results);
+ }
+
+ jvmtiError ResumeThread(jthread thread) {
+ return functions->ResumeThread(this, thread);
+ }
+
+ jvmtiError ResumeThreadList(jint request_count,
+ const jthread* request_list,
+ jvmtiError* results) {
+ return functions->ResumeThreadList(this, request_count, request_list, results);
+ }
+
+ jvmtiError StopThread(jthread thread,
+ jobject exception) {
+ return functions->StopThread(this, thread, exception);
+ }
+
+ jvmtiError InterruptThread(jthread thread) {
+ return functions->InterruptThread(this, thread);
+ }
+
+ jvmtiError GetThreadInfo(jthread thread,
+ jvmtiThreadInfo* info_ptr) {
+ return functions->GetThreadInfo(this, thread, info_ptr);
+ }
+
+ jvmtiError GetOwnedMonitorInfo(jthread thread,
+ jint* owned_monitor_count_ptr,
+ jobject** owned_monitors_ptr) {
+ return functions->GetOwnedMonitorInfo(this, thread, owned_monitor_count_ptr, owned_monitors_ptr);
+ }
+
+ jvmtiError GetOwnedMonitorStackDepthInfo(jthread thread,
+ jint* monitor_info_count_ptr,
+ jvmtiMonitorStackDepthInfo** monitor_info_ptr) {
+ return functions->GetOwnedMonitorStackDepthInfo(this, thread, monitor_info_count_ptr, monitor_info_ptr);
+ }
+
+ jvmtiError GetCurrentContendedMonitor(jthread thread,
+ jobject* monitor_ptr) {
+ return functions->GetCurrentContendedMonitor(this, thread, monitor_ptr);
+ }
+
+ jvmtiError RunAgentThread(jthread thread,
+ jvmtiStartFunction proc,
+ const void* arg,
+ jint priority) {
+ return functions->RunAgentThread(this, thread, proc, arg, priority);
+ }
+
+ jvmtiError SetThreadLocalStorage(jthread thread,
+ const void* data) {
+ return functions->SetThreadLocalStorage(this, thread, data);
+ }
+
+ jvmtiError GetThreadLocalStorage(jthread thread,
+ void** data_ptr) {
+ return functions->GetThreadLocalStorage(this, thread, data_ptr);
+ }
+
+ jvmtiError GetTopThreadGroups(jint* group_count_ptr,
+ jthreadGroup** groups_ptr) {
+ return functions->GetTopThreadGroups(this, group_count_ptr, groups_ptr);
+ }
+
+ jvmtiError GetThreadGroupInfo(jthreadGroup group,
+ jvmtiThreadGroupInfo* info_ptr) {
+ return functions->GetThreadGroupInfo(this, group, info_ptr);
+ }
+
+ jvmtiError GetThreadGroupChildren(jthreadGroup group,
+ jint* thread_count_ptr,
+ jthread** threads_ptr,
+ jint* group_count_ptr,
+ jthreadGroup** groups_ptr) {
+ return functions->GetThreadGroupChildren(this, group, thread_count_ptr, threads_ptr, group_count_ptr, groups_ptr);
+ }
+
+ jvmtiError GetStackTrace(jthread thread,
+ jint start_depth,
+ jint max_frame_count,
+ jvmtiFrameInfo* frame_buffer,
+ jint* count_ptr) {
+ return functions->GetStackTrace(this, thread, start_depth, max_frame_count, frame_buffer, count_ptr);
+ }
+
+ jvmtiError GetAllStackTraces(jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr,
+ jint* thread_count_ptr) {
+ return functions->GetAllStackTraces(this, max_frame_count, stack_info_ptr, thread_count_ptr);
+ }
+
+ jvmtiError GetThreadListStackTraces(jint thread_count,
+ const jthread* thread_list,
+ jint max_frame_count,
+ jvmtiStackInfo** stack_info_ptr) {
+ return functions->GetThreadListStackTraces(this, thread_count, thread_list, max_frame_count, stack_info_ptr);
+ }
+
+ jvmtiError GetFrameCount(jthread thread,
+ jint* count_ptr) {
+ return functions->GetFrameCount(this, thread, count_ptr);
+ }
+
+ jvmtiError PopFrame(jthread thread) {
+ return functions->PopFrame(this, thread);
+ }
+
+ jvmtiError GetFrameLocation(jthread thread,
+ jint depth,
+ jmethodID* method_ptr,
+ jlocation* location_ptr) {
+ return functions->GetFrameLocation(this, thread, depth, method_ptr, location_ptr);
+ }
+
+ jvmtiError NotifyFramePop(jthread thread,
+ jint depth) {
+ return functions->NotifyFramePop(this, thread, depth);
+ }
+
+ jvmtiError ForceEarlyReturnObject(jthread thread,
+ jobject value) {
+ return functions->ForceEarlyReturnObject(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnInt(jthread thread,
+ jint value) {
+ return functions->ForceEarlyReturnInt(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnLong(jthread thread,
+ jlong value) {
+ return functions->ForceEarlyReturnLong(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnFloat(jthread thread,
+ jfloat value) {
+ return functions->ForceEarlyReturnFloat(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnDouble(jthread thread,
+ jdouble value) {
+ return functions->ForceEarlyReturnDouble(this, thread, value);
+ }
+
+ jvmtiError ForceEarlyReturnVoid(jthread thread) {
+ return functions->ForceEarlyReturnVoid(this, thread);
+ }
+
+ jvmtiError FollowReferences(jint heap_filter,
+ jclass klass,
+ jobject initial_object,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data) {
+ return functions->FollowReferences(this, heap_filter, klass, initial_object, callbacks, user_data);
+ }
+
+ jvmtiError IterateThroughHeap(jint heap_filter,
+ jclass klass,
+ const jvmtiHeapCallbacks* callbacks,
+ const void* user_data) {
+ return functions->IterateThroughHeap(this, heap_filter, klass, callbacks, user_data);
+ }
+
+ jvmtiError GetTag(jobject object,
+ jlong* tag_ptr) {
+ return functions->GetTag(this, object, tag_ptr);
+ }
+
+ jvmtiError SetTag(jobject object,
+ jlong tag) {
+ return functions->SetTag(this, object, tag);
+ }
+
+ jvmtiError GetObjectsWithTags(jint tag_count,
+ const jlong* tags,
+ jint* count_ptr,
+ jobject** object_result_ptr,
+ jlong** tag_result_ptr) {
+ return functions->GetObjectsWithTags(this, tag_count, tags, count_ptr, object_result_ptr, tag_result_ptr);
+ }
+
+ jvmtiError ForceGarbageCollection() {
+ return functions->ForceGarbageCollection(this);
+ }
+
+ jvmtiError IterateOverObjectsReachableFromObject(jobject object,
+ jvmtiObjectReferenceCallback object_reference_callback,
+ const void* user_data) {
+ return functions->IterateOverObjectsReachableFromObject(this, object, object_reference_callback, user_data);
+ }
+
+ jvmtiError IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback,
+ jvmtiStackReferenceCallback stack_ref_callback,
+ jvmtiObjectReferenceCallback object_ref_callback,
+ const void* user_data) {
+ return functions->IterateOverReachableObjects(this, heap_root_callback, stack_ref_callback, object_ref_callback, user_data);
+ }
+
+ jvmtiError IterateOverHeap(jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data) {
+ return functions->IterateOverHeap(this, object_filter, heap_object_callback, user_data);
+ }
+
+ jvmtiError IterateOverInstancesOfClass(jclass klass,
+ jvmtiHeapObjectFilter object_filter,
+ jvmtiHeapObjectCallback heap_object_callback,
+ const void* user_data) {
+ return functions->IterateOverInstancesOfClass(this, klass, object_filter, heap_object_callback, user_data);
+ }
+
+ jvmtiError GetLocalObject(jthread thread,
+ jint depth,
+ jint slot,
+ jobject* value_ptr) {
+ return functions->GetLocalObject(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalInstance(jthread thread,
+ jint depth,
+ jobject* value_ptr) {
+ return functions->GetLocalInstance(this, thread, depth, value_ptr);
+ }
+
+ jvmtiError GetLocalInt(jthread thread,
+ jint depth,
+ jint slot,
+ jint* value_ptr) {
+ return functions->GetLocalInt(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalLong(jthread thread,
+ jint depth,
+ jint slot,
+ jlong* value_ptr) {
+ return functions->GetLocalLong(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalFloat(jthread thread,
+ jint depth,
+ jint slot,
+ jfloat* value_ptr) {
+ return functions->GetLocalFloat(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError GetLocalDouble(jthread thread,
+ jint depth,
+ jint slot,
+ jdouble* value_ptr) {
+ return functions->GetLocalDouble(this, thread, depth, slot, value_ptr);
+ }
+
+ jvmtiError SetLocalObject(jthread thread,
+ jint depth,
+ jint slot,
+ jobject value) {
+ return functions->SetLocalObject(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalInt(jthread thread,
+ jint depth,
+ jint slot,
+ jint value) {
+ return functions->SetLocalInt(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalLong(jthread thread,
+ jint depth,
+ jint slot,
+ jlong value) {
+ return functions->SetLocalLong(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalFloat(jthread thread,
+ jint depth,
+ jint slot,
+ jfloat value) {
+ return functions->SetLocalFloat(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetLocalDouble(jthread thread,
+ jint depth,
+ jint slot,
+ jdouble value) {
+ return functions->SetLocalDouble(this, thread, depth, slot, value);
+ }
+
+ jvmtiError SetBreakpoint(jmethodID method,
+ jlocation location) {
+ return functions->SetBreakpoint(this, method, location);
+ }
+
+ jvmtiError ClearBreakpoint(jmethodID method,
+ jlocation location) {
+ return functions->ClearBreakpoint(this, method, location);
+ }
+
+ jvmtiError SetFieldAccessWatch(jclass klass,
+ jfieldID field) {
+ return functions->SetFieldAccessWatch(this, klass, field);
+ }
+
+ jvmtiError ClearFieldAccessWatch(jclass klass,
+ jfieldID field) {
+ return functions->ClearFieldAccessWatch(this, klass, field);
+ }
+
+ jvmtiError SetFieldModificationWatch(jclass klass,
+ jfieldID field) {
+ return functions->SetFieldModificationWatch(this, klass, field);
+ }
+
+ jvmtiError ClearFieldModificationWatch(jclass klass,
+ jfieldID field) {
+ return functions->ClearFieldModificationWatch(this, klass, field);
+ }
+
+ jvmtiError GetLoadedClasses(jint* class_count_ptr,
+ jclass** classes_ptr) {
+ return functions->GetLoadedClasses(this, class_count_ptr, classes_ptr);
+ }
+
+ jvmtiError GetClassLoaderClasses(jobject initiating_loader,
+ jint* class_count_ptr,
+ jclass** classes_ptr) {
+ return functions->GetClassLoaderClasses(this, initiating_loader, class_count_ptr, classes_ptr);
+ }
+
+ jvmtiError GetClassSignature(jclass klass,
+ char** signature_ptr,
+ char** generic_ptr) {
+ return functions->GetClassSignature(this, klass, signature_ptr, generic_ptr);
+ }
+
+ jvmtiError GetClassStatus(jclass klass,
+ jint* status_ptr) {
+ return functions->GetClassStatus(this, klass, status_ptr);
+ }
+
+ jvmtiError GetSourceFileName(jclass klass,
+ char** source_name_ptr) {
+ return functions->GetSourceFileName(this, klass, source_name_ptr);
+ }
+
+ jvmtiError GetClassModifiers(jclass klass,
+ jint* modifiers_ptr) {
+ return functions->GetClassModifiers(this, klass, modifiers_ptr);
+ }
+
+ jvmtiError GetClassMethods(jclass klass,
+ jint* method_count_ptr,
+ jmethodID** methods_ptr) {
+ return functions->GetClassMethods(this, klass, method_count_ptr, methods_ptr);
+ }
+
+ jvmtiError GetClassFields(jclass klass,
+ jint* field_count_ptr,
+ jfieldID** fields_ptr) {
+ return functions->GetClassFields(this, klass, field_count_ptr, fields_ptr);
+ }
+
+ jvmtiError GetImplementedInterfaces(jclass klass,
+ jint* interface_count_ptr,
+ jclass** interfaces_ptr) {
+ return functions->GetImplementedInterfaces(this, klass, interface_count_ptr, interfaces_ptr);
+ }
+
+ jvmtiError GetClassVersionNumbers(jclass klass,
+ jint* minor_version_ptr,
+ jint* major_version_ptr) {
+ return functions->GetClassVersionNumbers(this, klass, minor_version_ptr, major_version_ptr);
+ }
+
+ jvmtiError GetConstantPool(jclass klass,
+ jint* constant_pool_count_ptr,
+ jint* constant_pool_byte_count_ptr,
+ unsigned char** constant_pool_bytes_ptr) {
+ return functions->GetConstantPool(this, klass, constant_pool_count_ptr, constant_pool_byte_count_ptr, constant_pool_bytes_ptr);
+ }
+
+ jvmtiError IsInterface(jclass klass,
+ jboolean* is_interface_ptr) {
+ return functions->IsInterface(this, klass, is_interface_ptr);
+ }
+
+ jvmtiError IsArrayClass(jclass klass,
+ jboolean* is_array_class_ptr) {
+ return functions->IsArrayClass(this, klass, is_array_class_ptr);
+ }
+
+ jvmtiError IsModifiableClass(jclass klass,
+ jboolean* is_modifiable_class_ptr) {
+ return functions->IsModifiableClass(this, klass, is_modifiable_class_ptr);
+ }
+
+ jvmtiError GetClassLoader(jclass klass,
+ jobject* classloader_ptr) {
+ return functions->GetClassLoader(this, klass, classloader_ptr);
+ }
+
+ jvmtiError GetSourceDebugExtension(jclass klass,
+ char** source_debug_extension_ptr) {
+ return functions->GetSourceDebugExtension(this, klass, source_debug_extension_ptr);
+ }
+
+ jvmtiError RetransformClasses(jint class_count,
+ const jclass* classes) {
+ return functions->RetransformClasses(this, class_count, classes);
+ }
+
+ jvmtiError RedefineClasses(jint class_count,
+ const jvmtiClassDefinition* class_definitions) {
+ return functions->RedefineClasses(this, class_count, class_definitions);
+ }
+
+ jvmtiError GetObjectSize(jobject object,
+ jlong* size_ptr) {
+ return functions->GetObjectSize(this, object, size_ptr);
+ }
+
+ jvmtiError GetObjectHashCode(jobject object,
+ jint* hash_code_ptr) {
+ return functions->GetObjectHashCode(this, object, hash_code_ptr);
+ }
+
+ jvmtiError GetObjectMonitorUsage(jobject object,
+ jvmtiMonitorUsage* info_ptr) {
+ return functions->GetObjectMonitorUsage(this, object, info_ptr);
+ }
+
+ jvmtiError GetFieldName(jclass klass,
+ jfieldID field,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr) {
+ return functions->GetFieldName(this, klass, field, name_ptr, signature_ptr, generic_ptr);
+ }
+
+ jvmtiError GetFieldDeclaringClass(jclass klass,
+ jfieldID field,
+ jclass* declaring_class_ptr) {
+ return functions->GetFieldDeclaringClass(this, klass, field, declaring_class_ptr);
+ }
+
+ jvmtiError GetFieldModifiers(jclass klass,
+ jfieldID field,
+ jint* modifiers_ptr) {
+ return functions->GetFieldModifiers(this, klass, field, modifiers_ptr);
+ }
+
+ jvmtiError IsFieldSynthetic(jclass klass,
+ jfieldID field,
+ jboolean* is_synthetic_ptr) {
+ return functions->IsFieldSynthetic(this, klass, field, is_synthetic_ptr);
+ }
+
+ jvmtiError GetMethodName(jmethodID method,
+ char** name_ptr,
+ char** signature_ptr,
+ char** generic_ptr) {
+ return functions->GetMethodName(this, method, name_ptr, signature_ptr, generic_ptr);
+ }
+
+ jvmtiError GetMethodDeclaringClass(jmethodID method,
+ jclass* declaring_class_ptr) {
+ return functions->GetMethodDeclaringClass(this, method, declaring_class_ptr);
+ }
+
+ jvmtiError GetMethodModifiers(jmethodID method,
+ jint* modifiers_ptr) {
+ return functions->GetMethodModifiers(this, method, modifiers_ptr);
+ }
+
+ jvmtiError GetMaxLocals(jmethodID method,
+ jint* max_ptr) {
+ return functions->GetMaxLocals(this, method, max_ptr);
+ }
+
+ jvmtiError GetArgumentsSize(jmethodID method,
+ jint* size_ptr) {
+ return functions->GetArgumentsSize(this, method, size_ptr);
+ }
+
+ jvmtiError GetLineNumberTable(jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLineNumberEntry** table_ptr) {
+ return functions->GetLineNumberTable(this, method, entry_count_ptr, table_ptr);
+ }
+
+ jvmtiError GetMethodLocation(jmethodID method,
+ jlocation* start_location_ptr,
+ jlocation* end_location_ptr) {
+ return functions->GetMethodLocation(this, method, start_location_ptr, end_location_ptr);
+ }
+
+ jvmtiError GetLocalVariableTable(jmethodID method,
+ jint* entry_count_ptr,
+ jvmtiLocalVariableEntry** table_ptr) {
+ return functions->GetLocalVariableTable(this, method, entry_count_ptr, table_ptr);
+ }
+
+ jvmtiError GetBytecodes(jmethodID method,
+ jint* bytecode_count_ptr,
+ unsigned char** bytecodes_ptr) {
+ return functions->GetBytecodes(this, method, bytecode_count_ptr, bytecodes_ptr);
+ }
+
+ jvmtiError IsMethodNative(jmethodID method,
+ jboolean* is_native_ptr) {
+ return functions->IsMethodNative(this, method, is_native_ptr);
+ }
+
+ jvmtiError IsMethodSynthetic(jmethodID method,
+ jboolean* is_synthetic_ptr) {
+ return functions->IsMethodSynthetic(this, method, is_synthetic_ptr);
+ }
+
+ jvmtiError IsMethodObsolete(jmethodID method,
+ jboolean* is_obsolete_ptr) {
+ return functions->IsMethodObsolete(this, method, is_obsolete_ptr);
+ }
+
+ jvmtiError SetNativeMethodPrefix(const char* prefix) {
+ return functions->SetNativeMethodPrefix(this, prefix);
+ }
+
+ jvmtiError SetNativeMethodPrefixes(jint prefix_count,
+ char** prefixes) {
+ return functions->SetNativeMethodPrefixes(this, prefix_count, prefixes);
+ }
+
+ jvmtiError CreateRawMonitor(const char* name,
+ jrawMonitorID* monitor_ptr) {
+ return functions->CreateRawMonitor(this, name, monitor_ptr);
+ }
+
+ jvmtiError DestroyRawMonitor(jrawMonitorID monitor) {
+ return functions->DestroyRawMonitor(this, monitor);
+ }
+
+ jvmtiError RawMonitorEnter(jrawMonitorID monitor) {
+ return functions->RawMonitorEnter(this, monitor);
+ }
+
+ jvmtiError RawMonitorExit(jrawMonitorID monitor) {
+ return functions->RawMonitorExit(this, monitor);
+ }
+
+ jvmtiError RawMonitorWait(jrawMonitorID monitor,
+ jlong millis) {
+ return functions->RawMonitorWait(this, monitor, millis);
+ }
+
+ jvmtiError RawMonitorNotify(jrawMonitorID monitor) {
+ return functions->RawMonitorNotify(this, monitor);
+ }
+
+ jvmtiError RawMonitorNotifyAll(jrawMonitorID monitor) {
+ return functions->RawMonitorNotifyAll(this, monitor);
+ }
+
+ jvmtiError SetJNIFunctionTable(const jniNativeInterface* function_table) {
+ return functions->SetJNIFunctionTable(this, function_table);
+ }
+
+ jvmtiError GetJNIFunctionTable(jniNativeInterface** function_table) {
+ return functions->GetJNIFunctionTable(this, function_table);
+ }
+
+ jvmtiError SetEventCallbacks(const jvmtiEventCallbacks* callbacks,
+ jint size_of_callbacks) {
+ return functions->SetEventCallbacks(this, callbacks, size_of_callbacks);
+ }
+
+ jvmtiError SetEventNotificationMode(jvmtiEventMode mode,
+ jvmtiEvent event_type,
+ jthread event_thread,
+ ...) {
+ return functions->SetEventNotificationMode(this, mode, event_type, event_thread);
+ }
+
+ jvmtiError GenerateEvents(jvmtiEvent event_type) {
+ return functions->GenerateEvents(this, event_type);
+ }
+
+ jvmtiError GetExtensionFunctions(jint* extension_count_ptr,
+ jvmtiExtensionFunctionInfo** extensions) {
+ return functions->GetExtensionFunctions(this, extension_count_ptr, extensions);
+ }
+
+ jvmtiError GetExtensionEvents(jint* extension_count_ptr,
+ jvmtiExtensionEventInfo** extensions) {
+ return functions->GetExtensionEvents(this, extension_count_ptr, extensions);
+ }
+
+ jvmtiError SetExtensionEventCallback(jint extension_event_index,
+ jvmtiExtensionEvent callback) {
+ return functions->SetExtensionEventCallback(this, extension_event_index, callback);
+ }
+
+ jvmtiError GetPotentialCapabilities(jvmtiCapabilities* capabilities_ptr) {
+ return functions->GetPotentialCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError AddCapabilities(const jvmtiCapabilities* capabilities_ptr) {
+ return functions->AddCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError RelinquishCapabilities(const jvmtiCapabilities* capabilities_ptr) {
+ return functions->RelinquishCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError GetCapabilities(jvmtiCapabilities* capabilities_ptr) {
+ return functions->GetCapabilities(this, capabilities_ptr);
+ }
+
+ jvmtiError GetCurrentThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) {
+ return functions->GetCurrentThreadCpuTimerInfo(this, info_ptr);
+ }
+
+ jvmtiError GetCurrentThreadCpuTime(jlong* nanos_ptr) {
+ return functions->GetCurrentThreadCpuTime(this, nanos_ptr);
+ }
+
+ jvmtiError GetThreadCpuTimerInfo(jvmtiTimerInfo* info_ptr) {
+ return functions->GetThreadCpuTimerInfo(this, info_ptr);
+ }
+
+ jvmtiError GetThreadCpuTime(jthread thread,
+ jlong* nanos_ptr) {
+ return functions->GetThreadCpuTime(this, thread, nanos_ptr);
+ }
+
+ jvmtiError GetTimerInfo(jvmtiTimerInfo* info_ptr) {
+ return functions->GetTimerInfo(this, info_ptr);
+ }
+
+ jvmtiError GetTime(jlong* nanos_ptr) {
+ return functions->GetTime(this, nanos_ptr);
+ }
+
+ jvmtiError GetAvailableProcessors(jint* processor_count_ptr) {
+ return functions->GetAvailableProcessors(this, processor_count_ptr);
+ }
+
+ jvmtiError AddToBootstrapClassLoaderSearch(const char* segment) {
+ return functions->AddToBootstrapClassLoaderSearch(this, segment);
+ }
+
+ jvmtiError AddToSystemClassLoaderSearch(const char* segment) {
+ return functions->AddToSystemClassLoaderSearch(this, segment);
+ }
+
+ jvmtiError GetSystemProperties(jint* count_ptr,
+ char*** property_ptr) {
+ return functions->GetSystemProperties(this, count_ptr, property_ptr);
+ }
+
+ jvmtiError GetSystemProperty(const char* property,
+ char** value_ptr) {
+ return functions->GetSystemProperty(this, property, value_ptr);
+ }
+
+ jvmtiError SetSystemProperty(const char* property,
+ const char* value) {
+ return functions->SetSystemProperty(this, property, value);
+ }
+
+ jvmtiError GetPhase(jvmtiPhase* phase_ptr) {
+ return functions->GetPhase(this, phase_ptr);
+ }
+
+ jvmtiError DisposeEnvironment() {
+ return functions->DisposeEnvironment(this);
+ }
+
+ jvmtiError SetEnvironmentLocalStorage(const void* data) {
+ return functions->SetEnvironmentLocalStorage(this, data);
+ }
+
+ jvmtiError GetEnvironmentLocalStorage(void** data_ptr) {
+ return functions->GetEnvironmentLocalStorage(this, data_ptr);
+ }
+
+ jvmtiError GetVersionNumber(jint* version_ptr) {
+ return functions->GetVersionNumber(this, version_ptr);
+ }
+
+ jvmtiError GetErrorName(jvmtiError error,
+ char** name_ptr) {
+ return functions->GetErrorName(this, error, name_ptr);
+ }
+
+ jvmtiError SetVerboseFlag(jvmtiVerboseFlag flag,
+ jboolean value) {
+ return functions->SetVerboseFlag(this, flag, value);
+ }
+
+ jvmtiError GetJLocationFormat(jvmtiJlocationFormat* format_ptr) {
+ return functions->GetJLocationFormat(this, format_ptr);
+ }
+
+#endif /* __cplusplus */
+};
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !_JAVA_JVMTI_H_ */
+
diff --git a/staging/linux-x86/include/jvmticmlr.h b/staging/linux-x86/include/jvmticmlr.h
new file mode 100644
index 0000000..c2106d3
--- /dev/null
+++ b/staging/linux-x86/include/jvmticmlr.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This header file defines the data structures sent by the VM
+ * through the JVMTI CompiledMethodLoad callback function via the
+ * "void * compile_info" parameter. The memory pointed to by the
+ * compile_info parameter may not be referenced after returning from
+ * the CompiledMethodLoad callback. These are VM implementation
+ * specific data structures that may evolve in future releases. A
+ * JVMTI agent should interpret a non-NULL compile_info as a pointer
+ * to a region of memory containing a list of records. In a typical
+ * usage scenario, a JVMTI agent would cast each record to a
+ * jvmtiCompiledMethodLoadRecordHeader, a struct that represents
+ * arbitrary information. This struct contains a kind field to indicate
+ * the kind of information being passed, and a pointer to the next
+ * record. If the kind field indicates inlining information, then the
+ * agent would cast the record to a jvmtiCompiledMethodLoadInlineRecord.
+ * This record contains an array of PCStackInfo structs, which indicate
+ * for every pc address what are the methods on the invocation stack.
+ * The "methods" and "bcis" fields in each PCStackInfo struct specify a
+ * 1-1 mapping between these inlined methods and their bytecode indices.
+ * This can be used to derive the proper source lines of the inlined
+ * methods.
+ */
+
+#ifndef _JVMTI_CMLR_H_
+#define _JVMTI_CMLR_H_
+
+enum {
+ JVMTI_CMLR_MAJOR_VERSION_1 = 0x00000001,
+ JVMTI_CMLR_MINOR_VERSION_0 = 0x00000000,
+
+ JVMTI_CMLR_MAJOR_VERSION = 0x00000001,
+ JVMTI_CMLR_MINOR_VERSION = 0x00000000
+
+ /*
+ * This comment is for the "JDK import from HotSpot" sanity check:
+ * version: 1.0.0
+ */
+};
+
+typedef enum {
+ JVMTI_CMLR_DUMMY = 1,
+ JVMTI_CMLR_INLINE_INFO = 2
+} jvmtiCMLRKind;
+
+/*
+ * Record that represents arbitrary information passed through JVMTI
+ * CompiledMethodLoadEvent void pointer.
+ */
+typedef struct _jvmtiCompiledMethodLoadRecordHeader {
+ jvmtiCMLRKind kind; /* id for the kind of info passed in the record */
+ jint majorinfoversion; /* major and minor info version values. Init'ed */
+ jint minorinfoversion; /* to current version value in jvmtiExport.cpp. */
+
+ struct _jvmtiCompiledMethodLoadRecordHeader* next;
+} jvmtiCompiledMethodLoadRecordHeader;
+
+/*
+ * Record that gives information about the methods on the compile-time
+ * stack at a specific pc address of a compiled method. Each element in
+ * the methods array maps to same element in the bcis array.
+ */
+typedef struct _PCStackInfo {
+ void* pc; /* the pc address for this compiled method */
+ jint numstackframes; /* number of methods on the stack */
+ jmethodID* methods; /* array of numstackframes method ids */
+ jint* bcis; /* array of numstackframes bytecode indices */
+} PCStackInfo;
+
+/*
+ * Record that contains inlining information for each pc address of
+ * an nmethod.
+ */
+typedef struct _jvmtiCompiledMethodLoadInlineRecord {
+ jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
+ jint numpcs; /* number of pc descriptors in this nmethod */
+ PCStackInfo* pcinfo; /* array of numpcs pc descriptors */
+} jvmtiCompiledMethodLoadInlineRecord;
+
+/*
+ * Dummy record used to test that we can pass records with different
+ * information through the void pointer provided that they can be cast
+ * to a jvmtiCompiledMethodLoadRecordHeader.
+ */
+
+typedef struct _jvmtiCompiledMethodLoadDummyRecord {
+ jvmtiCompiledMethodLoadRecordHeader header; /* common header for casting */
+ char message[50];
+} jvmtiCompiledMethodLoadDummyRecord;
+
+#endif
diff --git a/staging/linux-x86/include/linux/jawt_md.h b/staging/linux-x86/include/linux/jawt_md.h
new file mode 100644
index 0000000..b7c2ea7
--- /dev/null
+++ b/staging/linux-x86/include/linux/jawt_md.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _JAVASOFT_JAWT_MD_H_
+#define _JAVASOFT_JAWT_MD_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Intrinsic.h>
+#include "jawt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * X11-specific declarations for AWT native interface.
+ * See notes in jawt.h for an example of use.
+ */
+typedef struct jawt_X11DrawingSurfaceInfo {
+ Drawable drawable;
+ Display* display;
+ VisualID visualID;
+ Colormap colormapID;
+ int depth;
+ /*
+ * Since 1.4
+ * Returns a pixel value from a set of RGB values.
+ * This is useful for paletted color (256 color) modes.
+ */
+ int (JNICALL *GetAWTColor)(JAWT_DrawingSurface* ds,
+ int r, int g, int b);
+} JAWT_X11DrawingSurfaceInfo;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_JAVASOFT_JAWT_MD_H_ */
diff --git a/staging/linux-x86/include/linux/jni_md.h b/staging/linux-x86/include/linux/jni_md.h
new file mode 100644
index 0000000..80eedf3
--- /dev/null
+++ b/staging/linux-x86/include/linux/jni_md.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _JAVASOFT_JNI_MD_H_
+#define _JAVASOFT_JNI_MD_H_
+
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
+ #define JNIEXPORT __attribute__((visibility("default")))
+ #define JNIIMPORT __attribute__((visibility("default")))
+#else
+ #define JNIEXPORT
+ #define JNIIMPORT
+#endif
+
+#define JNICALL
+
+typedef int jint;
+#ifdef _LP64 /* 64-bit Solaris */
+typedef long jlong;
+#else
+typedef long long jlong;
+#endif
+
+typedef signed char jbyte;
+
+#endif /* !_JAVASOFT_JNI_MD_H_ */
diff --git a/staging/linux-x86/jre/ASSEMBLY_EXCEPTION b/staging/linux-x86/jre/ASSEMBLY_EXCEPTION
new file mode 100644
index 0000000..065b8d9
--- /dev/null
+++ b/staging/linux-x86/jre/ASSEMBLY_EXCEPTION
@@ -0,0 +1,27 @@
+
+OPENJDK ASSEMBLY EXCEPTION
+
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+only ("GPL2"), with the following clarification and special exception.
+
+ Linking this OpenJDK Code statically or dynamically with other code
+ is making a combined work based on this library. Thus, the terms
+ and conditions of GPL2 cover the whole combination.
+
+ As a special exception, Oracle gives you permission to link this
+ OpenJDK Code with certain code licensed by Oracle as indicated at
+ http://openjdk.java.net/legal/exception-modules-2007-05-08.html
+ ("Designated Exception Modules") to produce an executable,
+ regardless of the license terms of the Designated Exception Modules,
+ and to copy and distribute the resulting executable under GPL2,
+ provided that the Designated Exception Modules continue to be
+ governed by the licenses under which they were offered by Oracle.
+
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception). If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
diff --git a/staging/linux-x86/jre/LICENSE b/staging/linux-x86/jre/LICENSE
new file mode 100644
index 0000000..8b400c7
--- /dev/null
+++ b/staging/linux-x86/jre/LICENSE
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have. You must
+make sure that they, too, receive or can get the source code. And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+ a) You must cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in whole or
+ in part contains or is derived from the Program or any part thereof, to be
+ licensed as a whole at no charge to all third parties under the terms of
+ this License.
+
+ c) If the modified program normally reads commands interactively when run,
+ you must cause it, when started running for such interactive use in the
+ most ordinary way, to print or display an announcement including an
+ appropriate copyright notice and a notice that there is no warranty (or
+ else, saying that you provide a warranty) and that users may redistribute
+ the program under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the Program is
+ not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable source
+ code, which must be distributed under the terms of Sections 1 and 2 above
+ on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three years, to
+ give any third party, for a charge no more than your cost of physically
+ performing source distribution, a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed only
+ for noncommercial distribution and only if you received the program in
+ object code or executable form with such an offer, in accord with
+ Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works. These actions are prohibited by law if you do not
+accept this License. Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein. You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time. Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+ One line to give the program's name and a brief idea of what it does.
+
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This program 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 for
+ more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+ with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
+ software, and you are welcome to redistribute it under certain conditions;
+ type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary. Here
+is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ 'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ signature of Ty Coon, 1 April 1989
+
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+ Linking this library statically or dynamically with other modules is making
+ a combined work based on this library. Thus, the terms and conditions of
+ the GNU General Public License cover the whole combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent modules,
+ and to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent module,
+ the terms and conditions of the license of that module. An independent
+ module is a module which is not derived from or based on this library. If
+ you modify this library, you may extend this exception to your version of
+ the library, but you are not obligated to do so. If you do not wish to do
+ so, delete this exception statement from your version.
diff --git a/staging/linux-x86/jre/THIRD_PARTY_README b/staging/linux-x86/jre/THIRD_PARTY_README
new file mode 100644
index 0000000..2b20da2
--- /dev/null
+++ b/staging/linux-x86/jre/THIRD_PARTY_README
@@ -0,0 +1,3574 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to ASM Bytecode Manipulation
+Framework v5.0.3, which may be included with JRE 8, and JDK 8, and
+OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2011 France Télécom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+3. 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.
+
+THIS 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.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to BSDiff v4.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 2003-2005 Colin Percival
+All rights reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted providing that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CodeViewer 1.0, which may be
+included with JDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1999 by CoolServlets.com.
+
+Any errors or suggested improvements to this class can be reported as
+instructed on CoolServlets.com. We hope you enjoy this program... your
+comments will encourage further development! This software is distributed
+under the terms of the BSD License. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+Neither name of CoolServlets.com nor the names of its contributors may be
+used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY COOLSERVLETS.COM 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 AUTHOR 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."
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Cryptix AES 3.2.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Cryptix General License
+
+Copyright (c) 1995-2005 The Cryptix Foundation Limited.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ 1. Redistributions of source code must retain the copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED 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 CRYPTIX FOUNDATION LIMITED 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to CUP Parser Generator for
+Java 0.10k, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both the
+copyright notice and this permission notice and warranty disclaimer appear in
+supporting documentation, and that the names of the authors or their
+employers not be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission.
+
+The authors and their employers disclaim all warranties with regard to
+this software, including all implied warranties of merchantability and fitness.
+In no event shall the authors or their employers be liable for any special,
+indirect or consequential damages or any damages whatsoever resulting from
+loss of use, data or profits, whether in an action of contract, negligence or
+other tortious action, arising out of or in connection with the use or
+performance of this software.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Document Object Model (DOM) Level 2
+& 3, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+W3C SOFTWARE NOTICE AND LICENSE
+
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other
+related items) is being provided by the copyright holders under the following
+license. By obtaining, using and/or copying this work, you (the licensee)
+agree that you have read, understood, and will comply with the following terms
+and conditions.
+
+Permission to copy, modify, and distribute this software and its
+documentation, with or without modification, for any purpose and without fee
+or royalty is hereby granted, provided that you include the following on ALL
+copies of the software and documentation or portions thereof, including
+modifications:
+
+ 1.The full text of this NOTICE in a location viewable to users of the
+ redistributed or derivative work.
+
+ 2.Any pre-existing intellectual property disclaimers, notices, or terms and
+ conditions. If none exist, the W3C Software Short Notice should be included
+ (hypertext is preferred, text is permitted) within the body of any
+ redistributed or derivative code.
+
+ 3.Notice of any changes or modifications to the files, including the date
+ changes were made. (We recommend you provide URIs to the location from
+ which the code is derived.)
+
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
+MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
+PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY
+THIRD PARTY PATENTS,COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
+DOCUMENTATION. The name and trademarks of copyright holders may NOT be used
+in advertising or publicity pertaining to the software without specific,
+written prior permission. Title to copyright in this software and any
+associated documentation will at all times remain with copyright holders.
+
+____________________________________
+
+This formulation of W3C's notice and license became active on December 31
+2002. This version removes the copyright ownership notice such that this
+license can be used with materials other than those owned by the W3C, reflects
+that ERCIM is now a host of the W3C, includes references to this specific
+dated version of the license, and removes the ambiguous grant of "use".
+Otherwise, this version is the same as the previous version and is written so
+as to preserve the Free Software Foundation's assessment of GPL compatibility
+and OSI's certification under the Open Source Definition. Please see our
+Copyright FAQ for common questions about using materials from our site,
+including specific terms and conditions for packages like libwww, Amaya, and
+Jigsaw. Other questions about this notice can be directed to
+site-policy@w3.org.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Dynalink v0.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2009-2013, Attila Szegedi
+
+All rights reserved.Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following conditions are
+met:* Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer. * 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. * Neither the name of Attila
+Szegedi nor the names of its contributors may be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+THIS 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 HOLDER 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 THEPOSSIBILITY OF SUCH DAMAGE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Elliptic Curve Cryptography, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+You are receiving a copy of the Elliptic Curve Cryptography library in source
+form with the JDK 8 and OpenJDK 8 source distributions, and as object code in
+the JRE 8 & JDK 8 runtimes.
+
+In the case of the JRE 8 & JDK 8 runtimes, the terms of the Oracle license do
+NOT apply to the Elliptic Curve Cryptography library; it is licensed under the
+following license, separately from Oracle's JDK & JRE. If you do not wish to
+install the Elliptic Curve Cryptography library, you may delete the library
+named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows
+systems) from the JRE bin directory reserved for native libraries.
+
+
+--- begin of LICENSE ---
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ECMAScript Language
+Specification ECMA-262 Edition 5.1 which may be included with
+JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright notice
+Copyright © 2011 Ecma International
+Ecma International
+Rue du Rhone 114
+CH-1204 Geneva
+Tel: +41 22 849 6000
+Fax: +41 22 849 6001
+Web: http://www.ecma-international.org
+
+This document and possible translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it or assist
+in its implementation may be prepared, copied, published, and distributed, in
+whole or in part, without restriction of any kind, provided that the above
+copyright notice and this section are included on all such copies and derivative
+works. However, this document itself may not be modified in any way, including
+by removing the copyright notice or references to Ecma International, except as
+needed for the purpose of developing any document or deliverable produced by
+Ecma International (in which case the rules applied to copyrights must be
+followed) or as required to translate it into languages other than English. The
+limited permissions granted above are perpetual and will not be revoked by Ecma
+International or its successors or assigns. This document and the information
+contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL
+DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
+WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP
+RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE." Software License
+
+All Software contained in this document ("Software)" is protected by copyright
+and is being made available under the "BSD License", included below. This
+Software may be subject to third party rights (rights from parties other than
+Ecma International), including patent rights, and no licenses under such third
+party rights are granted under this license even if the third party concerned is
+a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS
+AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR
+INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO
+IMPLEMENT ECMA INTERNATIONAL STANDARDS*. Redistribution and use in source and
+binary forms, with or without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. 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.
+
+3. Neither the name of the authors nor Ecma International may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "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 ECMA INTERNATIONAL 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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Dynalink library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Copyright (c) 2009-2013, Attila Szegedi
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* 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.
+* Neither the name of the copyright holder nor the names of
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS 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 COPYRIGHT HOLDER
+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.
+--- end of LICENSE ---
+
+%% This notice is provided with respect to Joni library which is included
+with the Nashorn technology.
+
+--- begin of LICENSE ---
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to FontConfig 2.5, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 source distributions on
+Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright © 2001,2003 Keith Packard
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation, and that
+the name of Keith Packard not be used in advertising or publicity pertaining
+to distribution of the software without specific, written prior permission.
+Keith Packard makes no representations about the suitability of this software
+for any purpose. It is provided "as is" without express or implied warranty.
+
+KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL KEITH
+PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IAIK PKCS#11 Wrapper,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+IAIK PKCS#11 Wrapper License
+
+Copyright (c) 2002 Graz University of Technology. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by IAIK of Graz University of
+ Technology."
+
+ Alternately, this acknowledgment may appear in the software itself, if and
+ wherever such third-party acknowledgments normally appear.
+
+4. The names "Graz University of Technology" and "IAIK of Graz University of
+ Technology" must not be used to endorse or promote products derived from this
+ software without prior written permission.
+
+5. Products derived from this software may not be called "IAIK PKCS Wrapper",
+ nor may "IAIK" appear in their name, without prior written permission of
+ Graz University of Technology.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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
+LICENSOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to ICU4C 4.0.1 and ICU4J 4.4, which
+may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1995-2010 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, and/or sell copies of the
+Software, and to permit persons to whom the Software is furnished to do so,
+provided that the above copyright notice(s) and this permission notice appear
+in all copies of the Software and that both the above copyright notice(s) and
+this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
+LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+All trademarks and registered trademarks mentioned herein are the property of
+their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to IJG JPEG 6b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Joni v1.1.9, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to JOpt-Simple v3.0, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2004-2009 Paul R. Holser, Jr.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+--------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality, which
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ (C) Copyright IBM Corp. 1999 All Rights Reserved.
+ Copyright 1997 The Open Group Research Institute. All rights reserved.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kerberos functionality from
+FundsXpress, INC., which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ Copyright (C) 1998 by the FundsXpress, INC.
+
+ All rights reserved.
+
+ Export of this software from the United States of America may require
+ a specific license from the United States Government. It is the
+ responsibility of any person or organization contemplating export to
+ obtain such a license before exporting.
+
+ WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ distribute this software and its documentation for any purpose and
+ without fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation, and that
+ the name of FundsXpress. not be used in advertising or publicity pertaining
+ to distribution of the software without specific, written prior
+ permission. FundsXpress makes no representations about the suitability of
+ this software for any purpose. It is provided "as is" without express
+ or implied warranty.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Kronos OpenGL headers, which may be
+included with JDK 8 and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Copyright (c) 2007 The Khronos Group Inc.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and/or associated documentation files (the "Materials"), to
+ deal in the Materials without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ sell copies of the Materials, and to permit persons to whom the Materials are
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Materials.
+
+ THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS IN THE
+ MATERIALS.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions Copyright Eastman Kodak Company 1992
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to libpng 1.6.16, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+This copy of the libpng notices is provided for your convenience. In case of
+any discrepancy between this copy and the notices in the file png.h that is
+included in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors
+
+ Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
+Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6
+with the following individuals added to the list of Contributing Authors
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Gilles Vollant
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of the
+ library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is with
+ the user.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-0.96,
+with the following individuals added to the list of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996, 1997 Andreas Dilger
+Distributed according to the same disclaimer and license as libpng-0.88,
+with the following individuals added to the list of Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose. The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+1. The origin of this source code must not be misrepresented.
+
+2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products. If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+
+A "png_get_copyright" function is available, for convenient use in "about"
+boxes and the like:
+
+ printf("%s",png_get_copyright(NULL));
+
+Also, the PNG logo (in PNG format, of course) is supplied in the
+files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
+certification mark of the Open Source Initiative.
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+December 22, 2014
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Little CMS 2.7, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Little CMS
+Copyright (c) 1998-2015 Marti Maria Saguer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Lucida is a registered trademark or trademark of Bigelow & Holmes in the
+U.S. and other countries.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mesa 3D Graphics Library v4.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 source distributions.
+
+--- begin of LICENSE ---
+
+ Mesa 3-D graphics library
+ Version: 4.1
+
+ Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Mozilla Network Security
+Services (NSS), which is supplied with the JDK test suite in the OpenJDK
+source code repository. It is licensed under Mozilla Public License (MPL),
+version 2.0.
+
+The NSS libraries are supplied in executable form, built from unmodified
+NSS source code labeled with the "NSS_3_16_RTM" HG tag.
+
+The NSS source code is available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/src
+
+The NSS libraries are available in the OpenJDK source code repository at:
+ jdk/test/sun/security/pkcs11/nss/lib
+
+--- begin of LICENSE ---
+
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Copyright (c) 1999-2004 David Corcoran <corcoran@linuxnet.com>
+Copyright (c) 1999-2004 Ludovic Rousseau <ludovic.rousseau (at) free.fr>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. 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.
+3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by:
+ David Corcoran <corcoran@linuxnet.com>
+ http://www.linuxnet.com (MUSCLE)
+4. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+Changes to this license can be made only by the copyright author with
+explicit written consent.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to PorterStemmer v4, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+See: http://tartarus.org/~martin/PorterStemmer
+
+The software is completely free for any purpose, unless notes at the head of
+the program text indicates otherwise (which is rare). In any case, the notes
+about licensing are never more restrictive than the BSD License.
+
+In every case where the software is not written by me (Martin Porter), this
+licensing arrangement has been endorsed by the contributor, and it is
+therefore unnecessary to ask the contributor again to confirm it.
+
+I have not asked any contributors (or their employers, if they have them) for
+proofs that they have the right to distribute their software in this way.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Relax NG Object/Parser v.20050510,
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) Kohsuke Kawaguchi
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions: The above copyright
+notice and this permission notice shall be included in all copies or
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to RelaxNGCC v1.12, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2000-2003 Daisuke Okajima and Kohsuke Kawaguchi.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. 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.
+
+3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment:
+
+ "This product includes software developed by Daisuke Okajima
+ and Kohsuke Kawaguchi (http://relaxngcc.sf.net/)."
+
+Alternately, this acknowledgment may appear in the software itself, if and
+wherever such third-party acknowledgments normally appear.
+
+4. The names of the copyright holders must not be used to endorse or promote
+ products derived from this software without prior written permission. For
+ written permission, please contact the copyright holders.
+
+5. Products derived from this software may not be called "RELAXNGCC", nor may
+ "RELAXNGCC" appear in their name, without prior written permission of the
+ copyright holders.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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 APACHE
+SOFTWARE FOUNDATION OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SAX 2.0.1, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ SAX is free!
+
+ In fact, it's not possible to own a license to SAX, since it's been placed in
+ the public domain.
+
+ No Warranty
+
+ Because SAX is released to the public domain, there is no warranty for the
+ design or for the software implementation, to the extent permitted by
+ applicable law. Except when otherwise stated in writing the copyright holders
+ and/or other parties provide SAX "as is" without warranty of any kind, either
+ expressed or implied, including, but not limited to, the implied warranties
+ of merchantability and fitness for a particular purpose. The entire risk as
+ to the quality and performance of SAX is with you. Should SAX prove
+ defective, you assume the cost of all necessary servicing, repair or
+ correction.
+
+ In no event unless required by applicable law or agreed to in writing will
+ any copyright holder, or any other party who may modify and/or redistribute
+ SAX, be liable to you for damages, including any general, special, incidental
+ or consequential damages arising out of the use or inability to use SAX
+ (including but not limited to loss of data or data being rendered inaccurate
+ or losses sustained by you or third parties or a failure of the SAX to
+ operate with any other programs), even if such holder or other party has been
+ advised of the possibility of such damages.
+
+ Copyright Disclaimers
+
+ This page includes statements to that effect by David Megginson, who would
+ have been able to claim copyright for the original work. SAX 1.0
+
+ Version 1.0 of the Simple API for XML (SAX), created collectively by the
+ membership of the XML-DEV mailing list, is hereby released into the public
+ domain.
+
+ No one owns SAX: you may use it freely in both commercial and non-commercial
+ applications, bundle it with your software distribution, include it on a
+ CD-ROM, list the source code in a book, mirror the documentation at your own
+ web site, or use it in any other way you see fit.
+
+ David Megginson, sax@megginson.com
+ 1998-05-11
+
+ SAX 2.0
+
+ I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and
+ release all of the SAX 2.0 source code, compiled code, and documentation
+ contained in this distribution into the Public Domain. SAX comes with NO
+ WARRANTY or guarantee of fitness for any purpose.
+
+ David Megginson, david@megginson.com
+ 2000-05-05
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to SoftFloat version 2b, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux/ARM.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+SoftFloat was written by me, John R. Hauser. This work was made possible in
+part by the International Computer Science Institute, located at Suite 600,
+1947 Center Street, Berkeley, California 94704. Funding was partially
+provided by the National Science Foundation under grant MIP-9311980. The
+original version of this code was written as part of a project to build
+a fixed-point vector processor in collaboration with the University of
+California at Berkeley, overseen by Profs. Nelson Morgan and John Wawrzynek.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL
+LOSSES, COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO
+FURTHERMORE EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER
+SCIENCE INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES,
+COSTS, OR OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE
+SOFTWARE.
+
+Derivative works are acceptable, even for commercial purposes, provided
+that the minimal documentation requirements stated in the source code are
+satisfied.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Sparkle 1.5,
+which may be included with JRE 8 on Mac OS X.
+
+--- begin of LICENSE ---
+
+Copyright (c) 2012 Sparkle.org and Andy Matuschak
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% Portions licensed from Taligent, Inc.
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Thai Dictionary, which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Copyright (C) 1982 The Royal Institute, Thai Royal Government.
+
+Copyright (C) 1998 National Electronics and Computer Technology Center,
+National Science and Technology Development Agency,
+Ministry of Science Technology and Environment,
+Thai Royal Government.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Unicode 6.2.0 & CLDR 21.0.1
+which may be included with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+Unicode Terms of Use
+
+For the general privacy policy governing access to this site, see the Unicode
+Privacy Policy. For trademark usage, see the Unicode® Consortium Name and
+Trademark Usage Policy.
+
+A. Unicode Copyright.
+ 1. Copyright © 1991-2013 Unicode, Inc. All rights reserved.
+
+ 2. Certain documents and files on this website contain a legend indicating
+ that "Modification is permitted." Any person is hereby authorized,
+ without fee, to modify such documents and files to create derivative
+ works conforming to the Unicode® Standard, subject to Terms and
+ Conditions herein.
+
+ 3. Any person is hereby authorized, without fee, to view, use, reproduce,
+ and distribute all documents and files solely for informational
+ purposes in the creation of products supporting the Unicode Standard,
+ subject to the Terms and Conditions herein.
+
+ 4. Further specifications of rights and restrictions pertaining to the use
+ of the particular set of data files known as the "Unicode Character
+ Database" can be found in Exhibit 1.
+
+ 5. Each version of the Unicode Standard has further specifications of
+ rights and restrictions of use. For the book editions (Unicode 5.0 and
+ earlier), these are found on the back of the title page. The online
+ code charts carry specific restrictions. All other files, including
+ online documentation of the core specification for Unicode 6.0 and
+ later, are covered under these general Terms of Use.
+
+ 6. No license is granted to "mirror" the Unicode website where a fee is
+ charged for access to the "mirror" site.
+
+ 7. Modification is not permitted with respect to this document. All copies
+ of this document must be verbatim.
+
+B. Restricted Rights Legend. Any technical data or software which is licensed
+ to the United States of America, its agencies and/or instrumentalities
+ under this Agreement is commercial technical data or commercial computer
+ software developed exclusively at private expense as defined in FAR 2.101,
+ or DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
+ duplication, or disclosure by the Government is subject to restrictions as
+ set forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov
+ 1995) and this Agreement. For Software, in accordance with FAR 12-212 or
+ DFARS 227-7202, as applicable, use, duplication or disclosure by the
+ Government is subject to the restrictions set forth in this Agreement.
+
+C. Warranties and Disclaimers.
+ 1. This publication and/or website may include technical or typographical
+ errors or other inaccuracies . Changes are periodically added to the
+ information herein; these changes will be incorporated in new editions
+ of the publication and/or website. Unicode may make improvements and/or
+ changes in the product(s) and/or program(s) described in this
+ publication and/or website at any time.
+
+ 2. If this file has been purchased on magnetic or optical media from
+ Unicode, Inc. the sole and exclusive remedy for any claim will be
+ exchange of the defective media within ninety (90) days of original
+ purchase.
+
+ 3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR SOFTWARE IS
+ PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, IMPLIED,
+ OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+ UNICODE AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR
+ OMISSIONS IN THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH
+ ARE REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE.
+
+D. Waiver of Damages. In no event shall Unicode or its licensors be liable for
+ any special, incidental, indirect or consequential damages of any kind, or
+ any damages whatsoever, whether or not Unicode was advised of the
+ possibility of the damage, including, without limitation, those resulting
+ from the following: loss of use, data or profits, in connection with the
+ use, modification or distribution of this information or its derivatives.
+
+E.Trademarks & Logos.
+ 1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode,
+ Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of
+ Unicode, Inc. Use of the information and materials found on this
+ website indicates your acknowledgement of Unicode, Inc.’s exclusive
+ worldwide rights in the Unicode Word Mark, the Unicode Logo, and the
+ Unicode trade names.
+
+ 2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark
+ Policy”) are incorporated herein by reference and you agree to abide by
+ the provisions of the Trademark Policy, which may be changed from time
+ to time in the sole discretion of Unicode, Inc.
+
+ 3. All third party trademarks referenced herein are the property of their
+ respective owners.
+
+Miscellaneous.
+ 1. Jurisdiction and Venue. This server is operated from a location in the
+ State of California, United States of America. Unicode makes no
+ representation that the materials are appropriate for use in other
+ locations. If you access this server from other locations, you are
+ responsible for compliance with local laws. This Agreement, all use of
+ this site and any claims and damages resulting from use of this site are
+ governed solely by the laws of the State of California without regard to
+ any principles which would apply the laws of a different jurisdiction.
+ The user agrees that any disputes regarding this site shall be resolved
+ solely in the courts located in Santa Clara County, California. The user
+ agrees said courts have personal jurisdiction and agree to waive any
+ right to transfer the dispute to any other forum.
+
+ 2. Modification by Unicode. Unicode shall have the right to modify this
+ Agreement at any time by posting it to this site. The user may not
+ assign any part of this Agreement without Unicode’s prior written
+ consent.
+
+ 3. Taxes. The user agrees to pay any taxes arising from access to this
+ website or use of the information herein, except for those based on
+ Unicode’s net income.
+
+ 4. Severability. If any provision of this Agreement is declared invalid or
+ unenforceable, the remaining provisions of this Agreement shall remain
+ in effect.
+
+ 5. Entire Agreement. This Agreement constitutes the entire agreement
+ between the parties.
+
+EXHIBIT 1
+UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+Unicode Data Files include all data files under the directories
+http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
+http://www.unicode.org/cldr/data/. Unicode Data Files do not include PDF
+online code charts under the directory http://www.unicode.org/Public/.
+Software includes any source code published in the Unicode Standard or under
+the directories http://www.unicode.org/Public/,
+http://www.unicode.org/reports/, and http://www.unicode.org/cldr/data/.
+
+NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING,
+INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA
+FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO
+BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT
+AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR
+SOFTWARE.
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright © 1991-2012 Unicode, Inc. All rights reserved. Distributed under the
+Terms of Use in http://www.unicode.org/copyright.html.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the Unicode data files and any associated documentation (the "Data Files")
+or Unicode software and any associated documentation (the "Software") to deal
+in the Data Files or Software without restriction, including without
+limitation the rights to use, copy, modify, merge, publish, distribute, and/or
+sell copies of the Data Files or Software, and to permit persons to whom the
+Data Files or Software are furnished to do so, provided that (a) the above
+copyright notice(s) and this permission notice appear with all copies of the
+Data Files or Software, (b) both the above copyright notice(s) and this
+permission notice appear in associated documentation, and (c) there is clear
+notice in each modified Data File or in the Software as well as in the
+documentation associated with the Data File(s) or Software that the data or
+software has been modified.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
+THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE
+DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in these Data Files or Software without prior written authorization of the
+copyright holder.
+
+Unicode and the Unicode logo are trademarks of Unicode, Inc. in the United
+States and other countries. All third party trademarks referenced herein are
+the property of their respective owners.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to UPX v3.01, which may be included
+with JRE 8 on Windows.
+
+--- begin of LICENSE ---
+
+Use of any of this software is governed by the terms of the license below:
+
+
+ ooooo ooo ooooooooo. ooooooo ooooo
+ `888' `8' `888 `Y88. `8888 d8'
+ 888 8 888 .d88' Y888..8P
+ 888 8 888ooo88P' `8888'
+ 888 8 888 .8PY888.
+ `88. .8' 888 d8' `888b
+ `YbodP' o888o o888o o88888o
+
+
+ The Ultimate Packer for eXecutables
+ Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
+ http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
+ http://www.nexus.hu/upx
+ http://upx.tsx.org
+
+
+PLEASE CAREFULLY READ THIS LICENSE AGREEMENT, ESPECIALLY IF YOU PLAN
+TO MODIFY THE UPX SOURCE CODE OR USE A MODIFIED UPX VERSION.
+
+
+ABSTRACT
+========
+
+ UPX and UCL are copyrighted software distributed under the terms
+ of the GNU General Public License (hereinafter the "GPL").
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ As a special exception we grant the free usage of UPX for all
+ executables, including commercial programs.
+ See below for details and restrictions.
+
+
+COPYRIGHT
+=========
+
+ UPX and UCL are copyrighted software. All rights remain with the authors.
+
+ UPX is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+ UPX is Copyright (C) 1996-2000 Laszlo Molnar
+
+ UCL is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
+
+
+GNU GENERAL PUBLIC LICENSE
+==========================
+
+ UPX and the UCL library are free software; you can redistribute them
+ and/or modify them under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ UPX and UCL are distributed in the hope that they 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+
+
+SPECIAL EXCEPTION FOR COMPRESSED EXECUTABLES
+============================================
+
+ The stub which is imbedded in each UPX compressed program is part
+ of UPX and UCL, and contains code that is under our copyright. The
+ terms of the GNU General Public License still apply as compressing
+ a program is a special form of linking with our stub.
+
+ Hereby Markus F.X.J. Oberhumer and Laszlo Molnar grant you special
+ permission to freely use and distribute all UPX compressed programs
+ (including commercial ones), subject to the following restrictions:
+
+ 1. You must compress your program with a completely unmodified UPX
+ version; either with our precompiled version, or (at your option)
+ with a self compiled version of the unmodified UPX sources as
+ distributed by us.
+ 2. This also implies that the UPX stub must be completely unmodfied, i.e.
+ the stub imbedded in your compressed program must be byte-identical
+ to the stub that is produced by the official unmodified UPX version.
+ 3. The decompressor and any other code from the stub must exclusively get
+ used by the unmodified UPX stub for decompressing your program at
+ program startup. No portion of the stub may get read, copied,
+ called or otherwise get used or accessed by your program.
+
+
+ANNOTATIONS
+===========
+
+ - You can use a modified UPX version or modified UPX stub only for
+ programs that are compatible with the GNU General Public License.
+
+ - We grant you special permission to freely use and distribute all UPX
+ compressed programs. But any modification of the UPX stub (such as,
+ but not limited to, removing our copyright string or making your
+ program non-decompressible) will immediately revoke your right to
+ use and distribute a UPX compressed program.
+
+ - UPX is not a software protection tool; by requiring that you use
+ the unmodified UPX version for your proprietary programs we
+ make sure that any user can decompress your program. This protects
+ both you and your users as nobody can hide malicious code -
+ any program that cannot be decompressed is highly suspicious
+ by definition.
+
+ - You can integrate all or part of UPX and UCL into projects that
+ are compatible with the GNU GPL, but obviously you cannot grant
+ any special exceptions beyond the GPL for our code in your project.
+
+ - We want to actively support manufacturers of virus scanners and
+ similar security software. Please contact us if you would like to
+ incorporate parts of UPX or UCL into such a product.
+
+
+
+Markus F.X.J. Oberhumer Laszlo Molnar
+markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
+
+Linz, Austria, 25 Feb 2000
+
+Additional License(s)
+
+The UPX license file is at http://upx.sourceforge.net/upx-license.html.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to Xfree86-VidMode Extension 1.0,
+which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+Version 1.1 of XFree86 ProjectLicence.
+
+Copyright (C) 1994-2004 The XFree86 Project, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicence, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so,subject to the following conditions:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice,this list of conditions, and the following disclaimer.
+
+ 2. 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, and in the same place
+ and form as other copyright, license and disclaimer information.
+
+ 3. The end-user documentation included with the redistribution, if any,must
+ include the following acknowledgment: "This product includes
+ software developed by The XFree86 Project, Inc (http://www.xfree86.org/) and
+ its contributors", in the same place and form as other third-party
+ acknowledgments. Alternately, this acknowledgment may appear in the software
+ itself, in the same form and location as other such third-party
+ acknowledgments.
+
+ 4. Except as contained in this notice, the name of The XFree86 Project,Inc
+ shall not be used in advertising or otherwise to promote the sale, use
+ or other dealings in this Software without prior written authorization from
+ The XFree86 Project, Inc.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 XFREE86 PROJECT, INC OR ITS 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.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to X Window System 6.8.2, which may be
+included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
+
+--- begin of LICENSE ---
+
+ Licenses
+The X.Org Foundation March 2004
+
+1. Introduction
+
+The X.org Foundation X Window System distribution is a compilation of code and
+documentation from many sources. This document is intended primarily as a
+guide to the licenses used in the distribution: you must check each file
+and/or package for precise redistribution terms. None-the-less, this summary
+may be useful to many users. No software incorporating the XFree86 1.1 license
+has been incorporated.
+
+This document is based on the compilation from XFree86.
+
+2. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following
+copyright/license:
+
+Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the XFree86 Project.
+
+3. Other Licenses
+
+Portions of code are covered by the following licenses/copyrights. See
+individual files for the copyright dates.
+
+3.1. X/MIT Copyrights
+
+3.1.1. X Consortium
+
+Copyright (C) <date> X Consortium
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from the X Consortium.
+
+X Window System is a trademark of X Consortium, Inc.
+
+3.1.2. The Open Group
+
+Copyright <date> The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that the
+above copyright notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting documentation.
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from The Open Group. 3.2.
+Berkeley-based copyrights:
+
+o
+3.2.1. General
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.2. UCB/LBL
+
+Copyright (c) 1993 The Regents of the University of California. All rights
+reserved.
+
+This software was developed by the Computer Systems Engineering group at
+Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to
+Berkeley.
+
+All advertising materials mentioning features or use of this software must
+display the following acknowledgement: This product includes software
+developed by the University of California, Lawrence Berkeley Laboratory.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the University of California, Berkeley and its contributors.
+
+ 4. Neither the name of the University nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. 3.2.3. The
+NetBSD Foundation, Inc.
+
+Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved.
+
+This code is derived from software contributed to The NetBSD Foundation by Ben
+Collver <collver1@attbi.com>
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement: This product includes software
+ developed by the NetBSD Foundation, Inc. and its contributors.
+
+ 4. Neither the name of The NetBSD Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. 3.2.4. Theodore
+Ts'o.
+
+Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights
+reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ and the entire permission notice in its entirety, including the disclaimer
+ of warranties.
+
+ 2. 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.
+
+ 3. he name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE, ALL OF WHICH ARE HEREBY DISCLAIMED. IN NO
+EVENT SHALL THE AUTHOR 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 NOT ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. 3.2.5. Theo de Raadt and Damien Miller
+
+Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. Copyright (c)
+2001-2002 Damien Miller. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. 3.2.6. Todd C. Miller
+
+Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 3.2.7. Thomas
+Winischhofer
+
+Copyright (C) 2001-2004 Thomas Winischhofer
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. 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.
+
+ 3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED 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 AUTHOR 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. 3.3. NVIDIA Corp
+
+Copyright (c) 1996 NVIDIA, Corp. All rights reserved.
+
+NOTICE TO USER: The source code is copyrighted under U.S. and international
+laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as design
+patents pending on the design and interface of the NV chips. Users and
+possessors of this source code are hereby granted a nonexclusive, royalty-free
+copyright and design patent license to use this code in individual and
+commercial software.
+
+Any use of this source code must include, in the user documentation and
+internal comments to the code, notices to the end user as follows:
+
+Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. and
+foreign countries.
+
+NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
+CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
+WARRANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE
+FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. 3.4. GLX Public
+License
+
+GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License")
+
+Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby
+grants permission to Recipient (defined below), under Recipient's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below), and to permit persons to whom the Subject Software is
+furnished in accordance with this License to do the same, subject to all of
+the following terms and conditions, which Recipient accepts by engaging in any
+such use, copying, modifying, merging, publishing, distributing, sublicensing
+or selling:
+
+1. Definitions.
+
+ (a) "Original Software" means source code of computer software code which
+ is described in Exhibit A as Original Software.
+
+ (b) "Modifications" means any addition to or deletion from the substance
+ or structure of either the Original Software or any previous
+ Modifications. When Subject Software is released as a series of files, a
+ Modification means (i) any addition to or deletion from the contents of a
+ file containing Original Software or previous Modifications and (ii) any
+ new file that contains any part of the Original Code or previous
+ Modifications.
+
+ (c) "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ (d) "Recipient" means an individual or a legal entity exercising rights
+ under, and complying with all of the terms of, this License. For legal
+ entities, "Recipient" includes any entity which controls, is controlled
+ by, or is under common control with Recipient. For purposes of this
+ definition, "control" of an entity means (a) the power, direct or
+ indirect, to direct or manage such entity, or (b) ownership of fifty
+ percent (50%) or more of the outstanding shares or beneficial ownership of
+ such entity.
+
+2. Redistribution of Source Code Subject to These Terms. Redistributions of
+Subject Software in source code form must retain the notice set forth in
+Exhibit A, below, in every file. A copy of this License must be included in
+any documentation for such Subject Software where the recipients' rights
+relating to Subject Software are described. Recipient may distribute the
+source code version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the source code version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+3. Redistribution in Executable Form. The notice set forth in Exhibit A must
+be conspicuously included in any notice in an executable version of Subject
+Software, related documentation or collateral in which Recipient describes the
+user's rights relating to the Subject Software. Recipient may distribute the
+executable version of Subject Software under a license of Recipient's choice,
+which may contain terms different from this License, provided that (i)
+Recipient is in compliance with the terms of this License, and (ii) the
+license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of
+this License, which terms may not be modified or superseded by any other terms
+of such license. If Recipient distributes the executable version under a
+different license Recipient must make it absolutely clear that any terms which
+differ from this License are offered by Recipient alone, not by SGI. Recipient
+hereby agrees to indemnify SGI for any liability incurred by SGI as a result
+of any such terms Recipient offers.
+
+4. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software which is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+5. No Trademark Rights. This License does not grant any rights to use any
+trade name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from
+the Subject Software without prior written permission of SGI.
+
+6. No Other Rights. This License does not grant any rights with respect to the
+OpenGL API or to any software or hardware implementation thereof or to any
+other software whatsoever, nor shall any other rights or licenses not
+expressly granted hereunder arise by implication, estoppel or otherwise with
+respect to the Subject Software. Title to and ownership of the Original
+Software at all times remains with SGI. All rights in the Original Software
+not expressly granted under this License are reserved.
+
+7. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+8. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Exhibit A notice required under Sections 2 and 3,
+above, and in the text of any related documentation, license agreement or
+collateral in which Recipient describes end user's rights relating to the
+Subject Software. If Recipient obtains such knowledge after it makes Subject
+Software available to any other person or entity, Recipient shall take other
+steps (such as notifying appropriate mailing lists or newsgroups) reasonably
+calculated to inform those who received the Subject Software that new
+knowledge has been obtained.
+
+9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK
+STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF
+THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY
+TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO
+THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT.
+
+11. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. from
+and against any loss, liability, damages, costs or expenses (including the
+payment of reasonable attorneys fees) arising out of Recipient's use,
+modification, reproduction and distribution of the Subject Software or out of
+any representation or warranty made by Recipient.
+
+12. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+13. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed so as to achieve as nearly as
+possible the same economic effect as the original provision and the remainder
+of this License will remain in effect. This License shall be governed by and
+construed in accordance with the laws of the United States and the State of
+California as applied to agreements entered into and to be performed entirely
+within California between California residents. Any litigation relating to
+this License shall be subject to the exclusive jurisdiction of the Federal
+Courts of the Northern District of California (or, absent subject matter
+jurisdiction in such courts, the courts of the State of California), with
+venue lying exclusively in Santa Clara County, California, with the losing
+party responsible for costs, including without limitation, court costs and
+reasonable attorneys fees and expenses. The application of the United Nations
+Convention on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of a contract
+shall be construed against the drafter shall not apply to this License.
+
+Exhibit A
+
+The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and 13
+of the GLX Public License Version 1.0 (the "License"). You may not use this
+file except in compliance with those sections of the License. You may obtain a
+copy of the License at Silicon Graphics, Inc., attn: Legal Services, 2011 N.
+Shoreline Blvd., Mountain View, CA 94043 or at
+http://www.sgi.com/software/opensource/glx/license.html.
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON-
+INFRINGEMENT. See the License for the specific language governing rights and
+limitations under the License.
+
+The Original Software is GLX version 1.2 source code, released February, 1999.
+The developer of the Original Software is Silicon Graphics, Inc. Those
+portions of the Subject Software created by Silicon Graphics, Inc. are
+Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. 3.5. CID
+Font Code Public License
+
+CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License")
+
+Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI")
+hereby grants permission to Recipient (defined below), under SGI's copyrights
+in the Original Software (defined below), to use, copy, modify, merge,
+publish, distribute, sublicense and/or sell copies of Subject Software
+(defined below) in both source code and executable form, and to permit persons
+to whom the Subject Software is furnished in accordance with this License to
+do the same, subject to all of the following terms and conditions, which
+Recipient accepts by engaging in any such use, copying, modifying, merging,
+publication, distributing, sublicensing or selling:
+
+1. Definitions.
+
+ a. "Original Software" means source code of computer software code that is
+ described in Exhibit A as Original Software.
+
+ b. "Modifications" means any addition to or deletion from the substance or
+ structure of either the Original Software or any previous Modifications.
+ When Subject Software is released as a series of files, a Modification
+ means (i) any addition to or deletion from the contents of a file
+ containing Original Software or previous Modifications and (ii) any new
+ file that contains any part of the Original Code or previous
+ Modifications.
+
+ c. "Subject Software" means the Original Software or Modifications or the
+ combination of the Original Software and Modifications, or portions of any
+ of the foregoing.
+
+ d. "Recipient" means an individual or a legal entity exercising rights
+ under the terms of this License. For legal entities, "Recipient" includes
+ any entity that controls, is controlled by, or is under common control
+ with Recipient. For purposes of this definition, "control" of an entity
+ means (i) the power, direct or indirect, to direct or manage such entity,
+ or (ii) ownership of fifty percent (50%) or more of the outstanding shares
+ or beneficial ownership of such entity.
+
+ e. "Required Notice" means the notice set forth in Exhibit A to this
+ License.
+
+ f. "Accompanying Technology" means any software or other technology that
+ is not a Modification and that is distributed or made publicly available
+ by Recipient with the Subject Software. Separate software files that do
+ not contain any Original Software or any previous Modification shall not
+ be deemed a Modification, even if such software files are aggregated as
+ part of a product, or in any medium of storage, with any file that does
+ contain Original Software or any previous Modification.
+
+2. License Terms. All distribution of the Subject Software must be made
+subject to the terms of this License. A copy of this License and the Required
+Notice must be included in any documentation for Subject Software where
+Recipient's rights relating to Subject Software and/or any Accompanying
+Technology are described. Distributions of Subject Software in source code
+form must also include the Required Notice in every file distributed. In
+addition, a ReadMe file entitled "Important Legal Notice" must be distributed
+with each distribution of one or more files that incorporate Subject Software.
+That file must be included with distributions made in both source code and
+executable form. A copy of the License and the Required Notice must be
+included in that file. Recipient may distribute Accompanying Technology under
+a license of Recipient's choice, which may contain terms different from this
+License, provided that (i) Recipient is in compliance with the terms of this
+License, (ii) such other license terms do not modify or supersede the terms of
+this License as applicable to the Subject Software, (iii) Recipient hereby
+indemnifies SGI for any liability incurred by SGI as a result of the
+distribution of Accompanying Technology or the use of other license terms.
+
+3. Termination. This License and the rights granted hereunder will terminate
+automatically if Recipient fails to comply with terms herein and fails to cure
+such breach within 30 days of the breach. Any sublicense to the Subject
+Software that is properly granted shall survive any termination of this
+License absent termination by the terms of such sublicense. Provisions which,
+by their nature, must remain in effect beyond the termination of this License
+shall survive.
+
+4. Trademark Rights. This License does not grant any rights to use any trade
+name, trademark or service mark whatsoever. No trade name, trademark or
+service mark of SGI may be used to endorse or promote products derived from or
+incorporating any Subject Software without prior written permission of SGI.
+
+5. No Other Rights. No rights or licenses not expressly granted hereunder
+shall arise by implication, estoppel or otherwise. Title to and ownership of
+the Original Software at all times remains with SGI. All rights in the
+Original Software not expressly granted under this License are reserved.
+
+6. Compliance with Laws; Non-Infringement. Recipient shall comply with all
+applicable laws and regulations in connection with use and distribution of the
+Subject Software, including but not limited to, all export and import control
+laws and regulations of the U.S. government and other countries. Recipient may
+not distribute Subject Software that (i) in any way infringes (directly or
+contributorily) the rights (including patent, copyright, trade secret,
+trademark or other intellectual property rights of any kind) of any other
+person or entity, or (ii) breaches any representation or warranty, express,
+implied or statutory, which under any applicable law it might be deemed to
+have been distributed.
+
+7. Claims of Infringement. If Recipient at any time has knowledge of any one
+or more third party claims that reproduction, modification, use, distribution,
+import or sale of Subject Software (including particular functionality or code
+incorporated in Subject Software) infringes the third party's intellectual
+property rights, Recipient must place in a well-identified web page bearing
+the title "LEGAL" a description of each such claim and a description of the
+party making each such claim in sufficient detail that a user of the Subject
+Software will know whom to contact regarding the claim. Also, upon gaining
+such knowledge of any such claim, Recipient must conspicuously include the URL
+for such web page in the Required Notice, and in the text of any related
+documentation, license agreement or collateral in which Recipient describes
+end user's rights relating to the Subject Software. If Recipient obtains such
+knowledge after it makes Subject Software available to any other person or
+entity, Recipient shall take other steps (such as notifying appropriate
+mailing lists or newsgroups) reasonably calculated to provide such knowledge
+to those who received the Subject Software.
+
+8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT
+LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS,
+MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO
+RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE
+PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY
+SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
+ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED
+HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY,
+WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY),
+CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR
+THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT
+ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND
+LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED.
+
+10. Indemnity. Recipient shall be solely responsible for damages arising,
+directly or indirectly, out of its utilization of rights under this License.
+Recipient will defend, indemnify and hold SGI and its successors and assigns
+harmless from and against any loss, liability, damages, costs or expenses
+(including the payment of reasonable attorneys fees) arising out of
+(Recipient's use, modification, reproduction and distribution of the Subject
+Software or out of any representation or warranty made by Recipient.
+
+11. U.S. Government End Users. The Subject Software is a "commercial item"
+consisting of "commercial computer software" as such terms are defined in
+title 48 of the Code of Federal Regulations and all U.S. Government End Users
+acquire only the rights set forth in this License and are subject to the terms
+of this License.
+
+12. Miscellaneous. This License represents the complete agreement concerning
+subject matter hereof. If any provision of this License is held to be
+unenforceable by any judicial or administrative authority having proper
+jurisdiction with respect thereto, such provision shall be reformed so as to
+achieve as nearly as possible the same economic effect as the original
+provision and the remainder of this License will remain in effect. This
+License shall be governed by and construed in accordance with the laws of the
+United States and the State of California as applied to agreements entered
+into and to be performed entirely within California between California
+residents. Any litigation relating to this License shall be subject to the
+exclusive jurisdiction of the Federal Courts of the Northern District of
+California (or, absent subject matter jurisdiction in such courts, the courts
+of the State of California), with venue lying exclusively in Santa Clara
+County, California, with the losing party responsible for costs, including
+without limitation, court costs and reasonable attorneys fees and expenses.
+The application of the United Nations Convention on Contracts for the
+International Sale of Goods is expressly excluded. Any law or regulation that
+provides that the language of a contract shall be construed against the
+drafter shall not apply to this License.
+
+Exhibit A
+
+Copyright (c) 1994-1999 Silicon Graphics, Inc.
+
+The contents of this file are subject to the CID Font Code Public License
+Version 1.0 (the "License"). You may not use this file except in compliance
+with the License. You may obtain a copy of the License at Silicon Graphics,
+Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
+or at http://www.sgi.com/software/opensource/cid/license.html
+
+Software distributed under the License is distributed on an "AS IS" basis. ALL
+WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED
+WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF
+NON-INFRINGEMENT. See the License for the specific language governing rights
+and limitations under the License.
+
+The Original Software (as defined in the License) is CID font code that was
+developed by Silicon Graphics, Inc. Those portions of the Subject Software (as
+defined in the License) that were created by Silicon Graphics, Inc. are
+Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved.
+
+[NOTE: When using this text in connection with Subject Software delivered
+solely in object code form, Recipient may replace the words "this file" with
+"this software" in both the first and second sentences.] 3.6. Bitstream Vera
+Fonts Copyright
+
+The fonts have a generous copyright, allowing derivative works (as long as
+"Bitstream" or "Vera" are not in the names), and full redistribution (so long
+as they are not *sold* by themselves). They can be be bundled, redistributed
+and sold with any software.
+
+The fonts are distributed under the following copyright:
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a
+trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of the fonts accompanying this license ("Fonts") and associated documentation
+files (the "Font Software"), to reproduce and distribute the Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit persons to
+whom the Font Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software typefaces.
+
+The Font Software may be modified, altered, or added to, and in particular the
+designs of glyphs or characters in the Fonts may be modified and additional
+glyphs or characters may be added to the Fonts, only if the fonts are renamed
+to names not containing either the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts or Font
+Software that has been modified and is distributed under the "Bitstream Vera"
+names.
+
+The Font Software may be sold as part of a larger software package but no copy
+of one or more of the Font Software typefaces may be sold by itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
+SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO
+USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome Foundation,
+and Bitstream Inc., shall not be used in advertising or otherwise to promote
+the sale, use or other dealings in this Font Software without prior written
+authorization from the Gnome Foundation or Bitstream Inc., respectively. For
+further information, contact: fonts at gnome dot org. 3.7. Bigelow & Holmes
+Inc and URW++ GmbH Luxi font license
+
+Luxi fonts copyright (c) 2001 by Bigelow & Holmes Inc. Luxi font instruction
+code copyright (c) 2001 by URW++ GmbH. All Rights Reserved. Luxi is a
+registered trademark of Bigelow & Holmes Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of these Fonts and associated documentation files (the "Font Software"), to
+deal in the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, sublicense, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice shall be
+included in all copies of one or more of the Font Software.
+
+The Font Software may not be modified, altered, or added to, and in particular
+the designs of glyphs or characters in the Fonts may not be modified nor may
+additional glyphs or characters be added to the Fonts. This License becomes
+null and void when the Fonts or Font Software have been modified.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
+TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BIGELOW & HOLMES INC. OR URW++
+GMBH. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY
+GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
+INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT
+SOFTWARE.
+
+Except as contained in this notice, the names of Bigelow & Holmes Inc. and
+URW++ GmbH. shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Font Software without prior written
+authorization from Bigelow & Holmes Inc. and URW++ GmbH.
+
+For further information, contact:
+
+info@urwpp.de or design@bigelowandholmes.com
+
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to zlib v1.2.8, which may be included
+with JRE 8, JDK 8, and OpenJDK 8.
+
+--- begin of LICENSE ---
+
+ version 1.2.8, April 28th, 2013
+
+ Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
+%% This notice is provided with respect to the following which may be
+included with JRE 8, JDK 8, and OpenJDK 8.
+
+ Apache Commons Math 3.2
+ Apache Derby 10.11.1.2
+ Apache Jakarta BCEL 5.1
+ Apache Jakarta Regexp 1.4
+ Apache Santuario XML Security for Java 1.5.4
+ Apache Xalan-Java 2.7.1
+ Apache Xerces Java 2.10.0
+ Apache XML Resolver 1.1
+ Dynalink 0.5
+
+
+--- begin of LICENSE ---
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+--- end of LICENSE ---
+
+-------------------------------------------------------------------------------
+
diff --git a/staging/linux-x86/jre/bin/java b/staging/linux-x86/jre/bin/java
new file mode 100755
index 0000000..7c05167
--- /dev/null
+++ b/staging/linux-x86/jre/bin/java
Binary files differ
diff --git a/staging/linux-x86/jre/bin/jjs b/staging/linux-x86/jre/bin/jjs
new file mode 100755
index 0000000..10fdc0c
--- /dev/null
+++ b/staging/linux-x86/jre/bin/jjs
Binary files differ
diff --git a/staging/linux-x86/jre/bin/keytool b/staging/linux-x86/jre/bin/keytool
new file mode 100755
index 0000000..fedd8e2
--- /dev/null
+++ b/staging/linux-x86/jre/bin/keytool
Binary files differ
diff --git a/staging/linux-x86/jre/bin/orbd b/staging/linux-x86/jre/bin/orbd
new file mode 100755
index 0000000..c545599
--- /dev/null
+++ b/staging/linux-x86/jre/bin/orbd
Binary files differ
diff --git a/staging/linux-x86/jre/bin/pack200 b/staging/linux-x86/jre/bin/pack200
new file mode 100755
index 0000000..386005a
--- /dev/null
+++ b/staging/linux-x86/jre/bin/pack200
Binary files differ
diff --git a/staging/linux-x86/jre/bin/policytool b/staging/linux-x86/jre/bin/policytool
new file mode 100755
index 0000000..c556ed6
--- /dev/null
+++ b/staging/linux-x86/jre/bin/policytool
Binary files differ
diff --git a/staging/linux-x86/jre/bin/rmid b/staging/linux-x86/jre/bin/rmid
new file mode 100755
index 0000000..d3329a2
--- /dev/null
+++ b/staging/linux-x86/jre/bin/rmid
Binary files differ
diff --git a/staging/linux-x86/jre/bin/rmiregistry b/staging/linux-x86/jre/bin/rmiregistry
new file mode 100755
index 0000000..8a7d840
--- /dev/null
+++ b/staging/linux-x86/jre/bin/rmiregistry
Binary files differ
diff --git a/staging/linux-x86/jre/bin/servertool b/staging/linux-x86/jre/bin/servertool
new file mode 100755
index 0000000..10c3ef9
--- /dev/null
+++ b/staging/linux-x86/jre/bin/servertool
Binary files differ
diff --git a/staging/linux-x86/jre/bin/tnameserv b/staging/linux-x86/jre/bin/tnameserv
new file mode 100755
index 0000000..6e784a1
--- /dev/null
+++ b/staging/linux-x86/jre/bin/tnameserv
Binary files differ
diff --git a/staging/linux-x86/jre/bin/unpack200 b/staging/linux-x86/jre/bin/unpack200
new file mode 100755
index 0000000..0bb3097
--- /dev/null
+++ b/staging/linux-x86/jre/bin/unpack200
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/jli/libjli.so b/staging/linux-x86/jre/lib/amd64/jli/libjli.so
new file mode 100755
index 0000000..1634bc5
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/jli/libjli.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/jvm.cfg b/staging/linux-x86/jre/lib/amd64/jvm.cfg
new file mode 100644
index 0000000..17c4be3
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/jvm.cfg
@@ -0,0 +1,35 @@
+# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+#
+# List of JVMs that can be used as an option to java, javac, etc.
+# Order is important -- first in this list is the default JVM.
+# NOTE that this both this file and its format are UNSUPPORTED and
+# WILL GO AWAY in a future release.
+#
+# You may also select a JVM in an arbitrary location with the
+# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
+# and may not be available in a future release.
+#
+-server KNOWN
+-client IGNORE
diff --git a/staging/linux-x86/jre/lib/amd64/libattach.so b/staging/linux-x86/jre/lib/amd64/libattach.so
new file mode 100755
index 0000000..4ce0e8f
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libattach.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libawt.so b/staging/linux-x86/jre/lib/amd64/libawt.so
new file mode 100755
index 0000000..c554455
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libawt.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libawt_headless.so b/staging/linux-x86/jre/lib/amd64/libawt_headless.so
new file mode 100755
index 0000000..445818d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libawt_headless.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libawt_xawt.so b/staging/linux-x86/jre/lib/amd64/libawt_xawt.so
new file mode 100755
index 0000000..5e2ac27
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libawt_xawt.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libdt_socket.so b/staging/linux-x86/jre/lib/amd64/libdt_socket.so
new file mode 100755
index 0000000..d377925
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libdt_socket.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libfontmanager.so b/staging/linux-x86/jre/lib/amd64/libfontmanager.so
new file mode 100755
index 0000000..10f11d7
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libfontmanager.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libhprof.so b/staging/linux-x86/jre/lib/amd64/libhprof.so
new file mode 100755
index 0000000..48f5b5e
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libhprof.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libinstrument.so b/staging/linux-x86/jre/lib/amd64/libinstrument.so
new file mode 100755
index 0000000..994f49f
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libinstrument.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libj2gss.so b/staging/linux-x86/jre/lib/amd64/libj2gss.so
new file mode 100755
index 0000000..2284214
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libj2gss.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libj2pcsc.so b/staging/linux-x86/jre/lib/amd64/libj2pcsc.so
new file mode 100755
index 0000000..4633ab3
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libj2pcsc.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libj2pkcs11.so b/staging/linux-x86/jre/lib/amd64/libj2pkcs11.so
new file mode 100755
index 0000000..cf2f40d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libj2pkcs11.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjaas_unix.so b/staging/linux-x86/jre/lib/amd64/libjaas_unix.so
new file mode 100755
index 0000000..95713d7
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjaas_unix.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjava.so b/staging/linux-x86/jre/lib/amd64/libjava.so
new file mode 100755
index 0000000..0945616
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjava.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjava_crw_demo.so b/staging/linux-x86/jre/lib/amd64/libjava_crw_demo.so
new file mode 100755
index 0000000..c8a3c6b
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjava_crw_demo.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjawt.so b/staging/linux-x86/jre/lib/amd64/libjawt.so
new file mode 100755
index 0000000..4c16160
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjawt.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjdwp.so b/staging/linux-x86/jre/lib/amd64/libjdwp.so
new file mode 100755
index 0000000..d3e750c
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjdwp.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjpeg.so b/staging/linux-x86/jre/lib/amd64/libjpeg.so
new file mode 100755
index 0000000..ecc12c4
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjpeg.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjsdt.so b/staging/linux-x86/jre/lib/amd64/libjsdt.so
new file mode 100755
index 0000000..8bfc3f4
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjsdt.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjsig.so b/staging/linux-x86/jre/lib/amd64/libjsig.so
new file mode 100755
index 0000000..46d66c6
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjsig.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjsound.so b/staging/linux-x86/jre/lib/amd64/libjsound.so
new file mode 100755
index 0000000..3329d12
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjsound.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libjsoundalsa.so b/staging/linux-x86/jre/lib/amd64/libjsoundalsa.so
new file mode 100755
index 0000000..e92dfee
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libjsoundalsa.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/liblcms.so b/staging/linux-x86/jre/lib/amd64/liblcms.so
new file mode 100755
index 0000000..78cfcab
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/liblcms.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libmanagement.so b/staging/linux-x86/jre/lib/amd64/libmanagement.so
new file mode 100755
index 0000000..15641ec
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libmanagement.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libmlib_image.so b/staging/linux-x86/jre/lib/amd64/libmlib_image.so
new file mode 100755
index 0000000..81ab2c2
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libmlib_image.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libnet.so b/staging/linux-x86/jre/lib/amd64/libnet.so
new file mode 100755
index 0000000..4bd793e
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libnet.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libnio.so b/staging/linux-x86/jre/lib/amd64/libnio.so
new file mode 100755
index 0000000..13320c1
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libnio.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libnpt.so b/staging/linux-x86/jre/lib/amd64/libnpt.so
new file mode 100755
index 0000000..64405e9
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libnpt.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libsaproc.so b/staging/linux-x86/jre/lib/amd64/libsaproc.so
new file mode 100755
index 0000000..aeaf3f4
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libsaproc.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libsctp.so b/staging/linux-x86/jre/lib/amd64/libsctp.so
new file mode 100755
index 0000000..eebd9dd
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libsctp.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libsplashscreen.so b/staging/linux-x86/jre/lib/amd64/libsplashscreen.so
new file mode 100755
index 0000000..b9b4db1
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libsplashscreen.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libsunec.so b/staging/linux-x86/jre/lib/amd64/libsunec.so
new file mode 100755
index 0000000..c7d1aa7
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libsunec.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libunpack.so b/staging/linux-x86/jre/lib/amd64/libunpack.so
new file mode 100755
index 0000000..d10e4c8
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libunpack.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libverify.so b/staging/linux-x86/jre/lib/amd64/libverify.so
new file mode 100755
index 0000000..f636edf
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libverify.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/libzip.so b/staging/linux-x86/jre/lib/amd64/libzip.so
new file mode 100755
index 0000000..12ea89a
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/libzip.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/amd64/server/Xusage.txt b/staging/linux-x86/jre/lib/amd64/server/Xusage.txt
new file mode 100644
index 0000000..d24ada9
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/server/Xusage.txt
@@ -0,0 +1,24 @@
+ -Xmixed mixed mode execution (default)
+ -Xint interpreted mode execution only
+ -Xbootclasspath:<directories and zip/jar files separated by :>
+ set search path for bootstrap classes and resources
+ -Xbootclasspath/a:<directories and zip/jar files separated by :>
+ append to end of bootstrap class path
+ -Xbootclasspath/p:<directories and zip/jar files separated by :>
+ prepend in front of bootstrap class path
+ -Xnoclassgc disable class garbage collection
+ -Xincgc enable incremental garbage collection
+ -Xloggc:<file> log GC status to a file with time stamps
+ -Xbatch disable background compilation
+ -Xms<size> set initial Java heap size
+ -Xmx<size> set maximum Java heap size
+ -Xss<size> set java thread stack size
+ -Xprof output cpu profiling data
+ -Xfuture enable strictest checks, anticipating future default
+ -Xrs reduce use of OS signals by Java/VM (see documentation)
+ -Xcheck:jni perform additional checks for JNI functions
+ -Xshare:off do not attempt to use shared class data
+ -Xshare:auto use shared class data if possible (default)
+ -Xshare:on require using shared class data, otherwise fail.
+
+The -X options are non-standard and subject to change without notice.
diff --git a/staging/linux-x86/jre/lib/amd64/server/libjsig.so b/staging/linux-x86/jre/lib/amd64/server/libjsig.so
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/server/libjsig.so
diff --git a/staging/linux-x86/jre/lib/amd64/server/libjvm.so b/staging/linux-x86/jre/lib/amd64/server/libjvm.so
new file mode 100755
index 0000000..3f85e7d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/amd64/server/libjvm.so
Binary files differ
diff --git a/staging/linux-x86/jre/lib/calendars.properties b/staging/linux-x86/jre/lib/calendars.properties
new file mode 100644
index 0000000..49f68ac
--- /dev/null
+++ b/staging/linux-x86/jre/lib/calendars.properties
@@ -0,0 +1,60 @@
+# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Japanese imperial calendar
+#
+# Meiji since 1868-01-01 00:00:00 local time (Gregorian)
+# Taisho since 1912-07-30 00:00:00 local time (Gregorian)
+# Showa since 1926-12-25 00:00:00 local time (Gregorian)
+# Heisei since 1989-01-08 00:00:00 local time (Gregorian)
+calendar.japanese.type: LocalGregorianCalendar
+calendar.japanese.eras: \
+ name=Meiji,abbr=M,since=-3218832000000; \
+ name=Taisho,abbr=T,since=-1812153600000; \
+ name=Showa,abbr=S,since=-1357603200000; \
+ name=Heisei,abbr=H,since=600220800000
+
+#
+# Taiwanese calendar
+# Minguo since 1911-01-01 00:00:00 local time (Gregorian)
+calendar.taiwanese.type: LocalGregorianCalendar
+calendar.taiwanese.eras: \
+ name=MinGuo,since=-1830384000000
+
+#
+# Thai Buddhist calendar
+# Buddhist Era since -542-01-01 00:00:00 local time (Gregorian)
+calendar.thai-buddhist.type: LocalGregorianCalendar
+calendar.thai-buddhist.eras: \
+ name=BuddhistEra,abbr=B.E.,since=-79302585600000
+calendar.thai-buddhist.year-boundary: \
+ day1=4-1,since=-79302585600000; \
+ day1=1-1,since=-915148800000
+
+#
+# Hijrah calendars
+#
+calendar.hijrah.Hijrah-umalqura: hijrah-config-umalqura.properties
+calendar.hijrah.Hijrah-umalqura.type: islamic-umalqura
diff --git a/staging/linux-x86/jre/lib/charsets.jar b/staging/linux-x86/jre/lib/charsets.jar
new file mode 100644
index 0000000..26c548c
--- /dev/null
+++ b/staging/linux-x86/jre/lib/charsets.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/classlist b/staging/linux-x86/jre/lib/classlist
new file mode 100644
index 0000000..2a3915c
--- /dev/null
+++ b/staging/linux-x86/jre/lib/classlist
@@ -0,0 +1,2559 @@
+java/lang/Object
+java/lang/String
+java/io/Serializable
+java/lang/Comparable
+java/lang/CharSequence
+java/lang/Class
+java/lang/reflect/GenericDeclaration
+java/lang/reflect/AnnotatedElement
+java/lang/reflect/Type
+java/lang/Cloneable
+java/lang/ClassLoader
+java/lang/System
+java/lang/Throwable
+java/lang/Error
+java/lang/ThreadDeath
+java/lang/Exception
+java/lang/RuntimeException
+java/lang/SecurityManager
+java/security/ProtectionDomain
+java/security/AccessControlContext
+java/security/SecureClassLoader
+java/lang/ClassNotFoundException
+java/lang/ReflectiveOperationException
+java/lang/NoClassDefFoundError
+java/lang/LinkageError
+java/lang/ClassCastException
+java/lang/ArrayStoreException
+java/lang/VirtualMachineError
+java/lang/OutOfMemoryError
+java/lang/StackOverflowError
+java/lang/IllegalMonitorStateException
+java/lang/ref/Reference
+java/lang/ref/SoftReference
+java/lang/ref/WeakReference
+java/lang/ref/FinalReference
+java/lang/ref/PhantomReference
+sun/misc/Cleaner
+java/lang/ref/Finalizer
+java/lang/Thread
+java/lang/Runnable
+java/lang/ThreadGroup
+java/lang/Thread$UncaughtExceptionHandler
+java/util/Properties
+java/util/Hashtable
+java/util/Map
+java/util/Dictionary
+java/lang/reflect/AccessibleObject
+java/lang/reflect/Field
+java/lang/reflect/Member
+java/lang/reflect/Parameter
+java/lang/reflect/Method
+java/lang/reflect/Executable
+java/lang/reflect/Constructor
+sun/reflect/MagicAccessorImpl
+sun/reflect/MethodAccessorImpl
+sun/reflect/MethodAccessor
+sun/reflect/ConstructorAccessorImpl
+sun/reflect/ConstructorAccessor
+sun/reflect/DelegatingClassLoader
+sun/reflect/ConstantPool
+sun/reflect/UnsafeStaticFieldAccessorImpl
+sun/reflect/UnsafeFieldAccessorImpl
+sun/reflect/FieldAccessorImpl
+sun/reflect/FieldAccessor
+sun/reflect/CallerSensitive
+java/lang/annotation/Annotation
+java/lang/invoke/DirectMethodHandle
+java/lang/invoke/MethodHandle
+java/lang/invoke/MemberName
+java/lang/invoke/MethodHandleNatives
+java/lang/invoke/LambdaForm
+java/lang/invoke/MethodType
+java/lang/BootstrapMethodError
+java/lang/invoke/CallSite
+java/lang/invoke/ConstantCallSite
+java/lang/invoke/MutableCallSite
+java/lang/invoke/VolatileCallSite
+java/lang/StringBuffer
+java/lang/AbstractStringBuilder
+java/lang/Appendable
+java/lang/StringBuilder
+sun/misc/Unsafe
+java/io/ByteArrayInputStream
+java/io/InputStream
+java/io/Closeable
+java/lang/AutoCloseable
+java/io/File
+java/net/URLClassLoader
+java/net/URL
+java/util/jar/Manifest
+sun/misc/Launcher
+sun/misc/Launcher$AppClassLoader
+sun/misc/Launcher$ExtClassLoader
+java/security/CodeSource
+java/lang/StackTraceElement
+java/nio/Buffer
+java/lang/Boolean
+java/lang/Character
+java/lang/Float
+java/lang/Number
+java/lang/Double
+java/lang/Byte
+java/lang/Short
+java/lang/Integer
+java/lang/Long
+java/lang/NullPointerException
+java/lang/ArithmeticException
+java/io/ObjectStreamField
+java/lang/String$CaseInsensitiveComparator
+java/util/Comparator
+java/lang/RuntimePermission
+java/security/BasicPermission
+java/security/Permission
+java/security/Guard
+java/security/AccessController
+java/lang/reflect/ReflectPermission
+sun/reflect/ReflectionFactory$GetReflectionFactoryAction
+java/security/PrivilegedAction
+java/security/cert/Certificate
+java/util/Vector
+java/util/List
+java/util/Collection
+java/lang/Iterable
+java/util/RandomAccess
+java/util/AbstractList
+java/util/AbstractCollection
+java/util/Stack
+sun/reflect/ReflectionFactory
+java/lang/ref/Reference$Lock
+java/lang/ref/Reference$ReferenceHandler
+java/lang/ref/ReferenceQueue
+java/lang/ref/ReferenceQueue$Null
+java/lang/ref/ReferenceQueue$Lock
+java/lang/ref/Finalizer$FinalizerThread
+sun/misc/VM
+java/util/Hashtable$Entry
+java/util/Map$Entry
+java/lang/Math
+java/nio/charset/Charset
+sun/nio/cs/StandardCharsets
+sun/nio/cs/FastCharsetProvider
+java/nio/charset/spi/CharsetProvider
+sun/nio/cs/StandardCharsets$Aliases
+sun/util/PreHashedMap
+java/util/AbstractMap
+sun/nio/cs/StandardCharsets$Classes
+sun/nio/cs/StandardCharsets$Cache
+java/lang/ThreadLocal
+java/util/concurrent/atomic/AtomicInteger
+java/lang/NoSuchMethodError
+java/lang/IncompatibleClassChangeError
+java/util/ArrayList
+java/util/Collections
+java/util/Collections$EmptySet
+java/util/AbstractSet
+java/util/Set
+java/util/Collections$EmptyList
+java/util/Collections$EmptyMap
+java/util/Collections$UnmodifiableRandomAccessList
+java/util/Collections$UnmodifiableList
+java/util/Collections$UnmodifiableCollection
+sun/reflect/Reflection
+java/util/HashMap
+java/util/HashMap$Node
+java/lang/Class$3
+java/lang/Class$ReflectionData
+java/lang/Class$Atomic
+sun/reflect/generics/repository/ClassRepository
+sun/reflect/generics/repository/GenericDeclRepository
+sun/reflect/generics/repository/AbstractRepository
+java/lang/Class$AnnotationData
+sun/reflect/annotation/AnnotationType
+java/lang/ClassValue$ClassValueMap
+java/util/WeakHashMap
+java/lang/reflect/Modifier
+java/lang/reflect/ReflectAccess
+sun/reflect/LangReflectAccess
+java/util/Arrays
+sun/nio/cs/UTF_8
+sun/nio/cs/Unicode
+sun/nio/cs/HistoricallyNamedCharset
+java/lang/Class$1
+sun/reflect/ReflectionFactory$1
+sun/reflect/NativeConstructorAccessorImpl
+sun/reflect/DelegatingConstructorAccessorImpl
+java/lang/StringCoding
+java/lang/ThreadLocal$ThreadLocalMap
+java/lang/ThreadLocal$ThreadLocalMap$Entry
+java/lang/StringCoding$StringDecoder
+sun/nio/cs/UTF_8$Decoder
+sun/nio/cs/ArrayDecoder
+java/nio/charset/CharsetDecoder
+java/nio/charset/CodingErrorAction
+java/util/Hashtable$EntrySet
+java/util/Collections$SynchronizedSet
+java/util/Collections$SynchronizedCollection
+java/util/Objects
+java/util/Hashtable$Enumerator
+java/util/Enumeration
+java/util/Iterator
+java/lang/Runtime
+sun/misc/Version
+java/io/FileInputStream
+java/io/FileDescriptor
+java/io/FileDescriptor$1
+sun/misc/JavaIOFileDescriptorAccess
+sun/misc/SharedSecrets
+java/io/FileOutputStream
+java/io/OutputStream
+java/io/Flushable
+java/io/BufferedInputStream
+java/io/FilterInputStream
+java/util/concurrent/atomic/AtomicReferenceFieldUpdater
+java/util/concurrent/atomic/AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl
+java/util/concurrent/atomic/AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl$1
+java/security/PrivilegedExceptionAction
+sun/reflect/misc/ReflectUtil
+java/io/PrintStream
+java/io/FilterOutputStream
+java/io/BufferedOutputStream
+java/io/OutputStreamWriter
+java/io/Writer
+sun/nio/cs/StreamEncoder
+sun/security/action/GetPropertyAction
+sun/nio/cs/UTF_8$Encoder
+sun/nio/cs/ArrayEncoder
+java/nio/charset/CharsetEncoder
+java/nio/ByteBuffer
+java/nio/HeapByteBuffer
+java/nio/Bits
+java/nio/ByteOrder
+java/nio/Bits$1
+sun/misc/JavaNioAccess
+java/io/BufferedWriter
+java/io/DefaultFileSystem
+java/io/UnixFileSystem
+java/io/FileSystem
+java/io/ExpiringCache
+java/io/ExpiringCache$1
+java/util/LinkedHashMap
+java/io/File$PathStatus
+java/lang/Enum
+java/nio/file/Path
+java/nio/file/Watchable
+java/lang/StringCoding$StringEncoder
+java/lang/ClassLoader$3
+java/io/ExpiringCache$Entry
+java/util/LinkedHashMap$Entry
+java/lang/ClassLoader$NativeLibrary
+java/lang/Terminator
+java/lang/Terminator$1
+sun/misc/SignalHandler
+sun/misc/Signal
+sun/misc/NativeSignalHandler
+java/lang/Integer$IntegerCache
+sun/misc/OSEnvironment
+java/lang/System$2
+sun/misc/JavaLangAccess
+java/lang/IllegalArgumentException
+java/lang/Compiler
+java/lang/Compiler$1
+sun/misc/Launcher$Factory
+java/net/URLStreamHandlerFactory
+sun/security/util/Debug
+java/lang/ClassLoader$ParallelLoaders
+java/util/WeakHashMap$Entry
+java/util/Collections$SetFromMap
+java/util/WeakHashMap$KeySet
+java/net/URLClassLoader$7
+sun/misc/JavaNetAccess
+java/util/StringTokenizer
+sun/misc/Launcher$ExtClassLoader$1
+sun/misc/MetaIndex
+java/io/BufferedReader
+java/io/Reader
+java/lang/Readable
+java/io/FileReader
+java/io/InputStreamReader
+sun/nio/cs/StreamDecoder
+java/nio/CharBuffer
+java/nio/HeapCharBuffer
+java/nio/charset/CoderResult
+java/nio/charset/CoderResult$1
+java/nio/charset/CoderResult$Cache
+java/nio/charset/CoderResult$2
+java/lang/reflect/Array
+java/io/FileInputStream$1
+sun/net/www/ParseUtil
+java/util/BitSet
+java/util/Locale
+java/util/Locale$Cache
+sun/util/locale/LocaleObjectCache
+java/util/concurrent/ConcurrentHashMap
+java/util/concurrent/ConcurrentMap
+java/util/concurrent/ConcurrentHashMap$Segment
+java/util/concurrent/locks/ReentrantLock
+java/util/concurrent/locks/Lock
+java/util/concurrent/ConcurrentHashMap$Node
+java/util/concurrent/ConcurrentHashMap$CounterCell
+java/util/concurrent/ConcurrentHashMap$KeySetView
+java/util/concurrent/ConcurrentHashMap$CollectionView
+java/util/concurrent/ConcurrentHashMap$ValuesView
+java/util/concurrent/ConcurrentHashMap$EntrySetView
+sun/util/locale/BaseLocale
+sun/util/locale/BaseLocale$Cache
+sun/util/locale/BaseLocale$Key
+sun/util/locale/LocaleObjectCache$CacheEntry
+java/util/Locale$LocaleKey
+sun/util/locale/LocaleUtils
+java/lang/CharacterData
+java/lang/CharacterDataLatin1
+java/net/Parts
+sun/net/www/protocol/file/Handler
+java/net/URLStreamHandler
+java/util/HashMap$TreeNode
+java/security/ProtectionDomain$JavaSecurityAccessImpl
+sun/misc/JavaSecurityAccess
+java/security/ProtectionDomain$2
+sun/misc/JavaSecurityProtectionDomainAccess
+java/security/ProtectionDomain$Key
+java/security/Principal
+java/util/HashSet
+sun/misc/URLClassPath
+sun/net/www/protocol/jar/Handler
+sun/misc/Launcher$AppClassLoader$1
+java/lang/SystemClassLoaderAction
+java/lang/invoke/MethodHandleImpl
+java/lang/invoke/MethodHandleImpl$1
+java/lang/invoke/MethodHandleImpl$2
+java/util/function/Function
+java/lang/invoke/MethodHandleImpl$3
+java/lang/invoke/MethodHandleImpl$4
+java/lang/ClassValue
+java/lang/ClassValue$Entry
+java/lang/ClassValue$Identity
+java/lang/ClassValue$Version
+java/lang/invoke/MemberName$Factory
+java/lang/invoke/MethodHandleStatics
+java/lang/invoke/MethodHandleStatics$1
+sun/misc/PostVMInitHook
+sun/usagetracker/UsageTrackerClient
+java/util/concurrent/atomic/AtomicBoolean
+sun/usagetracker/UsageTrackerClient$1
+sun/usagetracker/UsageTrackerClient$4
+sun/usagetracker/UsageTrackerClient$3
+java/io/FileOutputStream$1
+sun/launcher/LauncherHelper
+java/net/URLClassLoader$1
+sun/net/util/URLUtil
+sun/misc/URLClassPath$3
+sun/misc/URLClassPath$JarLoader
+sun/misc/URLClassPath$Loader
+java/util/zip/ZipFile
+java/util/zip/ZipConstants
+java/util/zip/ZipFile$1
+sun/misc/JavaUtilZipFileAccess
+sun/misc/URLClassPath$JarLoader$1
+sun/misc/FileURLMapper
+java/util/jar/JarFile
+java/util/jar/JavaUtilJarAccessImpl
+sun/misc/JavaUtilJarAccess
+java/nio/charset/StandardCharsets
+sun/nio/cs/US_ASCII
+sun/nio/cs/ISO_8859_1
+sun/nio/cs/UTF_16BE
+sun/nio/cs/UTF_16LE
+sun/nio/cs/UTF_16
+java/util/ArrayDeque
+java/util/Deque
+java/util/Queue
+java/util/zip/ZipCoder
+sun/misc/PerfCounter
+sun/misc/Perf$GetPerfAction
+sun/misc/Perf
+sun/misc/PerfCounter$CoreCounters
+sun/nio/ch/DirectBuffer
+java/nio/DirectByteBuffer
+java/nio/MappedByteBuffer
+java/nio/DirectLongBufferU
+java/nio/LongBuffer
+sun/misc/JarIndex
+sun/misc/ExtensionDependency
+java/util/zip/ZipEntry
+java/util/jar/JarFile$JarFileEntry
+java/util/jar/JarEntry
+java/util/zip/ZipFile$ZipFileInputStream
+java/util/zip/Inflater
+java/util/zip/ZStreamRef
+java/util/zip/ZipFile$ZipFileInflaterInputStream
+java/util/zip/InflaterInputStream
+sun/misc/IOUtils
+sun/misc/URLClassPath$JarLoader$2
+sun/misc/Resource
+sun/nio/ByteBuffered
+java/security/Permissions
+java/security/PermissionCollection
+sun/net/www/protocol/file/FileURLConnection
+sun/net/www/URLConnection
+java/net/URLConnection
+sun/net/www/MessageHeader
+java/io/FilePermission
+java/io/FilePermission$1
+java/io/FilePermissionCollection
+java/security/AllPermission
+java/security/UnresolvedPermission
+java/security/BasicPermissionCollection
+javax/swing/JLabel
+javax/swing/SwingConstants
+javax/accessibility/Accessible
+javax/swing/JComponent
+javax/swing/TransferHandler$HasGetTransferHandler
+java/awt/Container
+java/awt/Component
+java/awt/image/ImageObserver
+java/awt/MenuContainer
+sun/launcher/LauncherHelper$FXHelper
+java/lang/Class$MethodArray
+java/lang/InterruptedException
+javax/swing/JFrame
+javax/swing/WindowConstants
+javax/swing/RootPaneContainer
+java/awt/Frame
+java/awt/Window
+java/util/concurrent/ConcurrentHashMap$ForwardingNode
+java/awt/Graphics
+java/lang/Void
+sun/util/logging/PlatformLogger
+sun/util/logging/PlatformLogger$Level
+sun/util/logging/PlatformLogger$1
+sun/util/logging/PlatformLogger$DefaultLoggerProxy
+sun/util/logging/PlatformLogger$LoggerProxy
+sun/util/logging/PlatformLogger$JavaLoggerProxy
+sun/util/logging/LoggingSupport
+sun/util/logging/LoggingSupport$1
+java/util/logging/LoggingProxyImpl
+sun/util/logging/LoggingProxy
+sun/reflect/UnsafeFieldAccessorFactory
+sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl
+sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl
+java/util/HashMap$EntrySet
+java/util/HashMap$EntryIterator
+java/util/HashMap$HashIterator
+sun/util/logging/LoggingSupport$2
+java/util/Date
+sun/util/calendar/CalendarSystem
+sun/util/calendar/Gregorian
+sun/util/calendar/BaseCalendar
+sun/util/calendar/AbstractCalendar
+java/awt/Component$AWTTreeLock
+java/awt/Toolkit
+java/awt/Toolkit$4
+sun/awt/AWTAccessor$ToolkitAccessor
+sun/awt/AWTAccessor
+java/awt/Toolkit$5
+sun/util/CoreResourceBundleControl
+java/util/ResourceBundle$Control
+java/util/Arrays$ArrayList
+java/util/ResourceBundle$Control$CandidateListCache
+java/util/ResourceBundle
+java/util/ResourceBundle$1
+java/util/spi/ResourceBundleControlProvider
+java/util/ServiceLoader
+java/util/ServiceLoader$LazyIterator
+java/util/ServiceLoader$1
+java/util/LinkedHashMap$LinkedEntrySet
+java/util/LinkedHashMap$LinkedEntryIterator
+java/util/LinkedHashMap$LinkedHashIterator
+sun/misc/Launcher$BootClassPathHolder
+sun/misc/Launcher$BootClassPathHolder$1
+sun/misc/URLClassPath$2
+java/lang/ClassLoader$2
+sun/misc/URLClassPath$1
+java/net/URLClassLoader$3
+sun/misc/CompoundEnumeration
+java/io/FileNotFoundException
+java/io/IOException
+java/security/PrivilegedActionException
+java/net/URLClassLoader$3$1
+java/util/ResourceBundle$RBClassLoader
+java/util/ResourceBundle$RBClassLoader$1
+java/util/ResourceBundle$CacheKey
+java/util/ResourceBundle$LoaderReference
+java/util/ResourceBundle$CacheKeyReference
+java/util/ResourceBundle$SingleFormatControl
+java/util/LinkedList
+java/util/AbstractSequentialList
+java/util/LinkedList$Node
+sun/awt/resources/awt
+java/util/ListResourceBundle
+java/awt/Toolkit$3
+java/awt/GraphicsEnvironment
+java/lang/invoke/LambdaMetafactory
+java/lang/invoke/MethodHandles$Lookup
+java/lang/invoke/MethodType$ConcurrentWeakInternSet
+java/lang/invoke/MethodTypeForm
+java/lang/invoke/Invokers
+java/lang/invoke/MethodType$ConcurrentWeakInternSet$WeakEntry
+java/lang/invoke/MethodHandles
+sun/invoke/util/Wrapper
+sun/invoke/util/Wrapper$Format
+java/lang/Byte$ByteCache
+java/lang/Short$ShortCache
+java/lang/Character$CharacterCache
+java/lang/Long$LongCache
+sun/invoke/util/VerifyAccess
+sun/invoke/util/ValueConversions
+java/lang/NoSuchMethodException
+java/lang/invoke/LambdaForm$BasicType
+java/lang/invoke/LambdaForm$Name
+java/lang/invoke/LambdaForm$NamedFunction
+java/lang/invoke/SimpleMethodHandle
+java/lang/invoke/BoundMethodHandle
+java/lang/invoke/BoundMethodHandle$SpeciesData
+java/lang/invoke/BoundMethodHandle$Factory
+java/lang/invoke/BoundMethodHandle$Species_L
+java/util/HashMap$Values
+java/util/HashMap$ValueIterator
+sun/invoke/util/BytecodeDescriptor
+java/lang/invoke/DirectMethodHandle$Lazy
+java/lang/InstantiationException
+java/util/Collections$UnmodifiableCollection$1
+java/util/AbstractList$Itr
+java/lang/invoke/InvokerBytecodeGenerator
+jdk/internal/org/objectweb/asm/ClassWriter
+jdk/internal/org/objectweb/asm/ClassVisitor
+jdk/internal/org/objectweb/asm/ByteVector
+jdk/internal/org/objectweb/asm/Item
+jdk/internal/org/objectweb/asm/MethodWriter
+jdk/internal/org/objectweb/asm/MethodVisitor
+jdk/internal/org/objectweb/asm/Type
+jdk/internal/org/objectweb/asm/Label
+jdk/internal/org/objectweb/asm/Frame
+jdk/internal/org/objectweb/asm/AnnotationWriter
+jdk/internal/org/objectweb/asm/AnnotationVisitor
+java/lang/invoke/MethodHandleImpl$Intrinsic
+java/lang/invoke/InvokerBytecodeGenerator$2
+sun/invoke/util/VerifyType
+sun/invoke/empty/Empty
+java/lang/NoSuchFieldException
+java/lang/invoke/InvokerBytecodeGenerator$CpPatch
+java/lang/invoke/DirectMethodHandle$Accessor
+java/util/ArrayList$Itr
+java/util/RandomAccessSubList
+java/util/SubList
+java/util/SubList$1
+java/util/ListIterator
+java/util/AbstractList$ListItr
+java/lang/invoke/MethodHandleImpl$AsVarargsCollector
+java/lang/invoke/DelegatingMethodHandle
+java/lang/invoke/WrongMethodTypeException
+java/lang/invoke/MethodHandleImpl$Lazy
+java/lang/invoke/MethodHandleImpl$IntrinsicMethodHandle
+java/lang/NoSuchFieldError
+java/lang/IllegalAccessException
+java/lang/invoke/LambdaFormEditor
+java/lang/invoke/LambdaFormEditor$Transform$Kind
+java/lang/invoke/LambdaFormEditor$Transform
+java/lang/invoke/LambdaFormBuffer
+jdk/internal/org/objectweb/asm/FieldWriter
+jdk/internal/org/objectweb/asm/FieldVisitor
+java/lang/invoke/InnerClassLambdaMetafactory
+java/lang/invoke/AbstractValidatingLambdaMetafactory
+java/util/PropertyPermission
+java/security/AccessController$1
+sun/security/util/SecurityConstants
+java/net/NetPermission
+java/security/SecurityPermission
+java/net/SocketPermission
+sun/security/action/GetBooleanAction
+java/security/AllPermissionCollection
+java/lang/invoke/InfoFromMemberName
+java/lang/invoke/MethodHandleInfo
+java/lang/invoke/InnerClassLambdaMetafactory$ForwardingMethodGenerator
+java/lang/invoke/TypeConvertingMethodAdapter
+java/lang/invoke/InnerClassLambdaMetafactory$1
+java/lang/ProcessEnvironment
+java/lang/ProcessEnvironment$Variable
+java/lang/ProcessEnvironment$ExternalData
+java/lang/ProcessEnvironment$Value
+java/lang/ProcessEnvironment$StringEnvironment
+java/util/Collections$UnmodifiableMap
+java/awt/Toolkit$1
+java/awt/event/KeyEvent
+java/awt/event/InputEvent
+java/awt/event/ComponentEvent
+java/awt/AWTEvent
+java/util/EventObject
+java/awt/AWTEvent$1
+sun/awt/AWTAccessor$AWTEventAccessor
+java/awt/event/NativeLibLoader
+java/awt/event/NativeLibLoader$1
+java/awt/event/InputEvent$1
+sun/awt/AWTAccessor$InputEventAccessor
+java/awt/event/KeyEvent$1
+sun/awt/AWTAccessor$KeyEventAccessor
+java/awt/Component$1
+sun/awt/AWTAccessor$ComponentAccessor
+java/awt/Component$DummyRequestFocusController
+sun/awt/RequestFocusController
+java/awt/LayoutManager
+java/awt/LightweightDispatcher
+java/awt/event/AWTEventListener
+java/util/EventListener
+java/awt/Dimension
+java/awt/geom/Dimension2D
+java/awt/Container$1
+sun/awt/AWTAccessor$ContainerAccessor
+javax/swing/JComponent$1
+java/awt/ComponentOrientation
+java/awt/Component$3
+sun/awt/AppContext
+java/util/IdentityHashMap
+java/util/Collections$SynchronizedMap
+sun/awt/AppContext$GetAppContextLock
+sun/awt/AppContext$6
+sun/misc/JavaAWTAccess
+sun/awt/AppContext$3
+sun/awt/AppContext$2
+sun/awt/SunToolkit
+sun/awt/WindowClosingSupport
+sun/awt/WindowClosingListener
+sun/awt/ComponentFactory
+sun/awt/InputMethodSupport
+sun/awt/KeyboardFocusManagerPeerProvider
+java/util/concurrent/locks/ReentrantLock$NonfairSync
+java/util/concurrent/locks/ReentrantLock$Sync
+java/util/concurrent/locks/AbstractQueuedSynchronizer
+java/util/concurrent/locks/AbstractOwnableSynchronizer
+java/util/concurrent/locks/AbstractQueuedSynchronizer$Node
+java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject
+java/util/concurrent/locks/Condition
+sun/misc/SoftCache
+sun/awt/AppContext$State
+sun/awt/AppContext$1
+java/awt/EventQueue
+java/awt/EventQueue$1
+java/awt/EventQueue$2
+sun/awt/AWTAccessor$EventQueueAccessor
+java/awt/Queue
+sun/awt/MostRecentKeyValue
+sun/awt/PostEventQueue
+javax/swing/event/EventListenerList
+javax/swing/SwingUtilities
+javax/swing/RepaintManager
+javax/swing/RepaintManager$DisplayChangedHandler
+sun/awt/DisplayChangedListener
+javax/swing/RepaintManager$1
+sun/swing/SwingAccessor$RepaintManagerAccessor
+sun/swing/SwingAccessor
+sun/awt/X11GraphicsEnvironment
+sun/java2d/SunGraphicsEnvironment
+sun/awt/X11GraphicsEnvironment$1
+sun/awt/X11/XErrorHandlerUtil
+sun/awt/X11/XlibWrapper
+sun/java2d/UnixSurfaceManagerFactory
+sun/java2d/SurfaceManagerFactory
+sun/awt/SunDisplayChanger
+sun/java2d/SunGraphicsEnvironment$1
+sun/misc/FloatingDecimal
+sun/misc/FloatingDecimal$ExceptionalBinaryToASCIIBuffer
+sun/misc/FloatingDecimal$BinaryToASCIIConverter
+sun/misc/FloatingDecimal$BinaryToASCIIBuffer
+sun/misc/FloatingDecimal$1
+sun/misc/FloatingDecimal$PreparedASCIIToBinaryBuffer
+sun/misc/FloatingDecimal$ASCIIToBinaryConverter
+java/lang/NumberFormatException
+java/lang/StringIndexOutOfBoundsException
+java/lang/IndexOutOfBoundsException
+java/awt/Font
+java/awt/Font$FontAccessImpl
+sun/font/FontAccess
+java/awt/geom/AffineTransform
+sun/font/AttributeValues
+sun/font/EAttribute
+java/text/AttributedCharacterIterator$Attribute
+java/lang/Class$4
+sun/reflect/NativeMethodAccessorImpl
+sun/reflect/DelegatingMethodAccessorImpl
+java/awt/font/TextAttribute
+java/awt/Toolkit$2
+sun/awt/X11/XToolkit
+sun/awt/UNIXToolkit
+java/util/TreeMap
+java/util/NavigableMap
+java/util/SortedMap
+java/awt/GraphicsDevice
+sun/awt/X11GraphicsDevice
+sun/awt/X11GraphicsConfig
+sun/awt/image/SurfaceManager$ProxiedGraphicsConfig
+java/awt/GraphicsConfiguration
+java/awt/ImageCapabilities
+sun/java2d/x11/X11SurfaceData
+sun/java2d/x11/XSurfaceData
+sun/java2d/SurfaceData
+java/awt/Transparency
+sun/java2d/DisposerTarget
+sun/java2d/StateTrackable
+sun/java2d/Surface
+sun/java2d/InvalidPipeException
+java/lang/IllegalStateException
+sun/java2d/NullSurfaceData
+sun/java2d/StateTrackable$State
+sun/java2d/loops/SurfaceType
+sun/awt/image/PixelConverter
+sun/awt/image/PixelConverter$Xrgb
+sun/awt/image/PixelConverter$Argb
+sun/awt/image/PixelConverter$ArgbPre
+sun/awt/image/PixelConverter$Xbgr
+sun/awt/image/PixelConverter$Rgba
+sun/awt/image/PixelConverter$RgbaPre
+sun/awt/image/PixelConverter$Ushort565Rgb
+sun/awt/image/PixelConverter$Ushort555Rgb
+sun/awt/image/PixelConverter$Ushort555Rgbx
+sun/awt/image/PixelConverter$Ushort4444Argb
+sun/awt/image/PixelConverter$ByteGray
+sun/awt/image/PixelConverter$UshortGray
+sun/awt/image/PixelConverter$Rgbx
+sun/awt/image/PixelConverter$Bgrx
+sun/awt/image/PixelConverter$ArgbBm
+java/awt/image/ColorModel
+java/awt/image/ColorModel$1
+java/awt/image/DirectColorModel
+java/awt/image/PackedColorModel
+java/awt/color/ColorSpace
+java/awt/color/ICC_Profile
+sun/java2d/cmm/ProfileDeferralInfo
+sun/java2d/cmm/ProfileDeferralMgr
+java/awt/color/ICC_ProfileRGB
+java/awt/color/ICC_Profile$1
+sun/java2d/cmm/ProfileActivator
+java/awt/color/ICC_ColorSpace
+sun/java2d/StateTrackableDelegate
+sun/java2d/StateTrackableDelegate$2
+sun/java2d/pipe/NullPipe
+sun/java2d/pipe/PixelDrawPipe
+sun/java2d/pipe/PixelFillPipe
+sun/java2d/pipe/ShapeDrawPipe
+sun/java2d/pipe/TextPipe
+sun/java2d/pipe/DrawImagePipe
+java/awt/image/IndexColorModel
+sun/java2d/pipe/LoopPipe
+sun/java2d/pipe/ParallelogramPipe
+sun/java2d/pipe/LoopBasedPipe
+sun/java2d/pipe/RenderingEngine
+sun/java2d/pipe/RenderingEngine$1
+sun/dc/DuctusRenderingEngine
+sun/java2d/pipe/OutlineTextRenderer
+sun/java2d/pipe/SolidTextRenderer
+sun/java2d/pipe/GlyphListLoopPipe
+sun/java2d/pipe/GlyphListPipe
+sun/java2d/pipe/AATextRenderer
+sun/java2d/pipe/LCDTextRenderer
+sun/java2d/pipe/AlphaColorPipe
+sun/java2d/pipe/CompositePipe
+sun/java2d/SurfaceData$PixelToShapeLoopConverter
+sun/java2d/pipe/PixelToShapeConverter
+sun/java2d/SurfaceData$PixelToPgramLoopConverter
+sun/java2d/pipe/PixelToParallelogramConverter
+sun/java2d/pipe/TextRenderer
+sun/java2d/pipe/SpanClipRenderer
+sun/java2d/pipe/Region
+sun/java2d/pipe/RegionIterator
+sun/java2d/pipe/Region$ImmutableRegion
+sun/java2d/pipe/AAShapePipe
+sun/java2d/pipe/AlphaPaintPipe
+sun/java2d/pipe/SpanShapeRenderer$Composite
+sun/java2d/pipe/SpanShapeRenderer
+sun/java2d/pipe/GeneralCompositePipe
+sun/java2d/pipe/DrawImage
+sun/java2d/loops/RenderCache
+sun/java2d/loops/RenderCache$Entry
+sun/java2d/loops/XORComposite
+java/awt/Composite
+sun/font/X11TextRenderer
+sun/java2d/loops/GraphicsPrimitive
+sun/java2d/x11/X11PMBlitLoops
+sun/java2d/loops/Blit
+sun/java2d/loops/GraphicsPrimitiveMgr
+sun/java2d/loops/CompositeType
+sun/java2d/SunGraphics2D
+sun/awt/ConstrainableGraphics
+sun/java2d/DestSurfaceProvider
+java/awt/Graphics2D
+java/awt/Color
+java/awt/Paint
+java/awt/AlphaComposite
+java/awt/geom/Path2D
+java/awt/Shape
+java/awt/geom/Path2D$Float
+sun/awt/SunHints
+sun/java2d/loops/BlitBg
+sun/java2d/loops/ScaledBlit
+sun/java2d/loops/FillRect
+sun/java2d/loops/FillSpans
+sun/java2d/loops/FillParallelogram
+sun/java2d/loops/DrawParallelogram
+sun/java2d/loops/DrawLine
+sun/java2d/loops/DrawRect
+sun/java2d/loops/DrawPolygons
+sun/java2d/loops/DrawPath
+sun/java2d/loops/FillPath
+sun/java2d/loops/MaskBlit
+sun/java2d/loops/MaskFill
+sun/java2d/loops/DrawGlyphList
+sun/java2d/loops/DrawGlyphListAA
+sun/java2d/loops/DrawGlyphListLCD
+sun/java2d/loops/TransformHelper
+java/awt/BasicStroke
+java/awt/Stroke
+sun/misc/PerformanceLogger
+sun/misc/PerformanceLogger$TimeData
+sun/java2d/pipe/ValidatePipe
+sun/awt/SunHints$Key
+java/awt/RenderingHints$Key
+sun/awt/SunHints$Value
+sun/awt/SunHints$LCDContrastKey
+sun/java2d/loops/CustomComponent
+sun/java2d/loops/GraphicsPrimitiveProxy
+sun/java2d/loops/GeneralRenderer
+sun/java2d/loops/GraphicsPrimitiveMgr$1
+sun/java2d/loops/GraphicsPrimitiveMgr$2
+sun/java2d/x11/X11PMBlitLoops$DelegateBlitLoop
+sun/java2d/x11/X11PMBlitBgLoops
+sun/java2d/x11/X11SurfaceData$LazyPipe
+sun/awt/X11GraphicsConfig$X11GCDisposerRecord
+sun/java2d/DisposerRecord
+sun/java2d/Disposer
+sun/java2d/Disposer$1
+sun/misc/ThreadGroupUtils
+sun/awt/X11/XModifierKeymap
+sun/awt/X11/XWrapperBase
+sun/awt/X11/Native
+sun/awt/X11/Native$1
+sun/awt/X11/XToolkit$3
+sun/awt/X11/XToolkit$4
+sun/awt/X11/XEventDispatcher
+java/awt/Toolkit$DesktopPropertyChangeSupport
+java/beans/PropertyChangeSupport
+java/beans/PropertyChangeSupport$PropertyChangeListenerMap
+java/beans/ChangeListenerMap
+java/beans/PropertyChangeListener
+sun/awt/SunToolkit$ModalityListenerList
+sun/awt/ModalityListener
+sun/font/FontConfigManager
+sun/font/FontConfigManager$FontConfigInfo
+sun/awt/X11/AwtScreenData
+sun/awt/X11/XToolkit$1
+java/lang/invoke/DirectMethodHandle$Special
+sun/awt/X11/XToolkit$2
+java/lang/ApplicationShutdownHooks
+java/lang/ApplicationShutdownHooks$1
+java/lang/Shutdown
+java/lang/Shutdown$Lock
+sun/awt/X11/XWM
+sun/awt/X11/XAtom
+java/awt/Insets
+sun/awt/X11/XWM$1
+sun/awt/X11/XErrorHandler$XBaseErrorHandler
+sun/awt/X11/XErrorHandler
+sun/awt/X11/XSetWindowAttributes
+sun/awt/X11/XNETProtocol
+sun/awt/X11/XStateProtocol
+sun/awt/X11/XLayerProtocol
+sun/awt/X11/XProtocol
+sun/awt/X11/WindowPropertyGetter
+sun/awt/X11/UnsafeXDisposerRecord
+sun/awt/X11/XPropertyCache
+sun/awt/X11/XWINProtocol
+sun/awt/X11/XAtomList
+java/awt/Rectangle
+java/awt/geom/Rectangle2D
+sun/awt/X11/XEvent
+java/awt/geom/RectangularShape
+javax/swing/RepaintManager$ProcessingRunnable
+com/sun/java/swing/SwingUtilities3
+javax/swing/UIManager
+javax/swing/UIManager$LookAndFeelInfo
+sun/awt/OSInfo
+sun/awt/OSInfo$WindowsVersion
+sun/awt/OSInfo$1
+sun/awt/OSInfo$OSType
+sun/swing/SwingUtilities2
+java/awt/font/FontRenderContext
+java/awt/RenderingHints
+sun/swing/StringUIClientPropertyKey
+sun/swing/UIClientPropertyKey
+sun/swing/SwingUtilities2$LSBCacheEntry
+javax/swing/UIManager$LAFState
+javax/swing/UIDefaults
+javax/swing/MultiUIDefaults
+javax/swing/UIManager$1
+javax/swing/plaf/metal/MetalLookAndFeel
+javax/swing/plaf/basic/BasicLookAndFeel
+javax/swing/LookAndFeel
+sun/swing/DefaultLookup
+javax/swing/plaf/metal/OceanTheme
+javax/swing/plaf/metal/DefaultMetalTheme
+javax/swing/plaf/metal/MetalTheme
+javax/swing/plaf/ColorUIResource
+javax/swing/plaf/UIResource
+sun/swing/PrintColorUIResource
+javax/swing/plaf/metal/DefaultMetalTheme$FontDelegate
+javax/swing/plaf/FontUIResource
+sun/swing/SwingLazyValue
+javax/swing/UIDefaults$LazyValue
+javax/swing/UIDefaults$ActiveValue
+javax/swing/plaf/InsetsUIResource
+javax/swing/plaf/BorderUIResource$EmptyBorderUIResource
+javax/swing/border/EmptyBorder
+javax/swing/border/AbstractBorder
+javax/swing/border/Border
+sun/swing/SwingUtilities2$2
+javax/swing/plaf/basic/BasicLookAndFeel$2
+javax/swing/plaf/DimensionUIResource
+javax/swing/UIDefaults$LazyInputMap
+javax/swing/plaf/metal/MetalLookAndFeel$FontActiveValue
+sun/swing/SwingUtilities2$AATextInfo
+sun/awt/HeadlessToolkit
+sun/awt/X11/XAWTXSettings
+sun/awt/X11/XMSelectionListener
+sun/awt/XSettings
+sun/awt/X11/XMSelection
+sun/awt/X11/XMSelection$1
+sun/awt/X11/XMSelection$3
+sun/awt/X11/XErrorHandler$IgnoreBadWindowHandler
+sun/awt/XSettings$Update
+java/beans/PropertyChangeEvent
+java/awt/Toolkit$DesktopPropertyChangeSupport$1
+java/util/IdentityHashMap$Values
+java/util/IdentityHashMap$ValueIterator
+java/util/IdentityHashMap$IdentityHashMapIterator
+java/util/HashMap$KeySet
+java/util/HashMap$KeyIterator
+javax/swing/plaf/metal/MetalLookAndFeel$AATextListener
+java/beans/PropertyChangeListenerProxy
+java/util/EventListenerProxy
+javax/swing/plaf/metal/OceanTheme$1
+javax/swing/plaf/metal/OceanTheme$2
+javax/swing/plaf/metal/OceanTheme$3
+javax/swing/plaf/metal/OceanTheme$4
+javax/swing/plaf/metal/OceanTheme$5
+javax/swing/plaf/metal/OceanTheme$6
+javax/swing/SwingPaintEventDispatcher
+sun/awt/PaintEventDispatcher
+java/awt/KeyboardFocusManager
+java/awt/KeyEventDispatcher
+java/awt/KeyEventPostProcessor
+java/awt/KeyboardFocusManager$1
+sun/awt/AWTAccessor$KeyboardFocusManagerAccessor
+java/awt/AWTKeyStroke
+java/awt/AWTKeyStroke$1
+java/awt/DefaultKeyboardFocusManager
+java/awt/DefaultKeyboardFocusManager$1
+sun/awt/AWTAccessor$DefaultKeyboardFocusManagerAccessor
+java/awt/DefaultFocusTraversalPolicy
+java/awt/ContainerOrderFocusTraversalPolicy
+java/awt/FocusTraversalPolicy
+java/util/Collections$UnmodifiableSet
+sun/awt/X11/XKeyboardFocusManagerPeer
+sun/awt/KeyboardFocusManagerPeerImpl
+java/awt/peer/KeyboardFocusManagerPeer
+javax/swing/UIManager$2
+javax/swing/JRootPane
+javax/swing/UIDefaults$TextAndMnemonicHashMap
+com/sun/swing/internal/plaf/metal/resources/metal
+sun/util/ResourceBundleEnumeration
+com/sun/swing/internal/plaf/basic/resources/basic
+javax/swing/plaf/metal/MetalLabelUI
+javax/swing/plaf/basic/BasicLabelUI
+javax/swing/plaf/LabelUI
+javax/swing/plaf/ComponentUI
+sun/reflect/misc/MethodUtil
+sun/reflect/misc/MethodUtil$1
+sun/net/www/protocol/jar/JarURLConnection
+java/net/JarURLConnection
+sun/net/www/protocol/jar/JarFileFactory
+sun/net/www/protocol/jar/URLJarFile$URLJarFileCloseController
+java/net/HttpURLConnection
+sun/net/www/protocol/jar/URLJarFile
+sun/net/www/protocol/jar/URLJarFile$URLJarFileEntry
+sun/net/www/protocol/jar/JarURLConnection$JarURLInputStream
+java/lang/UnsupportedOperationException
+java/lang/reflect/InvocationTargetException
+javax/swing/plaf/metal/DefaultMetalTheme$FontDelegate$1
+javax/swing/plaf/basic/BasicHTML
+sun/awt/util/IdentityArrayList
+java/awt/Window$1
+sun/awt/AWTAccessor$WindowAccessor
+java/awt/Frame$1
+sun/awt/AWTAccessor$FrameAccessor
+java/awt/Window$Type
+java/awt/Cursor
+java/awt/Cursor$1
+sun/awt/AWTAccessor$CursorAccessor
+java/awt/BorderLayout
+java/awt/LayoutManager2
+sun/awt/X11/XlibUtil
+java/util/concurrent/locks/LockSupport
+sun/nio/ch/Interruptible
+java/awt/Dialog$ModalExclusionType
+java/awt/Window$WindowDisposerRecord
+javax/swing/JPanel
+java/awt/FlowLayout
+javax/swing/plaf/basic/BasicPanelUI
+javax/swing/plaf/PanelUI
+java/awt/Component$BaselineResizeBehavior
+sun/swing/SwingLazyValue$1
+javax/swing/JLayeredPane
+javax/swing/JRootPane$1
+javax/swing/ArrayTable
+javax/swing/JRootPane$RootLayout
+javax/swing/BufferStrategyPaintManager
+javax/swing/RepaintManager$PaintManager
+javax/swing/FocusManager
+javax/swing/LayoutFocusTraversalPolicy
+javax/swing/SortingFocusTraversalPolicy
+javax/swing/InternalFrameFocusTraversalPolicy
+javax/swing/SwingContainerOrderFocusTraversalPolicy
+javax/swing/SortingFocusTraversalPolicy$1
+java/util/Spliterator$OfLong
+java/util/Spliterator$OfPrimitive
+java/util/Spliterator
+java/util/Spliterator$OfInt
+java/util/Spliterator$OfDouble
+java/util/stream/IntStream
+java/util/stream/BaseStream
+java/util/stream/Stream
+java/util/stream/DoubleStream
+java/util/stream/LongStream
+java/util/function/DoubleBinaryOperator
+java/util/function/IntBinaryOperator
+java/util/function/LongBinaryOperator
+java/util/function/BinaryOperator
+java/util/function/BiFunction
+java/util/function/IntToDoubleFunction
+java/util/function/IntFunction
+java/util/function/IntToLongFunction
+java/util/function/IntUnaryOperator
+javax/swing/SwingDefaultFocusTraversalPolicy
+javax/swing/LayoutComparator
+javax/swing/plaf/metal/MetalRootPaneUI
+javax/swing/plaf/basic/BasicRootPaneUI
+javax/swing/plaf/RootPaneUI
+javax/swing/plaf/basic/BasicRootPaneUI$RootPaneInputMap
+javax/swing/plaf/ComponentInputMapUIResource
+javax/swing/ComponentInputMap
+javax/swing/InputMap
+javax/swing/plaf/InputMapUIResource
+javax/swing/KeyStroke
+java/awt/VKCollection
+sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl
+javax/swing/plaf/basic/LazyActionMap
+javax/swing/plaf/ActionMapUIResource
+javax/swing/ActionMap
+sun/awt/X11/XFramePeer
+java/awt/peer/FramePeer
+java/awt/peer/WindowPeer
+java/awt/peer/ContainerPeer
+java/awt/peer/ComponentPeer
+sun/awt/X11/XDecoratedPeer
+sun/awt/X11/XWindowPeer
+sun/awt/X11/XPanelPeer
+java/awt/peer/PanelPeer
+sun/awt/X11/XCanvasPeer
+java/awt/peer/CanvasPeer
+sun/awt/X11/XComponentPeer
+java/awt/dnd/peer/DropTargetPeer
+sun/java2d/BackBufferCapsProvider
+sun/awt/X11/XWindow
+sun/awt/X11ComponentPeer
+sun/awt/X11/XBaseWindow
+sun/awt/X11/XCreateWindowParams
+sun/awt/X11/XBaseWindow$InitialiseState
+sun/awt/X11/XBaseWindow$StateLock
+sun/awt/X11/AwtGraphicsConfigData
+sun/awt/X11/XVisualInfo
+java/awt/SystemColor
+sun/awt/AWTAccessor$SystemColorAccessor
+sun/awt/X11/MotifColorUtilities
+sun/awt/X11/XRepaintArea
+sun/awt/RepaintArea
+sun/awt/X11/XWindowAttributesData
+sun/awt/X11/WindowDimensions
+java/awt/Point
+java/awt/geom/Point2D
+java/util/TreeMap$Entry
+sun/awt/X11/XSizeHints
+sun/awt/X11/XRootWindow
+sun/awt/X11/XRootWindow$LazyHolder
+sun/nio/cs/ISO_8859_1$Encoder
+sun/nio/cs/Surrogate$Parser
+sun/nio/cs/Surrogate
+sun/java2d/x11/X11SurfaceData$X11WindowSurfaceData
+sun/awt/X11/XDropTargetEventProcessor
+sun/java2d/loops/RenderLoops
+sun/awt/X11/XDragSourceContextPeer
+sun/java2d/loops/GraphicsPrimitiveMgr$PrimitiveSpec
+sun/awt/X11/XDragSourceProtocolListener
+java/util/Arrays$LegacyMergeSort
+sun/awt/dnd/SunDragSourceContextPeer
+java/awt/dnd/peer/DragSourceContextPeer
+java/util/TimSort
+sun/awt/X11/XAnyEvent
+sun/awt/X11/XAwtState
+sun/awt/X11/XBaseWindow$1
+sun/awt/X11/XPropertyEvent
+sun/java2d/DefaultDisposerRecord
+sun/java2d/SurfaceDataProxy
+sun/awt/image/SurfaceManager$FlushableCacheData
+sun/java2d/SurfaceDataProxy$1
+sun/java2d/StateTracker
+sun/java2d/StateTracker$1
+sun/java2d/StateTracker$2
+sun/java2d/x11/X11Renderer
+sun/awt/X11/XGlobalCursorManager
+sun/awt/GlobalCursorManager
+sun/awt/IconInfo
+sun/awt/AWTIcon32_java_icon16_png
+sun/awt/AWTIcon32_java_icon24_png
+sun/awt/AWTIcon32_java_icon32_png
+sun/awt/AWTIcon32_java_icon48_png
+sun/awt/X11/XClientMessageEvent
+sun/awt/X11/XContentWindow
+sun/awt/X11/XFocusProxyWindow
+sun/awt/X11/XWMHints
+java/util/LinkedList$ListItr
+sun/awt/AWTAutoShutdown
+java/awt/peer/LightweightPeer
+sun/awt/NullComponentPeer
+java/awt/SplashScreen
+java/awt/Dialog
+java/awt/Dialog$ModalityType
+sun/awt/X11/PropMwmHints
+sun/awt/X11/XWindowPeer$4
+sun/awt/GlobalCursorManager$NativeUpdater
+java/awt/event/WindowEvent
+java/awt/EventQueue$5
+java/awt/EventDispatchThread
+sun/awt/PeerEvent
+java/awt/EventDispatchThread$1
+java/awt/Conditional
+java/awt/event/InvocationEvent
+java/awt/ActiveEvent
+java/awt/EventDispatchThread$HierarchyEventFilter
+java/awt/EventFilter
+java/awt/event/PaintEvent
+sun/awt/X11/XReparentEvent
+java/awt/event/MouseEvent
+java/awt/ModalEventFilter
+sun/awt/EventQueueItem
+sun/awt/EventQueueDelegate
+java/awt/EventFilter$FilterAction
+java/awt/EventQueue$3
+java/awt/EventQueue$4
+sun/awt/dnd/SunDropTargetEvent
+sun/awt/X11/XConfigureEvent
+java/awt/event/InputMethodEvent
+java/awt/event/ActionEvent
+java/awt/event/FocusEvent
+java/util/Vector$Itr
+java/awt/event/InvocationEvent$1
+sun/awt/X11/XWindowPeer$2
+sun/awt/AWTAccessor$InvocationEventAccessor
+java/applet/Applet
+java/awt/Panel
+sun/awt/X11/XVisibilityEvent
+sun/awt/X11/XExposeEvent
+sun/awt/event/IgnorePaintEvent
+sun/awt/X11/XTranslateCoordinates
+sun/awt/X11/XFocusChangeEvent
+java/awt/SequencedEvent
+java/awt/SequencedEvent$1
+sun/awt/AWTAccessor$SequencedEventAccessor
+sun/awt/X11/XComponentPeer$1
+java/awt/MenuComponent
+java/awt/TrayIcon
+java/util/IdentityHashMap$KeySet
+java/util/IdentityHashMap$KeyIterator
+javax/swing/RepaintManager$4
+java/awt/GraphicsCallback$PaintCallback
+java/awt/GraphicsCallback
+sun/awt/SunGraphicsCallback
+javax/swing/BufferStrategyPaintManager$BufferInfo
+java/awt/event/WindowListener
+java/awt/event/ComponentAdapter
+java/awt/event/ComponentListener
+java/awt/AWTEventMulticaster
+java/awt/event/ContainerListener
+java/awt/event/FocusListener
+java/awt/event/KeyListener
+java/awt/event/MouseListener
+java/awt/event/MouseMotionListener
+java/awt/event/WindowFocusListener
+java/awt/event/WindowStateListener
+java/awt/event/ActionListener
+java/awt/event/ItemListener
+java/awt/event/AdjustmentListener
+java/awt/event/TextListener
+java/awt/event/InputMethodListener
+java/awt/event/HierarchyListener
+java/awt/event/HierarchyBoundsListener
+java/awt/event/MouseWheelListener
+java/awt/BufferCapabilities
+java/awt/Component$BltSubRegionBufferStrategy
+sun/awt/SubRegionShowable
+java/awt/Component$BltBufferStrategy
+java/awt/image/BufferStrategy
+java/awt/image/VolatileImage
+java/awt/Image
+sun/awt/image/SunVolatileImage
+java/awt/Image$1
+sun/awt/image/SurfaceManager$ImageAccessor
+sun/awt/image/SurfaceManager
+sun/awt/image/BufferedImageGraphicsConfig
+sun/print/PrinterGraphicsConfig
+sun/java2d/opengl/GLXGraphicsConfig
+sun/java2d/opengl/OGLGraphicsConfig
+sun/java2d/pipe/hw/AccelGraphicsConfig
+sun/java2d/pipe/hw/BufferedContextProvider
+sun/java2d/xr/XRGraphicsConfig
+sun/java2d/x11/X11VolatileSurfaceManager
+sun/awt/image/VolatileSurfaceManager
+sun/java2d/x11/X11SurfaceData$X11PixmapSurfaceData
+sun/font/FontDesignMetrics
+java/awt/FontMetrics
+sun/font/SunFontManager
+sun/java2d/FontSupport
+sun/font/FontManagerForSGE
+sun/font/FontManager
+sun/font/SunFontManager$TTFilter
+java/io/FilenameFilter
+sun/font/SunFontManager$T1Filter
+sun/font/SunFontManager$1
+sun/font/FontManagerNativeLibrary
+sun/font/FontManagerNativeLibrary$1
+sun/font/FontUtilities
+sun/font/FontUtilities$1
+sun/font/TrueTypeFont
+sun/font/FileFont
+sun/font/PhysicalFont
+sun/font/Font2D
+sun/font/Type1Font
+java/awt/geom/Point2D$Float
+sun/font/StrikeMetrics
+java/awt/geom/Rectangle2D$Float
+java/awt/geom/GeneralPath
+sun/font/CharToGlyphMapper
+sun/font/PhysicalStrike
+sun/font/FontStrike
+sun/font/StrikeCache
+sun/font/StrikeCache$1
+sun/font/GlyphList
+sun/font/FontManagerFactory
+sun/font/FontManagerFactory$1
+sun/awt/X11FontManager
+sun/font/CompositeFont
+sun/font/SunFontManager$2
+java/io/StreamTokenizer
+sun/font/SunFontManager$FontRegistrationInfo
+sun/awt/motif/MFontConfiguration
+sun/awt/FontConfiguration
+sun/awt/FontDescriptor
+java/util/Properties$LineReader
+sun/font/FcFontConfiguration
+java/net/InetAddress
+java/net/InetAddress$1
+java/net/InetAddress$InetAddressHolder
+java/net/InetAddress$Cache
+java/net/InetAddress$Cache$Type
+java/net/InetAddressImplFactory
+java/net/Inet4AddressImpl
+java/net/InetAddressImpl
+java/net/InetAddress$2
+sun/net/spi/nameservice/NameService
+java/net/Inet4Address
+java/net/Inet6Address
+java/net/Inet6Address$Inet6AddressHolder
+sun/net/InetAddressCachePolicy
+sun/net/InetAddressCachePolicy$1
+java/security/Security
+java/security/Security$1
+sun/net/InetAddressCachePolicy$2
+java/util/LinkedHashMap$LinkedKeySet
+java/util/LinkedHashMap$LinkedKeyIterator
+java/net/InetAddress$CacheEntry
+sun/font/FontConfigManager$FcCompFont
+sun/font/FontConfigManager$FontConfigFont
+sun/font/CompositeFontDescriptor
+sun/font/Font2DHandle
+sun/font/FontFamily
+sun/font/SunFontManager$3
+sun/font/FontDesignMetrics$MetricsKey
+sun/font/FontStrikeDesc
+sun/font/CompositeStrike
+sun/font/FontStrikeDisposer
+sun/java2d/Disposer$PollDisposable
+sun/font/StrikeCache$SoftDisposerRef
+sun/font/StrikeCache$DisposableStrike
+sun/font/TrueTypeFont$TTDisposerRecord
+sun/font/TrueTypeFont$1
+java/io/RandomAccessFile
+java/io/DataOutput
+java/io/DataInput
+sun/nio/ch/FileChannelImpl
+java/nio/channels/FileChannel
+java/nio/channels/SeekableByteChannel
+java/nio/channels/ByteChannel
+java/nio/channels/ReadableByteChannel
+java/nio/channels/Channel
+java/nio/channels/WritableByteChannel
+java/nio/channels/GatheringByteChannel
+java/nio/channels/ScatteringByteChannel
+java/nio/channels/spi/AbstractInterruptibleChannel
+java/nio/channels/InterruptibleChannel
+java/nio/file/attribute/FileAttribute
+sun/nio/ch/IOUtil
+sun/nio/ch/IOUtil$1
+sun/nio/ch/NativeThreadSet
+sun/nio/ch/FileDispatcherImpl
+sun/nio/ch/FileDispatcher
+sun/nio/ch/NativeDispatcher
+java/nio/channels/spi/AbstractInterruptibleChannel$1
+sun/nio/ch/NativeThread
+sun/nio/ch/IOStatus
+sun/nio/ch/Util
+sun/nio/ch/Util$1
+sun/nio/ch/Util$BufferCache
+java/nio/DirectByteBuffer$Deallocator
+java/nio/ByteBufferAsIntBufferB
+java/nio/IntBuffer
+sun/font/TrueTypeFont$DirectoryEntry
+java/nio/ByteBufferAsShortBufferB
+java/nio/ShortBuffer
+sun/nio/cs/UTF_16$Decoder
+sun/nio/cs/UnicodeDecoder
+sun/font/FileFontStrike
+sun/font/FontScaler
+sun/font/T2KFontScaler
+sun/font/T2KFontScaler$1
+sun/font/TrueTypeGlyphMapper
+sun/font/CMap
+sun/font/CMap$NullCMapClass
+sun/font/CMap$CMapFormat12
+sun/font/FontDesignMetrics$KeyReference
+sun/font/CompositeGlyphMapper
+java/awt/print/PrinterGraphics
+java/awt/PrintGraphics
+sun/java2d/loops/FontInfo
+sun/awt/X11/XSystemTrayPeer
+java/awt/peer/SystemTrayPeer
+java/util/jar/Attributes
+java/util/jar/Manifest$FastInputStream
+java/util/jar/Attributes$Name
+sun/misc/ASCIICaseInsensitiveComparator
+java/util/jar/JarVerifier
+java/security/CodeSigner
+java/util/jar/JarVerifier$3
+java/io/ByteArrayOutputStream
+java/lang/Package
+sun/security/util/SignatureFileVerifier
+sun/security/util/ManifestEntryVerifier
+java/util/MissingResourceException
+javax/swing/JDialog
+javax/swing/text/JTextComponent
+javax/swing/Scrollable
+javax/swing/JTextArea
+javax/swing/JScrollPane
+javax/swing/ScrollPaneConstants
+javax/swing/AbstractButton
+java/awt/ItemSelectable
+javax/swing/JButton
+java/io/StringWriter
+java/lang/SecurityException
+javax/swing/JWindow
+java/io/UnsupportedEncodingException
+sun/misc/URLClassPath$FileLoader
+java/lang/CloneNotSupportedException
+java/lang/InternalError
+java/net/UnknownHostException
+java/net/Socket
+java/net/SocketAddress
+java/nio/channels/SocketChannel
+java/nio/channels/NetworkChannel
+java/nio/channels/spi/AbstractSelectableChannel
+java/nio/channels/SelectableChannel
+java/net/SocketException
+java/net/SocketImplFactory
+java/net/InetSocketAddress
+java/net/InetSocketAddress$InetSocketAddressHolder
+java/net/Proxy
+java/net/SocketImpl
+java/net/SocketOptions
+java/net/SocksSocketImpl
+java/net/SocksConsts
+java/net/PlainSocketImpl
+java/net/AbstractPlainSocketImpl
+java/net/AbstractPlainSocketImpl$1
+sun/net/util/IPAddressUtil
+java/net/SocksSocketImpl$3
+java/net/ProxySelector
+sun/net/spi/DefaultProxySelector
+sun/net/spi/DefaultProxySelector$1
+sun/net/NetProperties
+sun/net/NetProperties$1
+java/net/URI
+java/net/URI$Parser
+sun/net/spi/DefaultProxySelector$NonProxyInfo
+sun/net/spi/DefaultProxySelector$3
+java/net/Proxy$Type
+sun/net/NetHooks
+sun/net/sdp/SdpProvider
+sun/net/NetHooks$Provider
+java/net/ConnectException
+java/net/MalformedURLException
+java/lang/UnsatisfiedLinkError
+javax/swing/UnsupportedLookAndFeelException
+sun/misc/FloatingDecimal$ASCIIToBinaryBuffer
+sun/misc/FDBigInteger
+java/util/ResourceBundle$Control$1
+java/net/URLClassLoader$2
+java/util/PropertyResourceBundle
+java/util/ResourceBundle$BundleReference
+java/util/logging/Level
+java/util/logging/Level$KnownLevel
+java/util/logging/Logger
+java/util/logging/Handler
+java/util/logging/Logger$LoggerBundle
+java/util/concurrent/CopyOnWriteArrayList
+java/util/logging/LogManager
+java/util/logging/LogManager$1
+java/util/logging/LogManager$SystemLoggerContext
+java/util/logging/LogManager$LoggerContext
+java/util/logging/LogManager$LogNode
+java/util/logging/LoggingPermission
+java/util/logging/LogManager$Cleaner
+java/util/logging/LogManager$2
+java/util/logging/LogManager$3
+java/util/logging/LogManager$LoggerWeakRef
+java/util/logging/LogManager$LoggerContext$1
+java/util/logging/LogManager$RootLogger
+java/util/logging/LogManager$5
+java/util/logging/Logger$1
+sun/util/logging/resources/logging
+javax/swing/Box
+javax/swing/Box$Filler
+javax/swing/Icon
+javax/swing/BoxLayout
+javax/swing/plaf/basic/BasicPopupMenuUI
+javax/swing/plaf/PopupMenuUI
+javax/swing/ImageIcon
+javax/swing/ImageIcon$1
+javax/swing/ImageIcon$2
+javax/swing/ImageIcon$2$1
+java/awt/dnd/DropTarget
+java/awt/dnd/DropTargetListener
+javax/accessibility/AccessibleContext
+sun/reflect/UnsafeObjectFieldAccessorImpl
+java/awt/MediaTracker
+sun/misc/SoftCache$ValueCell
+sun/awt/image/URLImageSource
+sun/awt/image/InputStreamImageSource
+java/awt/image/ImageProducer
+sun/awt/image/ImageFetchable
+sun/awt/image/ToolkitImage
+sun/awt/image/NativeLibLoader
+sun/awt/image/NativeLibLoader$1
+javax/swing/ImageIcon$3
+java/awt/ImageMediaEntry
+java/awt/MediaEntry
+sun/awt/image/MultiResolutionToolkitImage
+sun/awt/image/MultiResolutionImage
+sun/awt/image/ImageRepresentation
+java/awt/image/ImageConsumer
+sun/awt/image/ImageWatched
+sun/awt/image/ImageWatched$Link
+sun/awt/image/ImageWatched$WeakLink
+sun/awt/image/ImageConsumerQueue
+sun/awt/image/ImageFetcher
+sun/awt/image/FetcherInfo
+sun/awt/image/ImageFetcher$1
+sun/net/ProgressMonitor
+sun/net/DefaultProgressMeteringPolicy
+sun/net/ProgressMeteringPolicy
+sun/net/www/MimeTable
+java/net/FileNameMap
+sun/net/www/MimeTable$1
+sun/net/www/MimeTable$DefaultInstanceHolder
+sun/net/www/MimeTable$DefaultInstanceHolder$1
+sun/net/www/MimeEntry
+java/net/URLConnection$1
+java/text/SimpleDateFormat
+java/text/DateFormat
+java/text/Format
+java/text/DateFormat$Field
+java/text/Format$Field
+java/util/TimeZone
+sun/util/calendar/ZoneInfo
+sun/util/calendar/ZoneInfoFile
+sun/util/calendar/ZoneInfoFile$1
+java/io/DataInputStream
+sun/util/calendar/ZoneInfoFile$ZoneOffsetTransitionRule
+sun/util/calendar/ZoneInfoFile$Checksum
+java/util/zip/CRC32
+java/util/zip/Checksum
+java/util/TimeZone$1
+java/util/Calendar
+sun/util/spi/CalendarProvider
+java/util/spi/LocaleServiceProvider
+sun/util/locale/provider/LocaleProviderAdapter
+sun/util/locale/provider/JRELocaleProviderAdapter
+sun/util/locale/provider/ResourceBundleBasedAdapter
+sun/util/locale/provider/SPILocaleProviderAdapter
+sun/util/locale/provider/AuxLocaleProviderAdapter
+sun/util/locale/provider/AuxLocaleProviderAdapter$NullProvider
+sun/util/locale/provider/LocaleProviderAdapter$Type
+sun/util/locale/provider/LocaleProviderAdapter$1
+sun/util/locale/provider/CalendarProviderImpl
+sun/util/locale/provider/AvailableLanguageTags
+sun/util/locale/provider/LocaleDataMetaInfo
+sun/util/locale/provider/JRELocaleProviderAdapter$1
+java/util/Calendar$Builder
+java/util/GregorianCalendar
+sun/util/locale/provider/CalendarDataUtility
+java/util/spi/CalendarDataProvider
+sun/util/locale/provider/LocaleServiceProviderPool
+java/text/spi/BreakIteratorProvider
+java/text/spi/CollatorProvider
+java/text/spi/DateFormatProvider
+java/text/spi/DateFormatSymbolsProvider
+java/text/spi/DecimalFormatSymbolsProvider
+java/text/spi/NumberFormatProvider
+java/util/spi/CurrencyNameProvider
+java/util/spi/LocaleNameProvider
+java/util/spi/TimeZoneNameProvider
+sun/util/locale/provider/CalendarDataProviderImpl
+sun/util/locale/provider/SPILocaleProviderAdapter$1
+sun/util/locale/provider/CalendarDataUtility$CalendarWeekParameterGetter
+sun/util/locale/provider/LocaleServiceProviderPool$LocalizedObjectGetter
+sun/util/locale/provider/LocaleResources
+sun/util/resources/LocaleData
+sun/util/resources/LocaleData$1
+sun/util/resources/LocaleData$LocaleDataResourceBundleControl
+sun/util/locale/LanguageTag
+java/util/Collections$EmptyIterator
+sun/util/resources/CalendarData
+sun/util/resources/LocaleNamesBundle
+sun/util/resources/OpenListResourceBundle
+sun/util/resources/en/CalendarData_en
+sun/util/locale/provider/LocaleResources$ResourceReference
+sun/util/calendar/Gregorian$Date
+sun/util/calendar/BaseCalendar$Date
+sun/util/calendar/CalendarDate
+sun/util/calendar/CalendarUtils
+java/text/DateFormatSymbols
+sun/util/locale/provider/DateFormatSymbolsProviderImpl
+sun/text/resources/FormatData
+sun/util/resources/ParallelListResourceBundle
+java/util/concurrent/atomic/AtomicMarkableReference
+java/util/concurrent/atomic/AtomicMarkableReference$Pair
+sun/text/resources/en/FormatData_en
+sun/text/resources/en/FormatData_en_US
+sun/util/resources/ParallelListResourceBundle$KeySet
+java/text/NumberFormat
+sun/util/locale/provider/NumberFormatProviderImpl
+java/text/DecimalFormatSymbols
+sun/util/locale/provider/DecimalFormatSymbolsProviderImpl
+java/util/Currency
+java/util/Currency$1
+sun/util/locale/provider/CurrencyNameProviderImpl
+java/util/Currency$CurrencyNameGetter
+sun/util/resources/CurrencyNames
+sun/util/resources/en/CurrencyNames_en_US
+java/text/DecimalFormat
+java/text/FieldPosition
+java/text/DigitList
+java/math/RoundingMode
+java/text/DontCareFieldPosition
+java/text/DontCareFieldPosition$1
+java/text/Format$FieldDelegate
+sun/awt/image/GifImageDecoder
+sun/awt/image/ImageDecoder
+sun/awt/image/GifFrame
+java/awt/image/Raster
+java/awt/image/DataBufferByte
+java/awt/image/DataBuffer
+java/awt/image/DataBuffer$1
+sun/awt/image/SunWritableRaster$DataStealer
+sun/awt/image/SunWritableRaster
+java/awt/image/WritableRaster
+java/awt/image/PixelInterleavedSampleModel
+java/awt/image/ComponentSampleModel
+java/awt/image/SampleModel
+sun/awt/image/ByteInterleavedRaster
+sun/awt/image/ByteComponentRaster
+java/awt/image/BufferedImage
+java/awt/image/WritableRenderedImage
+java/awt/image/RenderedImage
+java/awt/image/BufferedImage$1
+sun/awt/image/IntegerComponentRaster
+sun/awt/image/BytePackedRaster
+javax/swing/plaf/BorderUIResource
+javax/swing/BorderFactory
+javax/swing/border/BevelBorder
+javax/swing/border/EtchedBorder
+javax/swing/plaf/metal/MetalIconFactory
+javax/swing/plaf/metal/MetalIconFactory$TreeFolderIcon
+javax/swing/plaf/metal/MetalIconFactory$FolderIcon16
+java/util/zip/ZipInputStream
+java/io/PushbackInputStream
+java/util/zip/ZipUtils
+java/io/RandomAccessFile$1
+java/lang/Thread$State
+javax/swing/SwingUtilities$SharedOwnerFrame
+sun/awt/X11/XWindowAttributes
+javax/swing/border/LineBorder
+javax/swing/SizeRequirements
+java/util/ArrayList$ListItr
+javax/swing/CellRendererPane
+javax/swing/RepaintManager$3
+javax/swing/JRadioButton
+javax/swing/JToggleButton
+java/lang/ClassFormatError
+java/io/ObjectInputStream
+java/io/ObjectInput
+java/io/ObjectStreamConstants
+sun/awt/image/BufImgSurfaceManager
+sun/awt/image/BufImgSurfaceData
+sun/awt/image/BufImgSurfaceData$ICMColorData
+sun/java2d/x11/X11SurfaceDataProxy
+sun/java2d/x11/X11SurfaceDataProxy$Bitmask
+sun/java2d/StateTrackableDelegate$1
+javax/swing/JTabbedPane
+java/awt/geom/RectIterator
+java/awt/geom/PathIterator
+javax/swing/event/ChangeListener
+java/awt/Polygon
+javax/swing/event/MenuListener
+javax/swing/DefaultSingleSelectionModel
+javax/swing/SingleSelectionModel
+javax/swing/JTabbedPane$ModelListener
+javax/swing/plaf/metal/MetalTabbedPaneUI
+javax/swing/plaf/basic/BasicTabbedPaneUI
+javax/swing/plaf/TabbedPaneUI
+javax/swing/plaf/metal/MetalTabbedPaneUI$TabbedPaneLayout
+javax/swing/plaf/basic/BasicTabbedPaneUI$TabbedPaneLayout
+javax/swing/plaf/basic/BasicTabbedPaneUI$TabbedPaneScrollLayout
+javax/swing/plaf/basic/BasicTabbedPaneUI$Handler
+sun/reflect/MethodAccessorGenerator
+sun/reflect/AccessorGenerator
+sun/reflect/ClassFileConstants
+sun/reflect/ByteVectorFactory
+sun/reflect/ByteVectorImpl
+sun/reflect/ByteVector
+sun/reflect/ClassFileAssembler
+sun/reflect/UTF8
+sun/reflect/Label
+sun/reflect/Label$PatchInfo
+sun/reflect/MethodAccessorGenerator$1
+sun/reflect/ClassDefiner
+sun/reflect/ClassDefiner$1
+sun/reflect/BootstrapConstructorAccessorImpl
+javax/swing/JTextField
+javax/swing/JViewport
+java/awt/CardLayout
+javax/swing/text/Document
+javax/swing/text/JTextComponent$1
+sun/swing/SwingAccessor$JTextComponentAccessor
+javax/swing/text/JTextComponent$4
+com/sun/beans/util/Cache
+com/sun/beans/util/Cache$Kind
+com/sun/beans/util/Cache$Kind$1
+com/sun/beans/util/Cache$Kind$2
+com/sun/beans/util/Cache$Kind$3
+com/sun/beans/util/Cache$CacheEntry
+javax/swing/Action
+javax/swing/JTextField$NotifyAction
+javax/swing/text/TextAction
+javax/swing/AbstractAction
+java/lang/ArrayIndexOutOfBoundsException
+javax/swing/DropMode
+javax/swing/text/JTextComponent$MutableCaretEvent
+javax/swing/event/CaretEvent
+javax/swing/plaf/metal/MetalTextFieldUI
+javax/swing/plaf/basic/BasicTextFieldUI
+javax/swing/plaf/basic/BasicTextUI
+javax/swing/text/ViewFactory
+javax/swing/plaf/TextUI
+javax/swing/plaf/basic/BasicTextUI$BasicCursor
+javax/swing/text/DefaultEditorKit
+javax/swing/text/EditorKit
+javax/swing/text/DefaultEditorKit$InsertContentAction
+javax/swing/text/DefaultEditorKit$DeletePrevCharAction
+javax/swing/text/DefaultEditorKit$DeleteNextCharAction
+javax/swing/text/DefaultEditorKit$ReadOnlyAction
+javax/swing/text/DefaultEditorKit$DeleteWordAction
+javax/swing/text/DefaultEditorKit$WritableAction
+javax/swing/text/DefaultEditorKit$CutAction
+javax/swing/text/DefaultEditorKit$CopyAction
+javax/swing/text/DefaultEditorKit$PasteAction
+javax/swing/text/DefaultEditorKit$VerticalPageAction
+javax/swing/text/DefaultEditorKit$PageAction
+javax/swing/text/DefaultEditorKit$InsertBreakAction
+javax/swing/text/DefaultEditorKit$BeepAction
+javax/swing/text/DefaultEditorKit$NextVisualPositionAction
+javax/swing/text/DefaultEditorKit$BeginWordAction
+javax/swing/text/DefaultEditorKit$EndWordAction
+javax/swing/text/DefaultEditorKit$PreviousWordAction
+javax/swing/text/DefaultEditorKit$NextWordAction
+javax/swing/text/DefaultEditorKit$BeginLineAction
+javax/swing/text/DefaultEditorKit$EndLineAction
+javax/swing/text/DefaultEditorKit$BeginParagraphAction
+javax/swing/text/DefaultEditorKit$EndParagraphAction
+javax/swing/text/DefaultEditorKit$BeginAction
+javax/swing/text/DefaultEditorKit$EndAction
+javax/swing/text/DefaultEditorKit$DefaultKeyTypedAction
+javax/swing/text/DefaultEditorKit$InsertTabAction
+javax/swing/text/DefaultEditorKit$SelectWordAction
+javax/swing/text/DefaultEditorKit$SelectLineAction
+javax/swing/text/DefaultEditorKit$SelectParagraphAction
+javax/swing/text/DefaultEditorKit$SelectAllAction
+javax/swing/text/DefaultEditorKit$UnselectAction
+javax/swing/text/DefaultEditorKit$ToggleComponentOrientationAction
+javax/swing/text/DefaultEditorKit$DumpModelAction
+javax/swing/plaf/basic/BasicTextUI$TextTransferHandler
+javax/swing/TransferHandler
+javax/swing/TransferHandler$TransferAction
+sun/swing/UIAction
+javax/swing/text/Position$Bias
+javax/swing/plaf/basic/BasicTextUI$RootView
+javax/swing/text/View
+javax/swing/plaf/basic/BasicTextUI$UpdateHandler
+javax/swing/event/DocumentListener
+javax/swing/plaf/basic/BasicTextUI$DragListener
+javax/swing/plaf/basic/DragRecognitionSupport$BeforeDrag
+javax/swing/event/MouseInputAdapter
+javax/swing/event/MouseInputListener
+java/awt/event/MouseAdapter
+javax/swing/plaf/metal/MetalBorders
+javax/swing/plaf/BorderUIResource$CompoundBorderUIResource
+javax/swing/border/CompoundBorder
+javax/swing/plaf/metal/MetalBorders$TextFieldBorder
+javax/swing/plaf/metal/MetalBorders$Flush3DBorder
+javax/swing/plaf/basic/BasicBorders$MarginBorder
+javax/swing/plaf/basic/BasicTextUI$BasicCaret
+javax/swing/text/DefaultCaret
+javax/swing/text/Caret
+javax/swing/text/DefaultCaret$Handler
+java/awt/datatransfer/ClipboardOwner
+javax/swing/Timer
+javax/swing/Timer$DoPostEvent
+javax/swing/plaf/basic/BasicTextUI$BasicHighlighter
+javax/swing/text/DefaultHighlighter
+javax/swing/text/LayeredHighlighter
+javax/swing/text/Highlighter
+javax/swing/text/Highlighter$Highlight
+javax/swing/text/DefaultHighlighter$DefaultHighlightPainter
+javax/swing/text/LayeredHighlighter$LayerPainter
+javax/swing/text/Highlighter$HighlightPainter
+javax/swing/text/DefaultHighlighter$SafeDamager
+javax/swing/ClientPropertyKey
+javax/swing/ClientPropertyKey$1
+sun/awt/AWTAccessor$ClientPropertyKeyAccessor
+javax/swing/TransferHandler$SwingDropTarget
+java/awt/dnd/DropTargetContext
+java/awt/datatransfer/SystemFlavorMap
+java/awt/datatransfer/FlavorMap
+java/awt/datatransfer/FlavorTable
+java/awt/datatransfer/SystemFlavorMap$SoftCache
+javax/swing/TransferHandler$DropHandler
+javax/swing/TransferHandler$TransferSupport
+javax/swing/text/PlainDocument
+javax/swing/text/AbstractDocument
+javax/swing/text/GapContent
+javax/swing/text/AbstractDocument$Content
+javax/swing/text/GapVector
+javax/swing/text/GapContent$MarkVector
+javax/swing/text/GapContent$MarkData
+javax/swing/text/StyleContext
+javax/swing/text/AbstractDocument$AttributeContext
+javax/swing/text/StyleConstants
+javax/swing/text/StyleConstants$CharacterConstants
+javax/swing/text/AttributeSet$CharacterAttribute
+javax/swing/text/StyleConstants$FontConstants
+javax/swing/text/AttributeSet$FontAttribute
+javax/swing/text/StyleConstants$ColorConstants
+javax/swing/text/AttributeSet$ColorAttribute
+javax/swing/text/StyleConstants$ParagraphConstants
+javax/swing/text/AttributeSet$ParagraphAttribute
+javax/swing/text/StyleContext$FontKey
+javax/swing/text/SimpleAttributeSet
+javax/swing/text/MutableAttributeSet
+javax/swing/text/AttributeSet
+javax/swing/text/SimpleAttributeSet$EmptyAttributeSet
+javax/swing/text/StyleContext$NamedStyle
+javax/swing/text/Style
+java/util/Collections$EmptyEnumeration
+javax/swing/text/StyleContext$SmallAttributeSet
+java/util/Collections$3
+javax/swing/text/AbstractDocument$BidiRootElement
+javax/swing/text/AbstractDocument$BranchElement
+javax/swing/text/AbstractDocument$AbstractElement
+javax/swing/text/Element
+javax/swing/tree/TreeNode
+javax/swing/text/AbstractDocument$1
+javax/swing/text/AbstractDocument$BidiElement
+javax/swing/text/AbstractDocument$LeafElement
+javax/swing/text/GapContent$StickyPosition
+javax/swing/text/Position
+javax/swing/text/StyleContext$KeyEnumeration
+javax/swing/text/FieldView
+javax/swing/text/PlainView
+javax/swing/text/TabExpander
+javax/swing/text/JTextComponent$DefaultKeymap
+javax/swing/text/Keymap
+javax/swing/text/JTextComponent$KeymapWrapper
+javax/swing/text/JTextComponent$KeymapActionMap
+javax/swing/plaf/basic/BasicTextUI$FocusAction
+javax/swing/plaf/basic/BasicTextUI$TextActionWrapper
+javax/swing/plaf/synth/SynthUI
+javax/swing/plaf/synth/SynthConstants
+javax/swing/JEditorPane
+javax/swing/DefaultBoundedRangeModel
+javax/swing/BoundedRangeModel
+javax/swing/JTextField$ScrollRepainter
+javax/swing/DefaultButtonModel
+javax/swing/ButtonModel
+javax/swing/AbstractButton$Handler
+javax/swing/plaf/basic/BasicButtonUI
+javax/swing/plaf/ButtonUI
+javax/swing/plaf/metal/MetalBorders$ButtonBorder
+javax/swing/plaf/basic/BasicButtonListener
+javax/swing/event/AncestorListener
+java/beans/VetoableChangeListener
+javax/swing/plaf/metal/MetalComboBoxButton
+javax/swing/plaf/basic/BasicArrowButton
+javax/swing/plaf/metal/MetalScrollButton
+sun/swing/ImageIconUIResource
+javax/swing/GrayFilter
+java/awt/image/RGBImageFilter
+java/awt/image/ImageFilter
+java/awt/image/FilteredImageSource
+javax/swing/plaf/basic/BasicGraphicsUtils
+javax/swing/ButtonGroup
+org/w3c/dom/Node
+org/xml/sax/SAXException
+javax/xml/parsers/ParserConfigurationException
+org/xml/sax/EntityResolver
+java/security/NoSuchAlgorithmException
+java/security/GeneralSecurityException
+java/util/zip/GZIPInputStream
+java/util/zip/DeflaterOutputStream
+java/io/StringReader
+org/xml/sax/InputSource
+javax/xml/parsers/DocumentBuilderFactory
+javax/xml/parsers/FactoryFinder
+javax/xml/parsers/SecuritySupport
+javax/xml/parsers/SecuritySupport$2
+javax/xml/parsers/SecuritySupport$5
+javax/xml/parsers/FactoryFinder$1
+javax/xml/parsers/DocumentBuilder
+org/xml/sax/ErrorHandler
+org/w3c/dom/Document
+org/xml/sax/helpers/DefaultHandler
+org/xml/sax/DTDHandler
+org/xml/sax/ContentHandler
+org/xml/sax/SAXNotRecognizedException
+org/xml/sax/SAXNotSupportedException
+org/xml/sax/Locator
+org/xml/sax/SAXParseException
+org/w3c/dom/NodeList
+org/w3c/dom/events/EventTarget
+org/w3c/dom/traversal/DocumentTraversal
+org/w3c/dom/events/DocumentEvent
+org/w3c/dom/ranges/DocumentRange
+org/w3c/dom/Element
+org/w3c/dom/CharacterData
+org/w3c/dom/CDATASection
+org/w3c/dom/Text
+org/w3c/dom/Entity
+org/xml/sax/AttributeList
+org/w3c/dom/DOMException
+org/w3c/dom/DocumentType
+org/w3c/dom/Attr
+org/w3c/dom/EntityReference
+org/w3c/dom/DocumentFragment
+org/w3c/dom/ProcessingInstruction
+org/w3c/dom/Notation
+org/w3c/dom/Comment
+org/w3c/dom/events/EventException
+org/w3c/dom/events/Event
+org/w3c/dom/events/MutationEvent
+org/w3c/dom/traversal/TreeWalker
+org/w3c/dom/ranges/Range
+org/w3c/dom/traversal/NodeIterator
+org/w3c/dom/NamedNodeMap
+java/awt/GridLayout
+javax/swing/JToggleButton$ToggleButtonModel
+javax/swing/plaf/metal/MetalRadioButtonUI
+javax/swing/plaf/basic/BasicRadioButtonUI
+javax/swing/plaf/basic/BasicToggleButtonUI
+javax/swing/plaf/basic/BasicBorders
+javax/swing/plaf/basic/BasicBorders$RadioButtonBorder
+javax/swing/plaf/basic/BasicBorders$ButtonBorder
+javax/swing/plaf/metal/MetalIconFactory$RadioButtonIcon
+javax/swing/plaf/basic/BasicRadioButtonUI$KeyHandler
+javax/swing/plaf/basic/BasicRadioButtonUI$SelectPreviousBtn
+javax/swing/plaf/basic/BasicRadioButtonUI$SelectNextBtn
+javax/swing/event/ChangeEvent
+java/awt/event/ItemEvent
+javax/swing/ToolTipManager
+javax/swing/ToolTipManager$insideTimerAction
+javax/swing/ToolTipManager$outsideTimerAction
+javax/swing/ToolTipManager$stillInsideTimerAction
+javax/swing/ToolTipManager$MoveBeforeEnterListener
+java/awt/event/MouseMotionAdapter
+javax/swing/ToolTipManager$AccessibilityKeyListener
+java/awt/event/KeyAdapter
+java/awt/CardLayout$Card
+javax/swing/JComboBox
+javax/swing/event/ListDataListener
+javax/swing/JCheckBox
+javax/swing/JPopupMenu
+javax/swing/MenuElement
+javax/swing/DefaultComboBoxModel
+javax/swing/MutableComboBoxModel
+javax/swing/ComboBoxModel
+javax/swing/ListModel
+javax/swing/AbstractListModel
+javax/swing/JComboBox$1
+javax/swing/AncestorNotifier
+javax/swing/plaf/metal/MetalComboBoxUI
+javax/swing/plaf/basic/BasicComboBoxUI
+javax/swing/plaf/ComboBoxUI
+javax/swing/plaf/metal/MetalComboBoxUI$MetalComboBoxLayoutManager
+javax/swing/plaf/basic/BasicComboBoxUI$ComboBoxLayoutManager
+javax/swing/plaf/basic/BasicComboPopup
+javax/swing/plaf/basic/ComboPopup
+javax/swing/plaf/basic/BasicComboPopup$EmptyListModelClass
+javax/swing/plaf/basic/BasicLookAndFeel$AWTEventHelper
+java/awt/event/AWTEventListenerProxy
+java/awt/Toolkit$SelectiveAWTEventListener
+java/awt/Toolkit$ToolkitEventMulticaster
+javax/swing/plaf/basic/BasicLookAndFeel$1
+javax/swing/plaf/basic/DefaultMenuLayout
+javax/swing/plaf/metal/MetalBorders$PopupMenuBorder
+javax/swing/plaf/basic/BasicPopupMenuUI$BasicPopupMenuListener
+javax/swing/event/PopupMenuListener
+javax/swing/plaf/basic/BasicPopupMenuUI$BasicMenuKeyListener
+javax/swing/event/MenuKeyListener
+javax/swing/plaf/basic/BasicPopupMenuUI$MouseGrabber
+javax/swing/MenuSelectionManager
+javax/swing/plaf/basic/BasicPopupMenuUI$MenuKeyboardHelper
+javax/swing/plaf/basic/BasicPopupMenuUI$MenuKeyboardHelper$1
+java/awt/event/FocusAdapter
+javax/swing/plaf/basic/BasicComboPopup$1
+javax/swing/JList
+javax/swing/DefaultListSelectionModel
+javax/swing/ListSelectionModel
+javax/swing/plaf/basic/BasicListUI
+javax/swing/plaf/ListUI
+javax/swing/plaf/basic/BasicListUI$ListTransferHandler
+javax/swing/DefaultListCellRenderer$UIResource
+javax/swing/DefaultListCellRenderer
+javax/swing/ListCellRenderer
+javax/swing/plaf/basic/BasicListUI$Handler
+javax/swing/event/ListSelectionListener
+javax/swing/JMenu
+javax/swing/JMenuItem
+javax/swing/event/ListSelectionEvent
+javax/swing/plaf/basic/BasicComboPopup$Handler
+javax/swing/ScrollPaneLayout$UIResource
+javax/swing/ScrollPaneLayout
+javax/swing/ViewportLayout
+javax/swing/plaf/basic/BasicViewportUI
+javax/swing/plaf/ViewportUI
+javax/swing/JScrollPane$ScrollBar
+javax/swing/JScrollBar
+java/awt/Adjustable
+javax/swing/JScrollBar$ModelListener
+javax/swing/plaf/metal/MetalScrollBarUI
+javax/swing/plaf/basic/BasicScrollBarUI
+javax/swing/plaf/ScrollBarUI
+javax/swing/plaf/metal/MetalBumps
+javax/swing/plaf/basic/BasicScrollBarUI$TrackListener
+javax/swing/plaf/basic/BasicScrollBarUI$ArrowButtonListener
+javax/swing/plaf/basic/BasicScrollBarUI$ModelListener
+javax/swing/plaf/metal/MetalScrollBarUI$ScrollBarListener
+javax/swing/plaf/basic/BasicScrollBarUI$PropertyChangeHandler
+javax/swing/plaf/basic/BasicScrollBarUI$Handler
+javax/swing/plaf/basic/BasicScrollBarUI$ScrollListener
+javax/swing/JViewport$ViewListener
+javax/swing/plaf/metal/MetalScrollPaneUI
+javax/swing/plaf/basic/BasicScrollPaneUI
+javax/swing/plaf/ScrollPaneUI
+javax/swing/plaf/metal/MetalBorders$ScrollPaneBorder
+javax/swing/plaf/basic/BasicScrollPaneUI$Handler
+javax/swing/plaf/metal/MetalScrollPaneUI$1
+javax/swing/plaf/basic/BasicComboBoxRenderer$UIResource
+javax/swing/plaf/basic/BasicComboBoxRenderer
+javax/swing/plaf/metal/MetalComboBoxEditor$UIResource
+javax/swing/plaf/metal/MetalComboBoxEditor
+javax/swing/plaf/basic/BasicComboBoxEditor
+javax/swing/ComboBoxEditor
+javax/swing/plaf/basic/BasicComboBoxEditor$BorderlessTextField
+javax/swing/plaf/basic/BasicComboBoxEditor$UIResource
+javax/swing/text/Segment
+java/text/CharacterIterator
+javax/swing/plaf/metal/MetalComboBoxEditor$1
+javax/swing/plaf/metal/MetalComboBoxEditor$EditorBorder
+javax/swing/JToolBar
+javax/swing/plaf/metal/MetalComboBoxUI$MetalPropertyChangeListener
+javax/swing/plaf/basic/BasicComboBoxUI$PropertyChangeHandler
+javax/swing/plaf/basic/BasicComboBoxUI$Handler
+javax/swing/plaf/metal/MetalComboBoxIcon
+javax/swing/plaf/metal/MetalComboBoxButton$1
+javax/swing/plaf/basic/BasicComboBoxUI$DefaultKeySelectionManager
+javax/swing/JComboBox$KeySelectionManager
+javax/swing/plaf/metal/MetalCheckBoxUI
+javax/swing/plaf/metal/MetalIconFactory$CheckBoxIcon
+java/lang/ExceptionInInitializerError
+com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI
+javax/swing/JProgressBar
+javax/swing/JProgressBar$ModelListener
+javax/swing/plaf/metal/MetalProgressBarUI
+javax/swing/plaf/basic/BasicProgressBarUI
+javax/swing/plaf/ProgressBarUI
+javax/swing/plaf/BorderUIResource$LineBorderUIResource
+javax/swing/plaf/basic/BasicProgressBarUI$Handler
+javax/swing/JTable
+javax/swing/event/TableModelListener
+javax/swing/event/TableColumnModelListener
+javax/swing/event/CellEditorListener
+javax/swing/event/RowSorterListener
+javax/swing/tree/TreeModel
+javax/swing/table/JTableHeader
+javax/swing/table/AbstractTableModel
+javax/swing/table/TableModel
+javax/swing/table/TableCellRenderer
+javax/swing/event/TreeExpansionListener
+javax/swing/table/DefaultTableCellRenderer
+javax/swing/JCheckBoxMenuItem
+javax/swing/JTree
+javax/swing/tree/TreeSelectionModel
+javax/swing/tree/DefaultTreeCellRenderer
+javax/swing/tree/TreeCellRenderer
+javax/swing/table/TableCellEditor
+javax/swing/CellEditor
+javax/swing/JToolTip
+javax/swing/table/TableColumn
+javax/swing/table/DefaultTableColumnModel
+javax/swing/table/TableColumnModel
+javax/swing/table/DefaultTableModel
+javax/swing/event/TableModelEvent
+sun/swing/table/DefaultTableCellHeaderRenderer
+sun/swing/table/DefaultTableCellHeaderRenderer$EmptyIcon
+javax/swing/plaf/basic/BasicTableHeaderUI
+javax/swing/plaf/TableHeaderUI
+javax/swing/plaf/basic/BasicTableHeaderUI$1
+javax/swing/plaf/basic/BasicTableHeaderUI$MouseInputHandler
+javax/swing/DefaultCellEditor
+javax/swing/tree/TreeCellEditor
+javax/swing/AbstractCellEditor
+javax/swing/plaf/basic/BasicTableUI
+javax/swing/plaf/TableUI
+javax/swing/plaf/basic/BasicTableUI$TableTransferHandler
+javax/swing/plaf/basic/BasicTableUI$Handler
+javax/swing/tree/DefaultTreeSelectionModel
+javax/swing/tree/TreePath
+javax/swing/plaf/metal/MetalTreeUI
+javax/swing/plaf/basic/BasicTreeUI
+javax/swing/plaf/TreeUI
+javax/swing/plaf/basic/BasicTreeUI$Actions
+javax/swing/plaf/basic/BasicTreeUI$TreeTransferHandler
+javax/swing/plaf/metal/MetalTreeUI$LineListener
+javax/swing/plaf/basic/BasicTreeUI$Handler
+javax/swing/event/TreeModelListener
+javax/swing/event/TreeSelectionListener
+javax/swing/event/SwingPropertyChangeSupport
+javax/swing/tree/VariableHeightLayoutCache
+javax/swing/tree/AbstractLayoutCache
+javax/swing/tree/RowMapper
+javax/swing/plaf/basic/BasicTreeUI$NodeDimensionsHandler
+javax/swing/tree/AbstractLayoutCache$NodeDimensions
+javax/swing/JTree$TreeModelHandler
+javax/swing/tree/VariableHeightLayoutCache$TreeStateNode
+javax/swing/tree/DefaultMutableTreeNode
+javax/swing/tree/MutableTreeNode
+javax/swing/tree/DefaultMutableTreeNode$PreorderEnumeration
+java/util/Vector$1
+javax/swing/event/TableColumnModelEvent
+javax/swing/JPopupMenu$Separator
+javax/swing/JSeparator
+java/text/ParseException
+java/text/NumberFormat$Field
+javax/swing/text/GapContent$InsertUndo
+javax/swing/undo/AbstractUndoableEdit
+javax/swing/undo/UndoableEdit
+javax/swing/text/AbstractDocument$DefaultDocumentEvent
+javax/swing/event/DocumentEvent
+javax/swing/undo/CompoundEdit
+javax/swing/event/DocumentEvent$EventType
+javax/swing/text/Utilities
+javax/swing/text/SegmentCache
+javax/swing/text/SegmentCache$CachedSegment
+javax/swing/event/DocumentEvent$ElementChange
+javax/swing/event/UndoableEditEvent
+javax/swing/event/UndoableEditListener
+java/awt/Canvas
+java/util/Locale$Category
+java/util/Locale$1
+javax/swing/filechooser/FileFilter
+java/io/FileWriter
+javax/swing/tree/DefaultTreeModel
+javax/swing/tree/DefaultTreeCellEditor
+javax/swing/tree/DefaultTreeCellEditor$1
+javax/swing/tree/DefaultTreeCellEditor$DefaultTextField
+javax/swing/DefaultCellEditor$1
+javax/swing/DefaultCellEditor$EditorDelegate
+javax/swing/tree/DefaultTreeCellEditor$EditorContainer
+javax/swing/JTree$TreeSelectionRedirector
+javax/swing/JMenuItem$MenuItemFocusListener
+javax/swing/plaf/basic/BasicMenuItemUI
+javax/swing/plaf/MenuItemUI
+javax/swing/plaf/metal/MetalBorders$MenuItemBorder
+javax/swing/plaf/metal/MetalIconFactory$MenuItemArrowIcon
+sun/swing/MenuItemLayoutHelper
+javax/swing/plaf/basic/BasicMenuItemUI$Handler
+javax/swing/event/MenuDragMouseListener
+javax/swing/event/TreeModelEvent
+javax/swing/JSplitPane
+javax/swing/plaf/metal/MetalSplitPaneUI
+javax/swing/plaf/basic/BasicSplitPaneUI
+javax/swing/plaf/SplitPaneUI
+javax/swing/plaf/basic/BasicSplitPaneDivider
+javax/swing/plaf/basic/BasicBorders$SplitPaneBorder
+javax/swing/plaf/metal/MetalSplitPaneDivider
+javax/swing/plaf/basic/BasicSplitPaneDivider$DividerLayout
+javax/swing/plaf/basic/BasicSplitPaneDivider$MouseHandler
+javax/swing/plaf/basic/BasicBorders$SplitPaneDividerBorder
+javax/swing/plaf/basic/BasicSplitPaneUI$BasicHorizontalLayoutManager
+javax/swing/plaf/basic/BasicSplitPaneUI$1
+javax/swing/plaf/basic/BasicSplitPaneUI$Handler
+javax/swing/plaf/metal/MetalSplitPaneDivider$1
+javax/swing/plaf/basic/BasicSplitPaneDivider$OneTouchActionHandler
+javax/swing/plaf/metal/MetalSplitPaneDivider$2
+javax/swing/border/TitledBorder
+javax/swing/plaf/basic/BasicTextAreaUI
+javax/swing/text/AbstractDocument$ElementEdit
+java/util/Random
+java/util/concurrent/atomic/AtomicLong
+java/io/InterruptedIOException
+java/net/NoRouteToHostException
+java/net/BindException
+javax/swing/tree/PathPlaceHolder
+javax/swing/event/TreeSelectionEvent
+javax/swing/JList$3
+javax/swing/JList$ListSelectionHandler
+javax/swing/JSlider
+javax/swing/JSlider$ModelListener
+javax/swing/plaf/metal/MetalSliderUI
+javax/swing/plaf/basic/BasicSliderUI
+javax/swing/plaf/SliderUI
+javax/swing/plaf/basic/BasicSliderUI$Actions
+javax/swing/plaf/metal/MetalIconFactory$HorizontalSliderThumbIcon
+javax/swing/plaf/metal/MetalIconFactory$VerticalSliderThumbIcon
+javax/swing/plaf/basic/BasicSliderUI$TrackListener
+javax/swing/plaf/basic/BasicSliderUI$Handler
+javax/swing/plaf/basic/BasicSliderUI$ScrollListener
+javax/swing/plaf/metal/MetalSliderUI$MetalPropertyListener
+javax/swing/plaf/basic/BasicSliderUI$PropertyChangeHandler
+java/util/concurrent/ConcurrentHashMap$KeyIterator
+java/util/concurrent/ConcurrentHashMap$BaseIterator
+java/util/concurrent/ConcurrentHashMap$Traverser
+sun/font/Type1Font$1
+java/nio/channels/FileChannel$MapMode
+sun/nio/ch/FileChannelImpl$Unmapper
+sun/nio/ch/Util$4
+java/nio/DirectByteBufferR
+sun/nio/cs/US_ASCII$Decoder
+sun/font/SunFontManager$10
+java/util/concurrent/ConcurrentHashMap$ValueIterator
+javax/swing/DefaultListModel
+javax/swing/event/ListDataEvent
+javax/sound/sampled/DataLine
+javax/sound/sampled/Line
+javax/sound/sampled/LineUnavailableException
+javax/sound/sampled/UnsupportedAudioFileException
+javax/sound/sampled/Line$Info
+javax/sound/sampled/DataLine$Info
+javax/sound/sampled/Control$Type
+javax/sound/sampled/FloatControl$Type
+javax/swing/JMenuBar
+javax/swing/plaf/basic/BasicMenuBarUI
+javax/swing/plaf/MenuBarUI
+javax/swing/plaf/metal/MetalBorders$MenuBarBorder
+javax/swing/plaf/basic/BasicMenuBarUI$Handler
+javax/swing/KeyboardManager
+javax/swing/JRadioButtonMenuItem
+javax/swing/JMenu$MenuChangeListener
+javax/swing/plaf/basic/BasicMenuUI
+javax/swing/plaf/metal/MetalIconFactory$MenuArrowIcon
+javax/swing/plaf/basic/BasicMenuUI$Handler
+javax/swing/JMenuItem$AccessibleJMenuItem
+javax/swing/AbstractButton$AccessibleAbstractButton
+javax/accessibility/AccessibleAction
+javax/accessibility/AccessibleValue
+javax/accessibility/AccessibleText
+javax/accessibility/AccessibleExtendedComponent
+javax/accessibility/AccessibleComponent
+javax/swing/JComponent$AccessibleJComponent
+java/awt/Container$AccessibleAWTContainer
+java/awt/Component$AccessibleAWTComponent
+javax/accessibility/AccessibleContext$1
+sun/awt/AWTAccessor$AccessibleContextAccessor
+javax/accessibility/AccessibleRelationSet
+javax/swing/JMenu$WinListener
+java/awt/event/WindowAdapter
+javax/swing/plaf/metal/MetalPopupMenuSeparatorUI
+javax/swing/plaf/metal/MetalSeparatorUI
+javax/swing/plaf/basic/BasicSeparatorUI
+javax/swing/plaf/SeparatorUI
+javax/accessibility/AccessibleState
+javax/accessibility/AccessibleBundle
+javax/swing/plaf/basic/BasicCheckBoxMenuItemUI
+javax/swing/plaf/metal/MetalIconFactory$CheckBoxMenuItemIcon
+javax/swing/JCheckBoxMenuItem$AccessibleJCheckBoxMenuItem
+javax/swing/plaf/basic/BasicRadioButtonMenuItemUI
+javax/swing/plaf/metal/MetalIconFactory$RadioButtonMenuItemIcon
+java/awt/event/ContainerEvent
+sun/awt/image/ImageDecoder$1
+java/awt/im/InputContext
+sun/awt/im/InputMethodContext
+java/awt/im/spi/InputMethodContext
+java/awt/im/InputMethodRequests
+sun/awt/im/InputContext
+sun/awt/im/InputMethodManager
+sun/awt/im/ExecutableInputMethodManager
+sun/awt/X11/XInputMethodDescriptor
+sun/awt/X11InputMethodDescriptor
+java/awt/im/spi/InputMethodDescriptor
+sun/awt/im/InputMethodLocator
+sun/awt/im/ExecutableInputMethodManager$3
+javax/swing/JTabbedPane$Page
+java/net/DatagramSocket
+java/net/MulticastSocket
+java/net/DatagramPacket
+java/net/DatagramPacket$1
+java/net/DefaultDatagramSocketImplFactory
+java/net/PlainDatagramSocketImpl
+java/net/AbstractPlainDatagramSocketImpl
+java/net/DatagramSocketImpl
+java/net/AbstractPlainDatagramSocketImpl$1
+java/net/NetworkInterface
+java/net/NetworkInterface$1
+java/net/InterfaceAddress
+java/net/DefaultInterface
+java/net/DatagramSocket$1
+java/net/SocketOption
+sun/net/ResourceManager
+java/text/Collator
+sun/util/locale/provider/CollatorProviderImpl
+java/util/Collections$UnmodifiableList$1
+sun/text/resources/CollationData
+java/text/RuleBasedCollator
+java/text/RBCollationTables
+java/net/ServerSocket
+java/text/RBTableBuilder
+java/text/RBCollationTables$BuildAPI
+sun/text/IntHashtable
+sun/text/UCompactIntArray
+sun/text/normalizer/NormalizerImpl
+sun/text/normalizer/ICUData
+sun/text/normalizer/NormalizerDataReader
+sun/text/normalizer/ICUBinary$Authenticate
+sun/text/normalizer/ICUBinary
+sun/text/normalizer/NormalizerImpl$FCDTrieImpl
+sun/text/normalizer/Trie$DataManipulate
+sun/text/normalizer/NormalizerImpl$NormTrieImpl
+sun/text/normalizer/NormalizerImpl$AuxTrieImpl
+sun/text/normalizer/IntTrie
+sun/text/normalizer/Trie
+sun/text/normalizer/CharTrie
+sun/text/normalizer/CharTrie$FriendAgent
+sun/text/normalizer/UnicodeSet
+sun/text/normalizer/UnicodeMatcher
+sun/text/normalizer/NormalizerImpl$DecomposeArgs
+java/text/MergeCollation
+java/text/PatternEntry$Parser
+java/text/PatternEntry
+java/text/EntryPair
+sun/text/ComposedCharIter
+sun/text/normalizer/UTF16
+sun/net/www/protocol/http/Handler
+java/security/SignatureException
+java/security/InvalidKeyException
+java/security/KeyException
+java/security/Signature
+java/security/SignatureSpi
+java/io/ObjectInputStream$BlockDataInputStream
+java/io/ObjectInputStream$PeekInputStream
+java/io/ObjectInputStream$HandleTable
+java/io/ObjectInputStream$HandleTable$HandleList
+java/io/ObjectInputStream$ValidationList
+java/io/Bits
+java/io/ObjectStreamClass
+java/io/ObjectOutputStream
+java/io/ObjectOutput
+sun/security/provider/DSAPublicKey
+java/security/interfaces/DSAPublicKey
+java/security/interfaces/DSAKey
+java/security/PublicKey
+java/security/Key
+sun/security/x509/X509Key
+java/io/ObjectStreamClass$Caches
+java/io/ObjectStreamClass$WeakClassKey
+java/io/ObjectStreamClass$EntryFuture
+java/lang/reflect/Proxy
+java/lang/reflect/InvocationHandler
+java/lang/reflect/WeakCache
+java/lang/reflect/Proxy$KeyFactory
+java/lang/reflect/Proxy$ProxyClassFactory
+java/io/Externalizable
+java/io/ObjectStreamClass$2
+java/util/ComparableTimSort
+sun/security/x509/AlgorithmId
+sun/security/util/DerEncoder
+sun/reflect/SerializationConstructorAccessorImpl
+sun/security/util/BitArray
+sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl
+java/io/ObjectStreamClass$FieldReflectorKey
+java/io/ObjectStreamClass$FieldReflector
+java/io/ObjectStreamClass$1
+java/io/DataOutputStream
+java/io/ObjectStreamClass$MemberSignature
+java/io/ObjectStreamClass$3
+sun/security/util/DerOutputStream
+java/io/ObjectStreamClass$4
+java/io/ObjectStreamClass$5
+sun/security/util/DerValue
+java/security/MessageDigest
+java/security/MessageDigestSpi
+sun/security/jca/GetInstance
+sun/security/jca/Providers
+java/lang/InheritableThreadLocal
+sun/security/jca/ProviderList
+sun/security/jca/ProviderConfig
+java/math/BigInteger
+java/security/Provider
+sun/security/jca/ProviderList$3
+sun/security/jca/ProviderList$1
+java/security/Provider$ServiceKey
+java/security/Provider$EngineDescription
+java/security/interfaces/DSAParams
+sun/security/jca/ProviderList$2
+sun/security/jca/ProviderConfig$2
+java/io/ObjectStreamClass$ClassDataSlot
+sun/security/provider/Sun
+java/io/SerialCallbackContext
+sun/security/provider/SunEntries
+sun/security/provider/SunEntries$1
+sun/security/provider/NativePRNG
+java/security/SecureRandomSpi
+sun/security/provider/NativePRNG$Variant
+sun/security/util/DerInputStream
+sun/security/provider/NativePRNG$1
+sun/security/provider/NativePRNG$2
+sun/security/provider/NativePRNG$RandomIO
+sun/security/util/DerInputBuffer
+sun/security/provider/NativePRNG$Blocking
+sun/security/provider/NativePRNG$NonBlocking
+sun/security/util/ObjectIdentifier
+java/security/Provider$Service
+java/security/Provider$UString
+sun/security/provider/SHA
+sun/security/provider/DigestBase
+sun/security/jca/GetInstance$Instance
+java/security/MessageDigest$Delegate
+sun/security/provider/ByteArrayAccess
+java/io/ObjectOutputStream$BlockDataOutputStream
+java/security/AlgorithmParameters
+java/io/ObjectOutputStream$HandleTable
+java/io/ObjectOutputStream$ReplaceTable
+java/security/AlgorithmParametersSpi
+sun/security/provider/DSAParameters
+sun/security/util/ByteArrayLexOrder
+sun/security/util/ByteArrayTagOrder
+sun/security/util/DerIndefLenConverter
+java/io/ObjectStreamClass$ExceptionInfo
+java/io/ObjectInputStream$GetFieldImpl
+java/io/ObjectInputStream$GetField
+java/math/BigInteger$UnsafeHolder
+sun/security/jca/ServiceId
+sun/security/jca/ProviderList$ServiceList
+sun/security/jca/ProviderList$ServiceList$1
+java/security/Signature$Delegate
+java/util/ArrayList$SubList
+java/util/ArrayList$SubList$1
+java/security/interfaces/DSAPrivateKey
+java/security/PrivateKey
+javax/security/auth/Destroyable
+sun/security/provider/DSA$SHA1withDSA
+sun/security/provider/DSA$LegacyDSA
+sun/security/provider/DSA
+java/security/spec/DSAParameterSpec
+java/security/spec/AlgorithmParameterSpec
+java/math/MutableBigInteger
+java/math/SignedMutableBigInteger
+javax/swing/TimerQueue
+java/util/concurrent/DelayQueue
+java/util/concurrent/BlockingQueue
+java/util/AbstractQueue
+java/util/PriorityQueue
+javax/swing/TimerQueue$1
+javax/swing/TimerQueue$DelayedTimer
+java/util/concurrent/Delayed
+java/util/concurrent/TimeUnit
+java/util/concurrent/TimeUnit$1
+java/util/concurrent/TimeUnit$2
+java/util/concurrent/TimeUnit$3
+java/util/concurrent/TimeUnit$4
+java/util/concurrent/TimeUnit$5
+java/util/concurrent/TimeUnit$6
+java/util/concurrent/TimeUnit$7
+java/awt/Window$1DisposeAction
+java/awt/EventQueue$1AWTInvocationLock
+sun/awt/X11/XUnmapEvent
+java/awt/LightweightDispatcher$2
+java/awt/Component$FlipBufferStrategy
+java/awt/SentEvent
+sun/java2d/cmm/CMSManager
+java/awt/image/DataBufferInt
+java/awt/image/SinglePixelPackedSampleModel
+sun/awt/image/IntegerInterleavedRaster
+sun/awt/X11/XDropTargetRegistry
+sun/awt/X11/XEmbeddedFramePeer
+sun/awt/X11/XDragAndDropProtocols
+sun/awt/X11/XDropTargetContextPeer
+sun/awt/dnd/SunDropTargetContextPeer
+java/awt/dnd/peer/DropTargetContextPeer
+java/awt/datatransfer/Transferable
+sun/awt/X11/XDropTargetContextPeer$XDropTargetProtocolListenerImpl
+sun/awt/X11/XDropTargetProtocolListener
+sun/awt/X11/XDnDDragSourceProtocol
+sun/awt/X11/XDragSourceProtocol
+sun/awt/X11/MotifDnDDragSourceProtocol
+sun/awt/X11/XDnDDropTargetProtocol
+sun/awt/X11/XDropTargetProtocol
+sun/awt/X11/MotifDnDDropTargetProtocol
+sun/awt/X11/XErrorHandler$VerifyChangePropertyHandler
+sun/awt/X11/XDnDConstants
+sun/awt/X11/XSelection
+sun/awt/X11/XSelection$IncrementalTransferHandler
+sun/awt/X11/XSelection$SelectionEventHandler
+sun/awt/X11/MotifDnDConstants
+javax/swing/JLayer
+javax/swing/JInternalFrame
+javax/swing/KeyboardManager$ComponentKeyStrokePair
+sun/awt/EmbeddedFrame
+sun/swing/MenuItemLayoutHelper$RectSize
+javax/swing/JTable$2
+javax/swing/JTable$Resizable3
+javax/swing/JTable$Resizable2
+javax/swing/JTable$5
+javax/swing/event/AncestorEvent
+java/awt/Label
+sun/awt/X11/XLabelPeer
+java/awt/peer/LabelPeer
+sun/awt/TimedWindowEvent
+java/awt/DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent
+sun/awt/CausedFocusEvent$Cause
+java/awt/KeyboardFocusManager$HeavyweightFocusRequest
+java/awt/DefaultKeyboardFocusManager$TypeAheadMarker
+java/awt/KeyboardFocusManager$LightweightFocusRequest
+sun/awt/CausedFocusEvent
+java/awt/KeyboardFocusManager$3
+sun/awt/X11/XInputMethod
+sun/awt/X11InputMethod
+sun/awt/im/InputMethodAdapter
+java/awt/im/spi/InputMethod
+java/awt/Event
+java/net/Authenticator
+java/lang/Throwable$WrappedPrintStream
+java/lang/Throwable$PrintStreamOrWriter
+sun/awt/image/PNGImageDecoder
+sun/awt/image/PNGFilterInputStream
+sun/util/locale/provider/TimeZoneNameUtility
+sun/util/locale/provider/TimeZoneNameProviderImpl
+sun/util/locale/provider/TimeZoneNameUtility$TimeZoneNameGetter
+sun/util/resources/TimeZoneNames
+sun/util/resources/TimeZoneNamesBundle
+sun/util/resources/en/TimeZoneNames_en
+sun/awt/image/OffScreenImage
+java/lang/ProcessBuilder
+java/lang/ProcessImpl
+java/lang/UNIXProcess
+java/lang/Process
+java/lang/UNIXProcess$Platform
+java/lang/UNIXProcess$LaunchMechanism
+java/util/EnumSet
+java/util/RegularEnumSet
+sun/java2d/x11/X11SurfaceDataProxy$Opaque
+java/lang/UNIXProcess$1
+java/util/concurrent/Executor
+java/util/concurrent/ThreadFactory
+java/util/concurrent/Executors
+java/util/concurrent/ThreadPoolExecutor
+java/util/concurrent/AbstractExecutorService
+java/util/concurrent/ExecutorService
+java/util/concurrent/ThreadPoolExecutor$AbortPolicy
+java/util/concurrent/RejectedExecutionHandler
+java/util/concurrent/SynchronousQueue
+java/util/concurrent/SynchronousQueue$TransferStack
+java/util/concurrent/SynchronousQueue$Transferer
+java/util/concurrent/SynchronousQueue$TransferStack$SNode
+java/lang/UNIXProcess$ProcessPipeOutputStream
+java/lang/UNIXProcess$ProcessPipeInputStream
+java/util/concurrent/ThreadPoolExecutor$Worker
+java/lang/ProcessBuilder$NullOutputStream
+java/io/FilterReader
+sun/awt/X11/XClipboard
+sun/awt/X11/OwnershipListener
+sun/awt/datatransfer/SunClipboard
+java/awt/datatransfer/Clipboard
+java/io/EOFException
+java/util/jar/JarFile$JarEntryIterator
+java/util/zip/ZipFile$ZipEntryIterator
+java/lang/IllegalAccessError
+java/text/MessageFormat
+java/text/MessageFormat$Field
+java/util/Hashtable$ValueCollection
+javax/swing/event/CaretListener
+javax/swing/plaf/metal/MetalButtonUI
+javax/swing/plaf/metal/MetalToggleButtonUI
+javax/swing/plaf/metal/MetalBorders$ToggleButtonBorder
+javax/swing/event/MenuEvent
+javax/swing/border/MatteBorder
+sun/font/StandardGlyphVector
+java/awt/font/GlyphVector
+sun/font/StandardGlyphVector$GlyphStrike
+sun/font/CoreMetrics
+sun/font/FontLineMetrics
+java/awt/font/LineMetrics
+javax/swing/JToolBar$DefaultToolBarLayout
+javax/swing/plaf/metal/MetalToolBarUI
+javax/swing/plaf/basic/BasicToolBarUI
+javax/swing/plaf/ToolBarUI
+javax/swing/plaf/metal/MetalBorders$ToolBarBorder
+javax/swing/plaf/metal/MetalBorders$RolloverButtonBorder
+javax/swing/plaf/metal/MetalBorders$RolloverMarginBorder
+javax/swing/plaf/basic/BasicBorders$RolloverMarginBorder
+javax/swing/plaf/metal/MetalToolBarUI$MetalDockingListener
+javax/swing/plaf/basic/BasicToolBarUI$DockingListener
+javax/swing/plaf/basic/BasicToolBarUI$Handler
+javax/swing/JToolBar$Separator
+javax/swing/plaf/basic/BasicToolBarSeparatorUI
+java/awt/event/AdjustmentEvent
+java/awt/MenuBar
+sun/awt/X11/XErrorEvent
+# eea35d9d56e0006e
diff --git a/staging/linux-x86/jre/lib/cmm/CIEXYZ.pf b/staging/linux-x86/jre/lib/cmm/CIEXYZ.pf
new file mode 100644
index 0000000..48c9dd8
--- /dev/null
+++ b/staging/linux-x86/jre/lib/cmm/CIEXYZ.pf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/cmm/GRAY.pf b/staging/linux-x86/jre/lib/cmm/GRAY.pf
new file mode 100644
index 0000000..8af309c
--- /dev/null
+++ b/staging/linux-x86/jre/lib/cmm/GRAY.pf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/cmm/LINEAR_RGB.pf b/staging/linux-x86/jre/lib/cmm/LINEAR_RGB.pf
new file mode 100644
index 0000000..3e0b177
--- /dev/null
+++ b/staging/linux-x86/jre/lib/cmm/LINEAR_RGB.pf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/cmm/PYCC.pf b/staging/linux-x86/jre/lib/cmm/PYCC.pf
new file mode 100644
index 0000000..0cee015
--- /dev/null
+++ b/staging/linux-x86/jre/lib/cmm/PYCC.pf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/cmm/sRGB.pf b/staging/linux-x86/jre/lib/cmm/sRGB.pf
new file mode 100644
index 0000000..7b552ad
--- /dev/null
+++ b/staging/linux-x86/jre/lib/cmm/sRGB.pf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/content-types.properties b/staging/linux-x86/jre/lib/content-types.properties
new file mode 100644
index 0000000..559de96
--- /dev/null
+++ b/staging/linux-x86/jre/lib/content-types.properties
@@ -0,0 +1,280 @@
+#sun.net.www MIME content-types table
+#
+# Property fields:
+#
+# <description> ::= 'description' '=' <descriptive string>
+# <extensions> ::= 'file_extensions' '=' <comma-delimited list, include '.'>
+# <image> ::= 'icon' '=' <filename of icon image>
+# <action> ::= 'browser' | 'application' | 'save' | 'unknown'
+# <application> ::= 'application' '=' <command line template>
+#
+
+#
+# The "we don't know anything about this data" type(s).
+# Used internally to mark unrecognized types.
+#
+content/unknown: description=Unknown Content
+unknown/unknown: description=Unknown Data Type
+
+#
+# The template we should use for temporary files when launching an application
+# to view a document of given type.
+#
+temp.file.template: /tmp/%s
+
+#
+# The "real" types.
+#
+application/octet-stream: \
+ description=Generic Binary Stream;\
+ file_extensions=.saveme,.dump,.hqx,.arc,.o,.a,.bin,.exe,.z,.gz
+
+application/oda: \
+ description=ODA Document;\
+ file_extensions=.oda
+
+application/pdf: \
+ description=Adobe PDF Format;\
+ file_extensions=.pdf
+
+application/postscript: \
+ description=Postscript File;\
+ file_extensions=.eps,.ai,.ps;\
+ icon=ps;\
+ action=application;\
+ application=imagetool %s
+
+application/x-dvi: \
+ description=TeX DVI File;\
+ file_extensions=.dvi;\
+ action=application;\
+ application=xdvi %s
+
+application/x-hdf: \
+ description=Hierarchical Data Format;\
+ file_extensions=.hdf;\
+ action=save
+
+application/x-latex: \
+ description=LaTeX Source;\
+ file_extensions=.latex
+
+application/x-netcdf: \
+ description=Unidata netCDF Data Format;\
+ file_extensions=.nc,.cdf;\
+ action=save
+
+application/x-tex: \
+ description=TeX Source;\
+ file_extensions=.tex
+
+application/x-texinfo: \
+ description=Gnu Texinfo;\
+ file_extensions=.texinfo,.texi
+
+application/x-troff: \
+ description=Troff Source;\
+ file_extensions=.t,.tr,.roff;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff %s | col | more -w\"
+
+application/x-troff-man: \
+ description=Troff Manpage Source;\
+ file_extensions=.man;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff -man %s | col | more -w\"
+
+application/x-troff-me: \
+ description=Troff ME Macros;\
+ file_extensions=.me;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff -me %s | col | more -w\"
+
+application/x-troff-ms: \
+ description=Troff MS Macros;\
+ file_extensions=.ms;\
+ action=application;\
+ application=xterm -title troff -e sh -c \"nroff -ms %s | col | more -w\"
+
+application/x-wais-source: \
+ description=Wais Source;\
+ file_extensions=.src,.wsrc
+
+application/zip: \
+ description=Zip File;\
+ file_extensions=.zip;\
+ icon=zip;\
+ action=save
+
+application/x-bcpio: \
+ description=Old Binary CPIO Archive;\
+ file_extensions=.bcpio; action=save
+
+application/x-cpio: \
+ description=Unix CPIO Archive;\
+ file_extensions=.cpio; action=save
+
+application/x-gtar: \
+ description=Gnu Tar Archive;\
+ file_extensions=.gtar;\
+ icon=tar;\
+ action=save
+
+application/x-shar: \
+ description=Shell Archive;\
+ file_extensions=.sh,.shar;\
+ action=save
+
+application/x-sv4cpio: \
+ description=SVR4 CPIO Archive;\
+ file_extensions=.sv4cpio; action=save
+
+application/x-sv4crc: \
+ description=SVR4 CPIO with CRC;\
+ file_extensions=.sv4crc; action=save
+
+application/x-tar: \
+ description=Tar Archive;\
+ file_extensions=.tar;\
+ icon=tar;\
+ action=save
+
+application/x-ustar: \
+ description=US Tar Archive;\
+ file_extensions=.ustar;\
+ action=save
+
+audio/basic: \
+ description=Basic Audio;\
+ file_extensions=.snd,.au;\
+ icon=audio;\
+ action=application;\
+ application=audiotool %s
+
+audio/x-aiff: \
+ description=Audio Interchange Format File;\
+ file_extensions=.aifc,.aif,.aiff;\
+ icon=aiff
+
+audio/x-wav: \
+ description=Wav Audio;\
+ file_extensions=.wav;\
+ icon=wav
+
+image/gif: \
+ description=GIF Image;\
+ file_extensions=.gif;\
+ icon=gif;\
+ action=browser
+
+image/ief: \
+ description=Image Exchange Format;\
+ file_extensions=.ief
+
+image/jpeg: \
+ description=JPEG Image;\
+ file_extensions=.jfif,.jfif-tbnl,.jpe,.jpg,.jpeg;\
+ icon=jpeg;\
+ action=browser;\
+ application=imagetool %s
+
+image/tiff: \
+ description=TIFF Image;\
+ file_extensions=.tif,.tiff;\
+ icon=tiff
+
+image/vnd.fpx: \
+ description=FlashPix Image;\
+ file_extensions=.fpx,.fpix
+
+image/x-cmu-rast: \
+ description=CMU Raster Image;\
+ file_extensions=.ras
+
+image/x-portable-anymap: \
+ description=PBM Anymap Format;\
+ file_extensions=.pnm
+
+image/x-portable-bitmap: \
+ description=PBM Bitmap Format;\
+ file_extensions=.pbm
+
+image/x-portable-graymap: \
+ description=PBM Graymap Format;\
+ file_extensions=.pgm
+
+image/x-portable-pixmap: \
+ description=PBM Pixmap Format;\
+ file_extensions=.ppm
+
+image/x-rgb: \
+ description=RGB Image;\
+ file_extensions=.rgb
+
+image/x-xbitmap: \
+ description=X Bitmap Image;\
+ file_extensions=.xbm,.xpm
+
+image/x-xwindowdump: \
+ description=X Window Dump Image;\
+ file_extensions=.xwd
+
+image/png: \
+ description=PNG Image;\
+ file_extensions=.png;\
+ icon=png;\
+ action=browser
+
+image/bmp: \
+ description=Bitmap Image;\
+ file_extensions=.bmp;
+
+text/html: \
+ description=HTML Document;\
+ file_extensions=.htm,.html;\
+ icon=html
+
+text/plain: \
+ description=Plain Text;\
+ file_extensions=.text,.c,.cc,.c++,.h,.pl,.txt,.java,.el;\
+ icon=text;\
+ action=browser
+
+text/tab-separated-values: \
+ description=Tab Separated Values Text;\
+ file_extensions=.tsv
+
+text/x-setext: \
+ description=Structure Enhanced Text;\
+ file_extensions=.etx
+
+video/mpeg: \
+ description=MPEG Video Clip;\
+ file_extensions=.mpg,.mpe,.mpeg;\
+ icon=mpeg;\
+ action=application;\
+ application=mpeg_play %s
+
+video/quicktime: \
+ description=QuickTime Video Clip;\
+ file_extensions=.mov,.qt
+
+application/x-troff-msvideo: \
+ description=AVI Video;\
+ file_extensions=.avi;\
+ icon=avi
+
+video/x-sgi-movie: \
+ description=SGI Movie;\
+ file_extensions=.movie,.mv
+
+message/rfc822: \
+ description=Internet Email Message;\
+ file_extensions=.mime
+
+application/xml: \
+ description=XML document;\
+ file_extensions=.xml
+
+
+
diff --git a/staging/linux-x86/jre/lib/currency.data b/staging/linux-x86/jre/lib/currency.data
new file mode 100644
index 0000000..fbe5e9d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/currency.data
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/cldrdata.jar b/staging/linux-x86/jre/lib/ext/cldrdata.jar
new file mode 100644
index 0000000..636ef5d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/cldrdata.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/dnsns.jar b/staging/linux-x86/jre/lib/ext/dnsns.jar
new file mode 100644
index 0000000..8b8a98e
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/dnsns.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/jaccess.jar b/staging/linux-x86/jre/lib/ext/jaccess.jar
new file mode 100644
index 0000000..38003fd
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/jaccess.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/localedata.jar b/staging/linux-x86/jre/lib/ext/localedata.jar
new file mode 100644
index 0000000..7389785
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/localedata.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/meta-index b/staging/linux-x86/jre/lib/ext/meta-index
new file mode 100644
index 0000000..b58c2bc
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/meta-index
@@ -0,0 +1,28 @@
+% VERSION 2
+% WARNING: this file is auto-generated; do not edit
+% UNSUPPORTED: this file and its format may change and/or
+% may be removed in a future release
+! cldrdata.jar
+sun/text
+sun/util
+# dnsns.jar
+sun/net
+META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
+! jaccess.jar
+com/sun/java/accessibility/
+# localedata.jar
+sun/text
+sun/util
+# nashorn.jar
+META-INF/services/javax.script.ScriptEngineFactory
+jdk/nashorn
+jdk/internal
+! sunec.jar
+sun/security
+! sunjce_provider.jar
+com/sun/crypto/
+! sunpkcs11.jar
+sun/security
+# zipfs.jar
+META-INF/services/java.nio.file.spi.FileSystemProvider
+com/sun/nio/
diff --git a/staging/linux-x86/jre/lib/ext/nashorn.jar b/staging/linux-x86/jre/lib/ext/nashorn.jar
new file mode 100644
index 0000000..ed912c4
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/nashorn.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/sunec.jar b/staging/linux-x86/jre/lib/ext/sunec.jar
new file mode 100644
index 0000000..e149042
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/sunec.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/sunjce_provider.jar b/staging/linux-x86/jre/lib/ext/sunjce_provider.jar
new file mode 100644
index 0000000..5aa4bc4
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/sunjce_provider.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/sunpkcs11.jar b/staging/linux-x86/jre/lib/ext/sunpkcs11.jar
new file mode 100644
index 0000000..73e5395
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/sunpkcs11.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/ext/zipfs.jar b/staging/linux-x86/jre/lib/ext/zipfs.jar
new file mode 100644
index 0000000..553e62f
--- /dev/null
+++ b/staging/linux-x86/jre/lib/ext/zipfs.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/flavormap.properties b/staging/linux-x86/jre/lib/flavormap.properties
new file mode 100644
index 0000000..223002a
--- /dev/null
+++ b/staging/linux-x86/jre/lib/flavormap.properties
@@ -0,0 +1,78 @@
+#
+# This properties file is used to initialize the default
+# java.awt.datatransfer.SystemFlavorMap. It contains the X11 platform-specific,
+# default mappings between common X11 selection atoms and platform-independent
+# MIME type strings, which will be converted into
+# java.awt.datatransfer.DataFlavors.
+#
+# These default mappings may be augmented by specifying the
+#
+# AWT.DnD.flavorMapFileURL
+#
+# property in the appropriate awt.properties file. The specified properties URL
+# will be loaded into the SystemFlavorMap.
+#
+# The standard format is:
+#
+# <native>=<MIME type>
+#
+# <native> should be a string identifier that the native platform will
+# recognize as a valid data format. <MIME type> should specify both a MIME
+# primary type and a MIME subtype separated by a '/'. The MIME type may include
+# parameters, where each parameter is a key/value pair separated by '=', and
+# where each parameter to the MIME type is separated by a ';'.
+#
+# Because SystemFlavorMap implements FlavorTable, developers are free to
+# duplicate both native keys and DataFlavor values. If a mapping contains a
+# duplicate key or value, earlier mappings which included this key or value
+# will be preferred.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", and which support the charset parameter, should specify the exact
+# format in which the native platform expects the data. The "charset"
+# parameter specifies the char to byte encoding, the "eoln" parameter
+# specifies the end-of-line marker, and the "terminators" parameter specifies
+# the number of terminating NUL bytes. Note that "eoln" and "terminators"
+# are not standardized MIME type parameters. They are specific to this file
+# format ONLY. They will not appear in any of the DataFlavors returned by the
+# SystemFlavorMap at the Java level.
+#
+# If the "charset" parameter is omitted, or has zero length, the platform
+# default encoding is assumed. If the "eoln" parameter is omitted, or has
+# zero length, "\n" is assumed. If the "terminators" parameter is omitted,
+# or has a value less than zero, zero is assumed.
+#
+# Upon initialization, the data transfer subsystem will record the specified
+# details of the native text format, but the default SystemFlavorMap will
+# present a large set of synthesized DataFlavors which map, in both
+# directions, to the native. After receiving data from the application in one
+# of the synthetic DataFlavors, the data transfer subsystem will transform
+# the data stream into the format specified in this file before passing the
+# transformed stream to the native system.
+#
+# Mappings whose values specify DataFlavors with primary MIME types of
+# "text", but which do not support the charset parameter, will be treated as
+# opaque, 8-bit data. They will not undergo any transformation process, and
+# any "charset", "eoln", or "terminators" parameters specified in this file
+# will be ignored.
+#
+# See java.awt.datatransfer.DataFlavor.selectBestTextFlavor for a list of
+# text flavors which support the charset parameter.
+
+UTF8_STRING=text/plain;charset=UTF-8;eoln="\n";terminators=0
+
+# The COMPOUND_TEXT support for inter-client text transfer is disabled by
+# default. The reason is that many native applications prefer this format over
+# other native text formats, but are unable to decode the textual data in this
+# format properly. This results in java-to-native text transfer failures.
+# To enable the COMPOUND_TEXT support for this JRE installation uncomment
+# the line below.
+
+# COMPOUND_TEXT=text/plain;charset=x-compound-text;eoln="\n";terminators=0
+
+TEXT=text/plain;eoln="\n";terminators=0
+STRING=text/plain;charset=iso8859-1;eoln="\n";terminators=0
+FILE_NAME=application/x-java-file-list;class=java.util.List
+text/uri-list=application/x-java-file-list;class=java.util.List
+PNG=image/x-java-image;class=java.awt.Image
+JFIF=image/x-java-image;class=java.awt.Image
diff --git a/staging/linux-x86/jre/lib/fontconfig.bfc b/staging/linux-x86/jre/lib/fontconfig.bfc
new file mode 100644
index 0000000..13c3dce
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fontconfig.bfc
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fontconfig.properties.src b/staging/linux-x86/jre/lib/fontconfig.properties.src
new file mode 100644
index 0000000..cb8a536
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fontconfig.properties.src
@@ -0,0 +1,42 @@
+# Version
+
+version=1
+
+# Component Font Mappings
+
+
+serif.plain.latin-1=-b&h-droidserif-medium-r-normal--*-%d-*-*-p-*-iso8859-1
+serif.bold.latin-1=-b&h-droidserif-demibold-r-normal--*-%d-*-*-p-*-iso8859-1
+serif.italic.latin-1=-b&h-droidserif-medium-i-normal--*-%d-*-*-p-*-iso8859-1
+serif.bolditalic.latin-1=-b&h-droidserif-demibold-i-normal--*-%d-*-*-p-*-iso8859-1
+
+sansserif.plain.latin-1=-b&h-droidsans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
+sansserif.bold.latin-1=-b&h-droidsans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
+sansserif.italic.latin-1=-b&h-droidsans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
+sansserif.bolditalic.latin-1=-b&h-droidsans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
+
+monospaced.plain.latin-1=-b&h-droidsansmono-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
+monospaced.bold.latin-1=-b&h-droidsansmono-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
+monospaced.italic.latin-1=-b&h-droidsansmono-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
+monospaced.bolditalic.latin-1=-b&h-droidsansmono-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
+
+dialog.plain.latin-1=-b&h-droidsans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
+dialog.bold.latin-1=-b&h-droidsans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
+dialog.italic.latin-1=-b&h-droidsans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
+dialog.bolditalic.latin-1=-b&h-droidsans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
+
+dialoginput.plain.latin-1=-b&h-droidsansmono-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
+dialoginput.bold.latin-1=-b&h-droidsansmono-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
+dialoginput.italic.latin-1=-b&h-droidsansmono-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
+dialoginput.bolditalic.latin-1=-b&h-droidsansmono-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
+
+# Search Sequences
+
+sequence.allfonts=latin-1
+
+# Exclusion Ranges
+
+# Font File Names
+
+
+
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSans-Bold.ttf b/staging/linux-x86/jre/lib/fonts/DroidSans-Bold.ttf
new file mode 100644
index 0000000..d065b64
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSans-Bold.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSans.ttf b/staging/linux-x86/jre/lib/fonts/DroidSans.ttf
new file mode 100644
index 0000000..ad1efca
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSans.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSansMono.ttf b/staging/linux-x86/jre/lib/fonts/DroidSansMono.ttf
new file mode 100644
index 0000000..a007071
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSansMono.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSansMonoDotted.ttf b/staging/linux-x86/jre/lib/fonts/DroidSansMonoDotted.ttf
new file mode 100644
index 0000000..e56a5ca
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSansMonoDotted.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSansMonoSlashed.ttf b/staging/linux-x86/jre/lib/fonts/DroidSansMonoSlashed.ttf
new file mode 100644
index 0000000..8c44b47
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSansMonoSlashed.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSerif-Bold.ttf b/staging/linux-x86/jre/lib/fonts/DroidSerif-Bold.ttf
new file mode 100644
index 0000000..838d255
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSerif-Bold.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttf b/staging/linux-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttf
new file mode 100644
index 0000000..0b1601f
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSerif-BoldItalic.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSerif-Italic.ttf b/staging/linux-x86/jre/lib/fonts/DroidSerif-Italic.ttf
new file mode 100644
index 0000000..2972809
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSerif-Italic.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/DroidSerif-Regular.ttf b/staging/linux-x86/jre/lib/fonts/DroidSerif-Regular.ttf
new file mode 100644
index 0000000..5b4fe81
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/DroidSerif-Regular.ttf
Binary files differ
diff --git a/staging/linux-x86/jre/lib/fonts/LICENSE.txt b/staging/linux-x86/jre/lib/fonts/LICENSE.txt
new file mode 100644
index 0000000..a4a4b17
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/LICENSE.txt
@@ -0,0 +1,13 @@
+Copyright 2000-2016 JetBrains s.r.o.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/staging/linux-x86/jre/lib/fonts/font.conf b/staging/linux-x86/jre/lib/fonts/font.conf
new file mode 100644
index 0000000..adbc1ca
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/font.conf
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+ <match target="font">
+ <test name="family" qual="all" compare="not_eq">
+ <string>Consolas</string>
+ </test>
+ <test name="family" qual="all" compare="not_eq">
+ <string>Noto Sans Mono CJK JP</string>
+ </test>
+ <test name="size" qual="any" compare="less">
+ <double>12</double>
+ </test>
+ <test name="weight" compare="less">
+ <const>medium</const>
+ </test>
+ <edit mode="assign" name="hintstyle">
+ <const>hintfull</const>
+ </edit>
+ </match>
+</fontconfig>
+
diff --git a/staging/linux-x86/jre/lib/fonts/fonts.dir b/staging/linux-x86/jre/lib/fonts/fonts.dir
new file mode 100644
index 0000000..1344314
--- /dev/null
+++ b/staging/linux-x86/jre/lib/fonts/fonts.dir
@@ -0,0 +1,170 @@
+169
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-ascii-0
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-e
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-r
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-u
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSans-Bold.ttf -misc-droid sans-bold-r-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-ascii-0
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-e
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-r
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-u
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSans.ttf -misc-droid sans-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-adobe-standard
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-ascii-0
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso10646-1
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-1
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-10
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-13
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-15
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-16
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-2
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-3
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-4
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-5
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-iso8859-9
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-e
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-r
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-ru
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-u
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-koi8-uni
+DroidSansMono.ttf -misc-droid sans mono-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-adobe-standard
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-ascii-0
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso10646-1
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-1
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-10
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-13
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-15
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-2
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-3
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-4
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-5
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-iso8859-9
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-e
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-r
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-ru
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-u
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-koi8-uni
+DroidSansMonoDotted.ttf -misc-droid sans mono dotted-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-adobe-standard
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-ascii-0
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso10646-1
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-1
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-10
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-13
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-15
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-2
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-3
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-4
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-5
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-iso8859-9
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-e
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-r
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-ru
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-u
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-koi8-uni
+DroidSansMonoSlashed.ttf -misc-droid sans mono slashed-medium-r-normal--0-0-0-0-m-0-microsoft-cp1252
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-Bold.ttf -misc-droid serif-bold-r-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-BoldItalic.ttf -misc-droid serif-bold-i-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-Italic.ttf -misc-droid serif-medium-i-normal--0-0-0-0-p-0-microsoft-cp1252
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-adobe-standard
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-ascii-0
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso10646-1
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-1
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-10
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-13
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-15
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-16
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-2
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-3
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-4
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-5
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-iso8859-9
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-e
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-r
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-ru
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-u
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-koi8-uni
+DroidSerif-Regular.ttf -misc-droid serif-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
diff --git a/staging/linux-x86/jre/lib/hijrah-config-umalqura.properties b/staging/linux-x86/jre/lib/hijrah-config-umalqura.properties
new file mode 100644
index 0000000..1786c14
--- /dev/null
+++ b/staging/linux-x86/jre/lib/hijrah-config-umalqura.properties
@@ -0,0 +1,369 @@
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+# This properties file defines a Hijrah calendar variant.
+#
+# Fields:
+#
+# <version> ::= 'version' '=' <version string>
+# <id> ::= 'id' '=' <id string>
+# <type> ::= 'type' '=' <type string>
+# <iso-start> ::= 'iso-start' '=' <start date in the ISO calendar>
+# <year> ::= <yyyy> '=' <nn nn nn nn nn nn nn nn nn nn nn nn>
+#
+# version ... (Required)
+#
+# id ... (Required)
+# Identifies the Java Chronology
+#
+# type ... (Required)
+# Identifies the type of calendar in the standard calendar ID scheme
+# iso-start ... (Required)
+# Specifies the corresponding ISO date to the first Hijrah day
+# in the defined range of dates
+#
+# year ... (Required)
+# Number of days for each month of a Hijrah year
+# * Each line defines a year. The years must be in chronological
+# order and no gap is allowed.
+# * Each line is in the form indicated above. <yyyy> is a Hijrah year and
+# nn is the number of days for a month listed in the order of the months.
+# * Each year must have 12 months.
+# * Each month should be 29 or 30 days long.
+# * There must be one or more space characters between the months.
+#
+
+# Version of this definition
+version=1.8.0_1
+
+# Java chronology ID
+id=Hijrah-umalqura
+
+# Standard calendar type specification
+type=islamic-umalqura
+
+# defines the corresponding ISO date to the earliest Hijrah date
+iso-start=1882-11-12
+
+# 1 2 3 4 5 6 7 8 9 10 11 12
+1300=30 29 30 29 30 29 30 29 30 29 30 29
+1301=30 30 29 30 29 30 29 30 29 30 29 29
+1302=30 30 30 29 30 30 29 29 30 29 29 30
+1303=29 30 30 29 30 30 29 30 29 30 29 29
+1304=29 30 30 29 30 30 30 29 30 29 30 29
+1305=29 29 30 30 29 30 30 29 30 30 29 29
+1306=30 29 30 29 30 29 30 29 30 30 29 30
+1307=29 30 29 30 29 30 29 30 29 30 29 30
+1308=29 30 30 29 30 29 30 29 30 29 29 30
+1309=29 30 30 30 30 29 29 30 29 29 30 29
+1310=30 29 30 30 30 29 30 29 30 29 29 30
+1311=29 30 29 30 30 30 29 30 29 30 29 29
+1312=30 29 30 29 30 30 29 30 30 29 30 29
+1313=29 30 29 30 29 30 29 30 30 30 29 29
+1314=30 30 29 30 29 29 30 29 30 30 29 30
+1315=29 30 30 29 30 29 29 30 29 30 29 30
+1316=29 30 30 30 29 30 29 29 30 29 30 29
+1317=30 29 30 30 29 30 29 30 29 30 29 29
+1318=30 29 30 30 29 30 30 29 30 29 30 29
+1319=29 30 29 30 30 29 30 29 30 30 29 30
+1320=29 30 29 29 30 29 30 29 30 30 30 29
+1321=30 29 30 29 29 30 29 29 30 30 30 30
+1322=29 30 29 30 29 29 29 30 29 30 30 30
+1323=29 30 30 29 30 29 29 29 30 29 30 30
+1324=29 30 30 29 30 29 30 29 29 30 29 30
+1325=30 29 30 29 30 30 29 30 29 30 29 30
+1326=29 29 30 29 30 30 29 30 29 30 30 29
+1327=30 29 29 30 29 30 29 30 30 29 30 30
+1328=29 30 29 29 30 29 29 30 30 30 29 30
+1329=30 29 30 29 29 30 29 29 30 30 29 30
+1330=30 30 29 30 29 29 30 29 29 30 30 29
+1331=30 30 29 30 30 29 29 30 29 30 29 30
+1332=29 30 29 30 30 29 30 29 30 30 29 29
+1333=30 29 29 30 30 29 30 30 29 30 30 29
+1334=29 29 30 29 30 29 30 30 30 29 30 29
+1335=30 29 30 29 29 30 29 30 30 29 30 30
+1336=29 30 29 30 29 29 30 29 30 29 30 30
+1337=30 29 30 29 30 29 29 30 29 30 29 30
+1338=29 30 30 29 30 30 29 29 30 29 30 29
+1339=30 29 30 29 30 30 30 29 30 29 29 30
+1340=29 29 30 29 30 30 30 30 29 30 29 29
+1341=30 29 29 30 29 30 30 30 29 30 30 29
+1342=29 29 30 29 30 29 30 30 29 30 30 29
+1343=30 29 29 30 29 30 29 30 29 30 30 29
+1344=30 29 30 29 30 30 29 29 30 29 30 29
+1345=30 29 30 30 30 29 30 29 29 30 29 29
+1346=30 29 30 30 30 30 29 30 29 29 30 29
+1347=29 30 29 30 30 30 29 30 30 29 29 30
+1348=29 29 30 29 30 30 29 30 30 30 29 29
+1349=30 29 29 30 29 30 30 29 30 30 29 30
+1350=29 30 29 30 29 30 29 29 30 30 29 30
+1351=30 29 30 29 30 29 30 29 29 30 29 30
+1352=30 29 30 30 29 30 29 30 29 29 30 29
+1353=30 29 30 30 30 29 30 29 29 30 29 30
+1354=29 30 29 30 30 29 30 30 29 30 29 29
+1355=30 29 29 30 30 29 30 30 29 30 30 29
+1356=29 30 29 30 29 30 29 30 29 30 30 30
+1357=29 29 30 29 30 29 29 30 29 30 30 30
+1358=29 30 29 30 29 30 29 29 30 29 30 30
+1359=29 30 30 29 30 29 30 29 29 29 30 30
+1360=29 30 30 30 29 30 29 30 29 29 30 29
+1361=30 29 30 30 29 30 30 29 29 30 29 30
+1362=29 30 29 30 29 30 30 29 30 29 30 29
+1363=30 29 30 29 30 29 30 29 30 29 30 30
+1364=29 30 29 30 29 29 30 29 30 29 30 30
+1365=30 30 29 29 30 29 29 30 29 30 29 30
+1366=30 30 29 30 29 30 29 29 30 29 30 29
+1367=30 30 29 30 30 29 30 29 29 30 29 30
+1368=29 30 29 30 30 30 29 29 30 29 30 29
+1369=30 29 30 29 30 30 29 30 29 30 30 29
+1370=30 29 29 30 29 30 29 30 29 30 30 30
+1371=29 30 29 29 30 29 30 29 30 29 30 30
+1372=30 29 29 30 29 30 29 29 30 29 30 30
+1373=30 29 30 29 30 29 30 29 29 30 29 30
+1374=30 29 30 30 29 30 29 30 29 29 30 29
+1375=30 29 30 30 29 30 30 29 30 29 30 29
+1376=29 30 29 30 29 30 30 30 29 30 29 30
+1377=29 29 30 29 29 30 30 30 29 30 30 29
+1378=30 29 29 29 30 29 30 30 29 30 30 30
+1379=29 30 29 29 29 30 29 30 30 29 30 30
+1380=29 30 29 30 29 30 29 30 29 30 29 30
+1381=29 30 29 30 30 29 30 29 30 29 29 30
+1382=29 30 29 30 30 29 30 30 29 30 29 29
+1383=30 29 29 30 30 30 29 30 30 29 30 29
+1384=29 30 29 29 30 30 29 30 30 30 29 30
+1385=29 29 30 29 29 30 30 29 30 30 30 29
+1386=30 29 29 30 29 29 30 30 29 30 30 29
+1387=30 29 30 29 30 29 30 29 30 29 30 29
+1388=30 30 29 30 29 30 29 30 29 30 29 29
+1389=30 30 29 30 30 29 30 30 29 29 30 29
+1390=29 30 29 30 30 30 29 30 29 30 29 30
+1391=29 29 30 29 30 30 29 30 30 29 30 29
+1392=30 29 29 30 29 30 29 30 30 29 30 30
+1393=29 30 29 29 30 29 30 29 30 29 30 30
+1394=30 29 30 29 29 30 29 30 29 30 29 30
+1395=30 29 30 30 29 30 29 29 30 29 29 30
+1396=30 29 30 30 29 30 30 29 29 30 29 29
+1397=30 29 30 30 29 30 30 30 29 29 29 30
+1398=29 30 29 30 30 29 30 30 29 30 29 29
+1399=30 29 30 29 30 29 30 30 29 30 29 30
+1400=30 29 30 29 29 30 29 30 29 30 29 30
+1401=30 30 29 30 29 29 30 29 29 30 29 30
+1402=30 30 30 29 30 29 29 30 29 29 30 29
+1403=30 30 30 29 30 30 29 29 30 29 29 30
+1404=29 30 30 29 30 30 29 30 29 30 29 29
+1405=30 29 30 29 30 30 30 29 30 29 29 30
+1406=30 29 29 30 29 30 30 29 30 29 30 30
+1407=29 30 29 29 30 29 30 29 30 29 30 30
+1408=30 29 30 29 30 29 29 30 29 29 30 30
+1409=30 30 29 30 29 30 29 29 30 29 29 30
+1410=30 30 29 30 30 29 30 29 29 30 29 29
+1411=30 30 29 30 30 29 30 30 29 29 30 29
+1412=30 29 30 29 30 29 30 30 30 29 29 30
+1413=29 30 29 29 30 29 30 30 30 29 30 29
+1414=30 29 30 29 29 30 29 30 30 29 30 30
+1415=29 30 29 30 29 29 30 29 30 29 30 30
+1416=30 29 30 29 30 29 29 30 29 30 29 30
+1417=30 29 30 30 29 29 30 29 30 29 30 29
+1418=30 29 30 30 29 30 29 30 29 30 29 30
+1419=29 30 29 30 29 30 29 30 30 30 29 29
+1420=29 30 29 29 30 29 30 30 30 30 29 30
+1421=29 29 30 29 29 29 30 30 30 30 29 30
+1422=30 29 29 30 29 29 29 30 30 30 29 30
+1423=30 29 30 29 30 29 29 30 29 30 29 30
+1424=30 29 30 30 29 30 29 29 30 29 30 29
+1425=30 29 30 30 29 30 29 30 30 29 30 29
+1426=29 30 29 30 29 30 30 29 30 30 29 30
+1427=29 29 30 29 30 29 30 30 29 30 30 29
+1428=30 29 29 30 29 29 30 30 30 29 30 30
+1429=29 30 29 29 30 29 29 30 30 29 30 30
+1430=29 30 30 29 29 30 29 30 29 30 29 30
+1431=29 30 30 29 30 29 30 29 30 29 29 30
+1432=29 30 30 30 29 30 29 30 29 30 29 29
+1433=30 29 30 30 29 30 30 29 30 29 30 29
+1434=29 30 29 30 29 30 30 29 30 30 29 29
+1435=30 29 30 29 30 29 30 29 30 30 29 30
+1436=29 30 29 30 29 30 29 30 29 30 29 30
+1437=30 29 30 30 29 29 30 29 30 29 29 30
+1438=30 29 30 30 30 29 29 30 29 29 30 29
+1439=30 29 30 30 30 29 30 29 30 29 29 30
+1440=29 30 29 30 30 30 29 30 29 30 29 29
+1441=30 29 30 29 30 30 29 30 30 29 30 29
+1442=29 30 29 30 29 30 29 30 30 29 30 29
+1443=30 29 30 29 30 29 30 29 30 29 30 30
+1444=29 30 29 30 30 29 29 30 29 30 29 30
+1445=29 30 30 30 29 30 29 29 30 29 29 30
+1446=29 30 30 30 29 30 30 29 29 30 29 29
+1447=30 29 30 30 30 29 30 29 30 29 30 29
+1448=29 30 29 30 30 29 30 30 29 30 29 30
+1449=29 29 30 29 30 29 30 30 29 30 30 29
+1450=30 29 30 29 29 30 29 30 29 30 30 29
+1451=30 30 30 29 29 30 29 29 30 30 29 30
+1452=30 29 30 30 29 29 30 29 29 30 29 30
+1453=30 29 30 30 29 30 29 30 29 29 30 29
+1454=30 29 30 30 29 30 30 29 30 29 30 29
+1455=29 30 29 30 30 29 30 29 30 30 29 30
+1456=29 29 30 29 30 29 30 29 30 30 30 29
+1457=30 29 29 30 29 29 30 29 30 30 30 30
+1458=29 30 29 29 30 29 29 30 29 30 30 30
+1459=29 30 30 29 29 30 29 29 30 29 30 30
+1460=29 30 30 29 30 29 30 29 29 30 29 30
+1461=29 30 30 29 30 29 30 29 30 30 29 29
+1462=30 29 30 29 30 30 29 30 29 30 30 29
+1463=29 30 29 30 29 30 29 30 30 30 29 30
+1464=29 30 29 29 30 29 29 30 30 30 29 30
+1465=30 29 30 29 29 30 29 29 30 30 29 30
+1466=30 30 29 30 29 29 29 30 29 30 30 29
+1467=30 30 29 30 30 29 29 30 29 30 29 30
+1468=29 30 29 30 30 29 30 29 30 29 30 29
+1469=29 30 29 30 30 29 30 30 29 30 29 30
+1470=29 29 30 29 30 30 29 30 30 29 30 29
+1471=30 29 29 30 29 30 29 30 30 29 30 30
+1472=29 30 29 29 30 29 30 29 30 30 29 30
+1473=29 30 29 30 30 29 29 30 29 30 29 30
+1474=29 30 30 29 30 30 29 29 30 29 30 29
+1475=29 30 30 29 30 30 30 29 29 30 29 29
+1476=30 29 30 29 30 30 30 29 30 29 30 29
+1477=29 30 29 29 30 30 30 30 29 30 29 30
+1478=29 29 30 29 30 29 30 30 29 30 30 29
+1479=30 29 29 30 29 30 29 30 29 30 30 29
+1480=30 29 30 29 30 29 30 29 30 29 30 29
+1481=30 29 30 30 29 30 29 30 29 30 29 29
+1482=30 29 30 30 30 30 29 30 29 29 30 29
+1483=29 30 29 30 30 30 29 30 30 29 29 30
+1484=29 29 30 29 30 30 30 29 30 29 30 29
+1485=30 29 29 30 29 30 30 29 30 30 29 30
+1486=29 30 29 29 30 29 30 29 30 30 29 30
+1487=30 29 30 29 30 29 29 30 29 30 29 30
+1488=30 29 30 30 29 30 29 29 30 29 30 29
+1489=30 29 30 30 30 29 30 29 29 30 29 30
+1490=29 30 29 30 30 29 30 30 29 29 30 29
+1491=30 29 29 30 30 29 30 30 29 30 29 30
+1492=29 30 29 29 30 30 29 30 29 30 30 29
+1493=30 29 30 29 30 29 29 30 29 30 30 30
+1494=29 30 29 30 29 30 29 29 29 30 30 30
+1495=29 30 30 29 30 29 29 30 29 29 30 30
+1496=29 30 30 30 29 30 29 29 30 29 29 30
+1497=30 29 30 30 29 30 29 30 29 30 29 30
+1498=29 30 29 30 29 30 30 29 30 29 30 29
+1499=30 29 30 29 29 30 30 29 30 29 30 30
+1500=29 30 29 30 29 29 30 29 30 29 30 30
+1501=30 29 30 29 30 29 29 29 30 29 30 30
+1502=30 30 29 30 29 30 29 29 29 30 30 29
+1503=30 30 29 30 30 29 30 29 29 29 30 30
+1504=29 30 29 30 30 30 29 29 30 29 30 29
+1505=30 29 30 29 30 30 29 30 29 30 30 29
+1506=29 30 29 29 30 30 29 30 30 29 30 30
+1507=29 29 30 29 29 30 30 29 30 29 30 30
+1508=30 29 29 30 29 30 29 29 30 29 30 30
+1509=30 29 30 29 30 29 30 29 29 30 29 30
+1510=30 29 30 30 29 30 29 30 29 29 30 29
+1511=30 29 30 30 29 30 30 29 30 29 29 30
+1512=29 30 29 30 29 30 30 30 29 30 29 30
+1513=29 29 29 30 29 30 30 30 29 30 30 29
+1514=30 29 29 29 30 29 30 30 29 30 30 30
+1515=29 29 30 29 29 30 29 30 30 29 30 30
+1516=29 30 29 30 29 29 30 29 30 29 30 30
+1517=29 30 29 30 29 30 30 29 29 30 29 30
+1518=29 30 29 30 30 29 30 30 29 30 29 29
+1519=30 29 29 30 30 30 29 30 30 29 30 29
+1520=29 30 29 29 30 30 30 29 30 30 29 30
+1521=29 29 29 30 29 30 30 29 30 30 29 30
+1522=30 29 29 29 30 29 30 30 29 30 30 29
+1523=30 29 30 29 30 29 30 29 29 30 30 29
+1524=30 30 29 30 29 30 29 30 29 29 30 29
+1525=30 30 29 30 30 29 30 29 30 29 29 30
+1526=29 30 29 30 30 30 29 30 29 30 29 29
+1527=30 29 30 29 30 30 29 30 30 29 30 29
+1528=30 29 29 30 29 30 29 30 30 29 30 30
+1529=29 30 29 29 30 29 30 29 30 29 30 30
+1530=29 30 30 29 29 30 29 30 29 29 30 30
+1531=29 30 30 30 29 29 30 29 30 29 29 30
+1532=29 30 30 30 29 30 30 29 29 29 30 29
+1533=30 29 30 30 30 29 30 29 30 29 29 30
+1534=29 30 29 30 30 29 30 30 29 29 30 29
+1535=30 29 30 29 30 29 30 30 29 30 29 30
+1536=29 30 29 30 29 30 29 30 29 30 29 30
+1537=30 29 30 30 29 29 30 29 29 30 29 30
+1538=30 30 29 30 30 29 29 30 29 29 30 29
+1539=30 30 30 29 30 30 29 29 30 29 29 30
+1540=29 30 30 29 30 30 29 30 29 29 30 29
+1541=30 29 30 29 30 30 30 29 30 29 29 30
+1542=29 30 29 30 29 30 30 29 30 29 30 30
+1543=29 30 29 29 30 29 30 29 30 29 30 30
+1544=30 29 30 29 29 30 29 30 29 30 29 30
+1545=30 30 29 30 29 29 30 29 30 29 29 30
+1546=30 30 29 30 29 30 29 30 29 30 29 29
+1547=30 30 29 30 30 29 30 29 30 29 30 29
+1548=30 29 29 30 30 29 30 30 29 30 29 30
+1549=29 30 29 29 30 29 30 30 30 29 30 29
+1550=30 29 30 29 29 29 30 30 30 29 30 30
+1551=29 30 29 29 30 29 29 30 30 29 30 30
+1552=30 29 30 29 29 30 29 29 30 30 29 30
+1553=30 29 30 29 30 29 30 29 30 29 30 29
+1554=30 29 30 29 30 30 29 30 29 30 29 30
+1555=29 29 30 29 30 30 29 30 30 29 30 29
+1556=30 29 29 30 29 30 29 30 30 30 29 30
+1557=29 30 29 29 29 30 29 30 30 30 30 29
+1558=30 29 30 29 29 29 30 29 30 30 30 29
+1559=30 30 29 29 30 29 29 30 30 29 30 29
+1560=30 30 29 30 29 30 29 30 29 30 29 30
+1561=29 30 30 29 30 29 30 30 29 29 30 29
+1562=29 30 30 29 30 29 30 30 30 29 29 30
+1563=29 30 29 29 30 29 30 30 30 29 30 29
+1564=30 29 30 29 29 30 29 30 30 30 29 30
+1565=29 30 29 30 29 29 30 29 30 30 29 30
+1566=30 29 30 29 30 29 29 30 29 30 29 30
+1567=30 29 30 30 29 30 29 30 29 29 30 29
+1568=30 29 30 30 30 29 30 29 30 29 29 29
+1569=30 29 30 30 30 29 30 30 29 30 29 29
+1570=29 30 29 30 30 29 30 30 30 29 29 30
+1571=29 29 30 29 30 30 29 30 30 29 30 29
+1572=30 29 29 30 29 30 29 30 30 29 30 29
+1573=30 29 30 30 29 30 29 29 30 29 30 29
+1574=30 30 29 30 30 29 30 29 29 30 29 29
+1575=30 30 30 29 30 30 29 30 29 29 29 30
+1576=29 30 30 29 30 30 30 29 30 29 29 29
+1577=30 29 30 30 29 30 30 29 30 29 30 29
+1578=29 30 29 30 29 30 30 29 30 30 29 30
+1579=29 30 29 30 29 29 30 30 29 30 29 30
+1580=29 30 30 29 30 29 29 30 29 30 29 30
+1581=30 30 29 30 29 30 29 29 30 29 30 29
+1582=30 30 29 30 30 29 30 29 30 29 29 29
+1583=30 30 29 30 30 30 29 30 29 30 29 29
+1584=29 30 30 29 30 30 29 30 30 29 30 29
+1585=29 30 29 30 29 30 29 30 30 29 30 30
+1586=29 29 30 29 30 29 29 30 30 30 29 30
+1587=29 30 30 29 29 29 30 29 30 29 30 30
+1588=30 29 30 30 29 29 29 30 29 30 29 30
+1589=30 29 30 30 29 30 29 29 30 29 30 29
+1590=30 29 30 30 30 29 29 30 29 30 29 30
+1591=29 30 29 30 30 29 30 29 30 29 30 29
+1592=30 29 30 29 30 29 30 29 30 30 30 29
+1593=30 29 29 30 29 29 30 29 30 30 30 29
+1594=30 30 29 29 30 29 29 29 30 30 30 30
+1595=29 30 29 30 29 29 30 29 29 30 30 30
+1596=29 30 30 29 30 29 29 30 29 30 29 30
+1597=29 30 30 29 30 29 30 29 30 29 30 29
+1598=30 29 30 29 30 30 29 30 29 30 30 29
+1599=29 30 29 30 29 30 29 30 30 30 29 30
+1600=29 29 30 29 30 29 29 30 30 30 29 30
diff --git a/staging/linux-x86/jre/lib/images/cursors/cursors.properties b/staging/linux-x86/jre/lib/images/cursors/cursors.properties
new file mode 100644
index 0000000..30e9f90
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/cursors.properties
@@ -0,0 +1,40 @@
+#
+#
+# Cursors Properties file
+#
+# Names GIF89 sources for Custom Cursors and their associated HotSpots
+#
+# Note: the syntax of the property name is significant and is parsed
+# by java.awt.Cursor
+#
+# The syntax is: Cursor.<name>.<geom>.File=<filename>
+# Cursor.<name>.<geom>.HotSpot=<x>,<y>
+# Cursor.<name>.<geom>.Name=<localized name>
+#
+Cursor.CopyDrop.32x32.File=motif_CopyDrop32x32.gif
+Cursor.CopyDrop.32x32.HotSpot=0,0
+Cursor.CopyDrop.32x32.Name=CopyDrop32x32
+#
+Cursor.MoveDrop.32x32.File=motif_MoveDrop32x32.gif
+Cursor.MoveDrop.32x32.HotSpot=0,0
+Cursor.MoveDrop.32x32.Name=MoveDrop32x32
+#
+Cursor.LinkDrop.32x32.File=motif_LinkDrop32x32.gif
+Cursor.LinkDrop.32x32.HotSpot=0,0
+Cursor.LinkDrop.32x32.Name=LinkDrop32x32
+#
+Cursor.CopyNoDrop.32x32.File=motif_CopyNoDrop32x32.gif
+Cursor.CopyNoDrop.32x32.HotSpot=6,2
+Cursor.CopyNoDrop.32x32.Name=CopyNoDrop32x32
+#
+Cursor.MoveNoDrop.32x32.File=motif_MoveNoDrop32x32.gif
+Cursor.MoveNoDrop.32x32.HotSpot=6,2
+Cursor.MoveNoDrop.32x32.Name=MoveNoDrop32x32
+#
+Cursor.LinkNoDrop.32x32.File=motif_LinkNoDrop32x32.gif
+Cursor.LinkNoDrop.32x32.HotSpot=6,2
+Cursor.LinkNoDrop.32x32.Name=LinkNoDrop32x32
+#
+Cursor.Invalid.32x32.File=invalid32x32.gif
+Cursor.Invalid.32x32.HotSpot=6,2
+Cursor.Invalid.32x32.Name=Invalid32x32
diff --git a/staging/linux-x86/jre/lib/images/cursors/invalid32x32.gif b/staging/linux-x86/jre/lib/images/cursors/invalid32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/invalid32x32.gif
Binary files differ
diff --git a/staging/linux-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gif b/staging/linux-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gif
new file mode 100644
index 0000000..a9ec247
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/motif_CopyDrop32x32.gif
Binary files differ
diff --git a/staging/linux-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gif b/staging/linux-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/motif_CopyNoDrop32x32.gif
Binary files differ
diff --git a/staging/linux-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gif b/staging/linux-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gif
new file mode 100644
index 0000000..10c84c1
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/motif_LinkDrop32x32.gif
Binary files differ
diff --git a/staging/linux-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gif b/staging/linux-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/motif_LinkNoDrop32x32.gif
Binary files differ
diff --git a/staging/linux-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gif b/staging/linux-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gif
new file mode 100644
index 0000000..8304aa0
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/motif_MoveDrop32x32.gif
Binary files differ
diff --git a/staging/linux-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gif b/staging/linux-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gif
new file mode 100644
index 0000000..64c265d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/images/cursors/motif_MoveNoDrop32x32.gif
Binary files differ
diff --git a/staging/linux-x86/jre/lib/jce.jar b/staging/linux-x86/jre/lib/jce.jar
new file mode 100644
index 0000000..16eb259
--- /dev/null
+++ b/staging/linux-x86/jre/lib/jce.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/jexec b/staging/linux-x86/jre/lib/jexec
new file mode 100755
index 0000000..481e6fa
--- /dev/null
+++ b/staging/linux-x86/jre/lib/jexec
Binary files differ
diff --git a/staging/linux-x86/jre/lib/jsse.jar b/staging/linux-x86/jre/lib/jsse.jar
new file mode 100644
index 0000000..eb0a1b8
--- /dev/null
+++ b/staging/linux-x86/jre/lib/jsse.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/jvm.hprof.txt b/staging/linux-x86/jre/lib/jvm.hprof.txt
new file mode 100644
index 0000000..3c8e5fc
--- /dev/null
+++ b/staging/linux-x86/jre/lib/jvm.hprof.txt
@@ -0,0 +1,86 @@
+Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS 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.
+
+
+Header for -agentlib:hprof (or -Xrunhprof) ASCII Output (JDK 5.0 JVMTI based)
+
+WARNING! This file format is under development, and is subject to
+change without notice.
+
+This file contains the following types of records:
+
+THREAD START
+THREAD END mark the lifetime of Java threads
+
+TRACE represents a Java stack trace. Each trace consists
+ of a series of stack frames. Other records refer to
+ TRACEs to identify (1) where object allocations have
+ taken place, (2) the frames in which GC roots were
+ found, and (3) frequently executed methods.
+
+HEAP DUMP is a complete snapshot of all live objects in the Java
+ heap. Following distinctions are made:
+
+ ROOT root set as determined by GC
+ CLS classes
+ OBJ instances
+ ARR arrays
+
+SITES is a sorted list of allocation sites. This identifies
+ the most heavily allocated object types, and the TRACE
+ at which those allocations occurred.
+
+CPU SAMPLES is a statistical profile of program execution. The VM
+ periodically samples all running threads, and assigns
+ a quantum to active TRACEs in those threads. Entries
+ in this record are TRACEs ranked by the percentage of
+ total quanta they consumed; top-ranked TRACEs are
+ typically hot spots in the program.
+
+CPU TIME is a profile of program execution obtained by measuring
+ the time spent in individual methods (excluding the time
+ spent in callees), as well as by counting the number of
+ times each method is called. Entries in this record are
+ TRACEs ranked by the percentage of total CPU time. The
+ "count" field indicates the number of times each TRACE
+ is invoked.
+
+MONITOR TIME is a profile of monitor contention obtained by measuring
+ the time spent by a thread waiting to enter a monitor.
+ Entries in this record are TRACEs ranked by the percentage
+ of total monitor contention time and a brief description
+ of the monitor. The "count" field indicates the number of
+ times the monitor was contended at that TRACE.
+
+MONITOR DUMP is a complete snapshot of all the monitors and threads in
+ the System.
+
+HEAP DUMP, SITES, CPU SAMPLES|TIME and MONITOR DUMP|TIME records are generated
+at program exit. They can also be obtained during program execution by typing
+Ctrl-\ (on Solaris) or by typing Ctrl-Break (on Win32).
diff --git a/staging/linux-x86/jre/lib/logging.properties b/staging/linux-x86/jre/lib/logging.properties
new file mode 100644
index 0000000..65cf1b1
--- /dev/null
+++ b/staging/linux-x86/jre/lib/logging.properties
@@ -0,0 +1,59 @@
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to INFO and above.
+java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# Example to customize the SimpleFormatter output format
+# to print one-line log message like this:
+# <level>: <log message> [<date/time>]
+#
+# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+com.xyz.foo.level = SEVERE
diff --git a/staging/linux-x86/jre/lib/management-agent.jar b/staging/linux-x86/jre/lib/management-agent.jar
new file mode 100644
index 0000000..a7ed334
--- /dev/null
+++ b/staging/linux-x86/jre/lib/management-agent.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/management/jmxremote.access b/staging/linux-x86/jre/lib/management/jmxremote.access
new file mode 100644
index 0000000..ce80b47
--- /dev/null
+++ b/staging/linux-x86/jre/lib/management/jmxremote.access
@@ -0,0 +1,79 @@
+######################################################################
+# Default Access Control File for Remote JMX(TM) Monitoring
+######################################################################
+#
+# Access control file for Remote JMX API access to monitoring.
+# This file defines the allowed access for different roles. The
+# password file (jmxremote.password by default) defines the roles and their
+# passwords. To be functional, a role must have an entry in
+# both the password and the access files.
+#
+# The default location of this file is $JRE/lib/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# (See that file for details)
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# A typical access file has multiple lines, where each line is blank,
+# a comment (like this one), or an access control entry.
+#
+# An access control entry consists of a role name, and an
+# associated access level. The role name is any string that does not
+# itself contain spaces or tabs. It corresponds to an entry in the
+# password file (jmxremote.password). The access level is one of the
+# following:
+# "readonly" grants access to read attributes of MBeans.
+# For monitoring, this means that a remote client in this
+# role can read measurements but cannot perform any action
+# that changes the environment of the running program.
+# "readwrite" grants access to read and write attributes of MBeans,
+# to invoke operations on them, and optionally
+# to create or remove them. This access should be granted
+# only to trusted clients, since they can potentially
+# interfere with the smooth operation of a running program.
+#
+# The "readwrite" access level can optionally be followed by the "create" and/or
+# "unregister" keywords. The "unregister" keyword grants access to unregister
+# (delete) MBeans. The "create" keyword grants access to create MBeans of a
+# particular class or of any class matching a particular pattern. Access
+# should only be granted to create MBeans of known and trusted classes.
+#
+# For example, the following entry would grant readwrite access
+# to "controlRole", as well as access to create MBeans of the class
+# javax.management.monitor.CounterMonitor and to unregister any MBean:
+# controlRole readwrite \
+# create javax.management.monitor.CounterMonitorMBean \
+# unregister
+# or equivalently:
+# controlRole readwrite unregister create javax.management.monitor.CounterMBean
+#
+# The following entry would grant readwrite access as well as access to create
+# MBeans of any class in the packages javax.management.monitor and
+# javax.management.timer:
+# controlRole readwrite \
+# create javax.management.monitor.*,javax.management.timer.* \
+# unregister
+#
+# The \ character is defined in the Properties file syntax to allow continuation
+# lines as shown here. A * in a class pattern matches a sequence of characters
+# other than dot (.), so javax.management.monitor.* matches
+# javax.management.monitor.CounterMonitor but not
+# javax.management.monitor.foo.Bar.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last
+# access entry is used.
+#
+#
+# Default access control entries:
+# o The "monitorRole" role has readonly access.
+# o The "controlRole" role has readwrite access and can create the standard
+# Timer and Monitor MBeans defined by the JMX API.
+
+monitorRole readonly
+controlRole readwrite \
+ create javax.management.monitor.*,javax.management.timer.* \
+ unregister
diff --git a/staging/linux-x86/jre/lib/management/jmxremote.password.template b/staging/linux-x86/jre/lib/management/jmxremote.password.template
new file mode 100644
index 0000000..a7e7daa
--- /dev/null
+++ b/staging/linux-x86/jre/lib/management/jmxremote.password.template
@@ -0,0 +1,64 @@
+# ----------------------------------------------------------------------
+# Template for jmxremote.password
+#
+# o Copy this template to jmxremote.password
+# o Set the user/password entries in jmxremote.password
+# o Change the permission of jmxremote.password to read-only
+# by the owner.
+#
+# See below for the location of jmxremote.password file.
+# ----------------------------------------------------------------------
+
+##############################################################
+# Password File for Remote JMX Monitoring
+##############################################################
+#
+# Password file for Remote JMX API access to monitoring. This
+# file defines the different roles and their passwords. The access
+# control file (jmxremote.access by default) defines the allowed
+# access for each role. To be functional, a role must have an entry
+# in both the password and the access files.
+#
+# Default location of this file is $JRE/lib/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# or by specifying a system property (See that file for details).
+
+
+##############################################################
+# File permissions of the jmxremote.password file
+##############################################################
+# Since there are cleartext passwords stored in this file,
+# this file must be readable by ONLY the owner,
+# otherwise the program will exit with an error.
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# Typical password file has multiple lines, where each line is blank,
+# a comment (like this one), or a password entry.
+#
+#
+# A password entry consists of a role name and an associated
+# password. The role name is any string that does not itself contain
+# spaces or tabs. The password is again any string that does not
+# contain spaces or tabs. Note that passwords appear in the clear in
+# this file, so it is a good idea not to use valuable passwords.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last one
+# is used.
+#
+# In a typical installation, this file can be read by anybody on the
+# local machine, and possibly by people on other machines.
+# For # security, you should either restrict the access to this file,
+# or specify another, less accessible file in the management config file
+# as described above.
+#
+# Following are two commented-out entries. The "measureRole" role has
+# password "QED". The "controlRole" role has password "R&D".
+#
+# monitorRole QED
+# controlRole R&D
+
diff --git a/staging/linux-x86/jre/lib/management/management.properties b/staging/linux-x86/jre/lib/management/management.properties
new file mode 100644
index 0000000..70efa2e
--- /dev/null
+++ b/staging/linux-x86/jre/lib/management/management.properties
@@ -0,0 +1,331 @@
+#####################################################################
+# Default Configuration File for Java Platform Management
+#####################################################################
+#
+# The Management Configuration file (in java.util.Properties format)
+# will be read if one of the following system properties is set:
+# -Dcom.sun.management.jmxremote.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.config.file=<this-file>
+#
+# The default Management Configuration file is:
+#
+# $JRE/lib/management/management.properties
+#
+# Another location for the Management Configuration File can be specified
+# by the following property on the Java command line:
+#
+# -Dcom.sun.management.config.file=<this-file>
+#
+# If -Dcom.sun.management.config.file=<this-file> is set, the port
+# number for the management agent can be specified in the config file
+# using the following lines:
+#
+# ################ Management Agent Port #########################
+#
+# For setting the JMX RMI agent port use the following line
+# com.sun.management.jmxremote.port=<port-number>
+#
+# For setting the SNMP agent port use the following line
+# com.sun.management.snmp.port=<port-number>
+
+#####################################################################
+# Optional Instrumentation
+#####################################################################
+#
+# By default only the basic instrumentation with low overhead is on.
+# The following properties allow to selectively turn on optional
+# instrumentation which are off by default and may have some
+# additional overhead.
+#
+# com.sun.management.enableThreadContentionMonitoring
+#
+# This option enables thread contention monitoring if the
+# Java virtual machine supports such instrumentation.
+# Refer to the specification for the java.lang.management.ThreadMBean
+# interface - see isThreadContentionMonitoringSupported() method.
+#
+
+# To enable thread contention monitoring, uncomment the following line
+# com.sun.management.enableThreadContentionMonitoring
+
+#####################################################################
+# SNMP Management Properties
+#####################################################################
+#
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# is set then
+# - The SNMP agent (with the Java virtual machine MIB) is started
+# that listens on the specified port for incoming SNMP requests.
+# - the following properties for read for SNMP management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to the above system property (e.g. via setProperty method), this
+# config file, or the ACL file has no effect to the running SNMP agent.
+#
+
+#
+# ##################### SNMP Trap Port #########################
+#
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+# Specifies the remote port number at which managers are expected
+# to listen for trap. For each host defined in the ACL file,
+# the SNMP agent will send traps at <host>:<trap-destination-port-number>
+# Default for this property is 162.
+#
+
+# To set port for sending traps to a different port use the following line
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+
+#
+# ################ SNMP listen interface #########################
+#
+# com.sun.management.snmp.interface=<InetAddress>
+# Specifies the local interface on which the SNMP agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+# Default for this property is "localhost".
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
+
+# For restricting the port on which SNMP agent listens use the following line
+# com.sun.management.snmp.interface=<InetAddress>
+
+#
+# #################### SNMP ACL file #########################
+#
+# com.sun.management.snmp.acl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then the ACL file
+# is not checked: all manager hosts are allowed all access.
+#
+
+# For SNMP without checking ACL file uncomment the following line
+# com.sun.management.snmp.acl=false
+
+#
+# com.sun.management.snmp.acl.file=filepath
+# Specifies location for ACL file
+# This is optional - default location is
+# $JRE/lib/management/snmp.acl
+#
+# If the property "com.sun.management.snmp.acl" is set to false,
+# then this property and the ACL file are ignored.
+# Otherwise the ACL file must exist and be in the valid format.
+# If the ACL file is empty or non existent then no access is allowed.
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
+# agents which read that ACL file at startup.
+#
+
+# For a non-default acl file location use the following line
+# com.sun.management.snmp.acl.file=filepath
+
+#####################################################################
+# RMI Management Properties
+#####################################################################
+#
+# If system property -Dcom.sun.management.jmxremote.port=<port-number>
+# is set then
+# - A MBean server is started
+# - JRE Platform MBeans are registered in the MBean server
+# - RMI connector is published in a private readonly registry at
+# specified port using a well known name, "jmxrmi"
+# - the following properties are read for JMX remote management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to above system property (e.g. via setProperty method),
+# this config file, the password file, or the access file have no effect to the
+# running MBean server, the connector, or the registry.
+#
+
+#
+# ########## RMI connector settings for local management ##########
+#
+# com.sun.management.jmxremote.local.only=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as true then the local JMX RMI connector
+# server will only accept connection requests from clients running on
+# the host where the out-of-the-box JMX management agent is running.
+# In order to ensure backwards compatibility this property could be
+# set to false. However, deploying the local management agent in this
+# way is discouraged because the local JMX RMI connector server will
+# accept connection requests from any client either local or remote.
+# For remote management the remote JMX RMI connector server should
+# be used instead with authentication and SSL/TLS encryption enabled.
+#
+
+# For allowing the local management agent accept local
+# and remote connection requests use the following line
+# com.sun.management.jmxremote.local.only=false
+
+#
+# ###################### RMI SSL #############################
+#
+# com.sun.management.jmxremote.ssl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then SSL is not used.
+#
+
+# For RMI monitoring without SSL use the following line
+# com.sun.management.jmxremote.ssl=false
+
+# com.sun.management.jmxremote.ssl.config.file=filepath
+# Specifies the location of the SSL configuration file. A properties
+# file can be used to supply the keystore and truststore location and
+# password settings thus avoiding to pass them as cleartext in the
+# command-line.
+#
+# The current implementation of the out-of-the-box management agent will
+# look up and use the properties specified below to configure the SSL
+# keystore and truststore, if present:
+# javax.net.ssl.keyStore=<keystore-location>
+# javax.net.ssl.keyStorePassword=<keystore-password>
+# javax.net.ssl.trustStore=<truststore-location>
+# javax.net.ssl.trustStorePassword=<truststore-password>
+# Any other properties in the file will be ignored. This will allow us
+# to extend the property set in the future if required by the default
+# SSL implementation.
+#
+# If the property "com.sun.management.jmxremote.ssl" is set to false,
+# then this property is ignored.
+#
+
+# For supplying the keystore settings in a file use the following line
+# com.sun.management.jmxremote.ssl.config.file=filepath
+
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites=<cipher-suites>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS cipher suites to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS cipher suites are enabled
+# for use by accepted connections. If this property is not specified then
+# the SSL/TLS RMI Server Socket Factory uses the SSL/TLS cipher suites that
+# are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.enabled.protocols=<protocol-versions>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS protocol versions to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS protocol versions are
+# enabled for use by accepted connections. If this property is not
+# specified then the SSL/TLS RMI Server Socket Factory uses the SSL/TLS
+# protocol versions that are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.need.client.auth=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true in conjunction with the previous
+# property "com.sun.management.jmxremote.ssl" then the SSL/TLS RMI Server
+# Socket Factory will require client authentication.
+#
+
+# For RMI monitoring with SSL client authentication use the following line
+# com.sun.management.jmxremote.ssl.need.client.auth=true
+
+# com.sun.management.jmxremote.registry.ssl=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true then the RMI registry used
+# to bind the RMIServer remote object is protected with SSL/TLS
+# RMI Socket Factories that can be configured with the properties:
+# com.sun.management.jmxremote.ssl.config.file
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites
+# com.sun.management.jmxremote.ssl.enabled.protocols
+# com.sun.management.jmxremote.ssl.need.client.auth
+# If the two properties below are true at the same time, i.e.
+# com.sun.management.jmxremote.ssl=true
+# com.sun.management.jmxremote.registry.ssl=true
+# then the RMIServer remote object and the RMI registry are
+# both exported with the same SSL/TLS RMI Socket Factories.
+#
+
+# For using an SSL/TLS protected RMI registry use the following line
+# com.sun.management.jmxremote.registry.ssl=true
+
+#
+# ################ RMI User authentication ################
+#
+# com.sun.management.jmxremote.authenticate=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then no authentication is
+# performed and all users are allowed all access.
+#
+
+# For RMI monitoring without any checking use the following line
+# com.sun.management.jmxremote.authenticate=false
+
+#
+# ################ RMI Login configuration ###################
+#
+# com.sun.management.jmxremote.login.config=<config-name>
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
+#
+# Setting this property is optional - the default login configuration
+# specifies a file-based authentication that uses the password file.
+#
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
+# by JAAS. In addition, the login module(s) specified in the configuration
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
+# javax.security.auth.callback package for more details.
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+#
+
+# For a non-default login configuration use the following line
+# com.sun.management.jmxremote.login.config=<config-name>
+
+#
+# ################ RMI Password file location ##################
+#
+# com.sun.management.jmxremote.password.file=filepath
+# Specifies location for password file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise the password file must exist and be in the valid format.
+# If the password file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+# com.sun.management.jmxremote.password.file=filepath
+
+#
+# ################ RMI Access file location #####################
+#
+# com.sun.management.jmxremote.access.file=filepath
+# Specifies location for access file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise, the access file must exist and be in the valid format.
+# If the access file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+# com.sun.management.jmxremote.access.file=filepath
+#
+
+# ################ Management agent listen interface #########################
+#
+# com.sun.management.jmxremote.host=<host-or-interface-name>
+# Specifies the local interface on which the JMX RMI agent will bind.
+# This is useful when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
diff --git a/staging/linux-x86/jre/lib/management/snmp.acl.template b/staging/linux-x86/jre/lib/management/snmp.acl.template
new file mode 100644
index 0000000..0e76676
--- /dev/null
+++ b/staging/linux-x86/jre/lib/management/snmp.acl.template
@@ -0,0 +1,110 @@
+# ----------------------------------------------------------------------
+# Template for SNMP Access Control List File
+#
+# o Copy this template to snmp.acl
+# o Set access control for SNMP support
+# o Change the permission of snmp.acl to be read-only
+# by the owner.
+#
+# See below for the location of snmp.acl file.
+# ----------------------------------------------------------------------
+
+############################################################
+# SNMP Access Control List File
+############################################################
+#
+# Default location of this file is $JRE/lib/management/snmp.acl.
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# or by specifying a system property (See that file for details).
+#
+
+
+##############################################################
+# File permissions of the snmp.acl file
+##############################################################
+#
+# Since there are cleartext community strings stored in this file,
+# this ACL file must be readable by ONLY the owner,
+# otherwise the program will exit with an error.
+#
+##############################################################
+# Format of the acl group
+##############################################################
+#
+# communities: a list of SNMP community strings to which the
+# access control applies separated by commas.
+#
+# access: either "read-only" or "read-write".
+#
+# managers: a list of hosts to be granted the access rights.
+# Each can be expressed as any one of the following:
+# - hostname: hubble
+# - ip v4 and v6 addresses: 123.456.789.12 , fe80::a00:20ff:fe9b:ea82
+# - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
+# fe80::a00:20ff:fe9b:ea82/64
+# see RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt)
+#
+# An example of two community groups for multiple hosts:
+# acl = {
+# {
+# communities = public, private
+# access = read-only
+# managers = hubble, snowbell, nanak
+# }
+# {
+# communities = jerry
+# access = read-write
+# managers = hubble, telescope
+# }
+# }
+#
+##############################################################
+# Format of the trap group
+##############################################################
+#
+# trap-community: a single SNMP community string that will be included
+# in the traps sent to the hosts.
+#
+# hosts: a list of hosts to which the SNMP agent will send traps.
+#
+# An example of two trap community definitions for multiple hosts:
+# trap = {
+# {
+# trap-community = public
+# hosts = hubble, snowbell
+# }
+# {
+# trap-community = private
+# hosts = telescope
+# }
+# }
+#
+############################################################
+#
+# Update the community strings (public and private) below
+# before copying this template file
+#
+# Common SNMP ACL Example
+# ------------------------
+#
+# o Only localhost can connect, and access rights
+# are limited to read-only
+# o Traps are sent to localhost only
+#
+#
+# acl = {
+# {
+# communities = public, private
+# access = read-only
+# managers = localhost
+# }
+# }
+#
+#
+# trap = {
+# {
+# trap-community = public
+# hosts = localhost
+# }
+# }
diff --git a/staging/linux-x86/jre/lib/meta-index b/staging/linux-x86/jre/lib/meta-index
new file mode 100644
index 0000000..c3a40a0
--- /dev/null
+++ b/staging/linux-x86/jre/lib/meta-index
@@ -0,0 +1,85 @@
+% VERSION 2
+% WARNING: this file is auto-generated; do not edit
+% UNSUPPORTED: this file and its format may change and/or
+% may be removed in a future release
+# charsets.jar
+sun/awt
+sun/nio
+! jce.jar
+javax/crypto
+sun/security
+! jsse.jar
+com/sun/net/
+sun/security
+! management-agent.jar
+@ resources.jar
+META-INF/services/javax.sound.sampled.spi.AudioFileWriter
+com/sun/imageio/
+sun/print
+META-INF/mimetypes.default
+META-INF/services/javax.sound.midi.spi.MidiDeviceProvider
+com/sun/java/util/jar/pack/
+javax/swing
+META-INF/services/sun.java2d.cmm.CMMServiceProvider
+META-INF/services/javax.sound.midi.spi.SoundbankReader
+META-INF/mailcap.default
+META-INF/services/javax.print.PrintServiceLookup
+com/sun/java/swing/
+META-INF/services/javax.sound.sampled.spi.MixerProvider
+META-INF/services/javax.sound.midi.spi.MidiFileWriter
+META-INF/services/sun.util.spi.XmlPropertiesProvider
+javax/xml
+sun/net
+META-INF/services/javax.sound.sampled.spi.FormatConversionProvider
+META-INF/services/sun.java2d.pipe.RenderingEngine
+com/sun/jndi/
+javax/sql
+com/sun/org/
+java/lang
+sun/text
+META-INF/services/com.sun.tools.internal.xjc.Plugin
+sun/rmi
+META-INF/services/javax.sound.midi.spi.MidiFileReader
+META-INF/services/javax.sound.sampled.spi.AudioFileReader
+META-INF/services/javax.print.StreamPrintServiceFactory
+com/sun/corba/
+com/sun/rowset/
+com/sun/xml/
+META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin
+! rt.jar
+com/sun/imageio/
+com/sun/rmi/
+com/sun/media/
+com/sun/security/
+com/sun/java_cup/
+com/oracle/
+org/ietf/
+com/sun/beans/
+com/sun/java/util/jar/pack/
+com/sun/naming/
+com/sun/management/
+com/sun/istack/
+java/
+com/sun/accessibility/
+sun/
+com/sun/java/swing/
+com/sun/swing/
+com/sun/demo/
+com/sun/nio/
+com/sun/jmx/
+com/sun/java/browser/
+org/omg/
+com/sun/awt/
+com/sun/jndi/
+com/sun/tracing/
+org/w3c/
+com/sun/org/
+jdk/
+com/sun/net/
+com/sun/activation/
+javax/
+org/jcp/
+org/xml/
+com/sun/corba/
+com/sun/rowset/
+com/sun/xml/
diff --git a/staging/linux-x86/jre/lib/net.properties b/staging/linux-x86/jre/lib/net.properties
new file mode 100644
index 0000000..b490e17
--- /dev/null
+++ b/staging/linux-x86/jre/lib/net.properties
@@ -0,0 +1,101 @@
+############################################################
+# Default Networking Configuration File
+#
+# This file may contain default values for the networking system properties.
+# These values are only used when the system properties are not specified
+# on the command line or set programatically.
+# For now, only the various proxy settings can be configured here.
+############################################################
+
+# Whether or not the DefaultProxySelector will default to System Proxy
+# settings when they do exist.
+# Set it to 'true' to enable this feature and check for platform
+# specific proxy settings
+# Note that the system properties that do explicitely set proxies
+# (like http.proxyHost) do take precedence over the system settings
+# even if java.net.useSystemProxies is set to true.
+
+java.net.useSystemProxies=false
+
+#------------------------------------------------------------------------
+# Proxy configuration for the various protocol handlers.
+# DO NOT uncomment these lines if you have set java.net.useSystemProxies
+# to true as the protocol specific properties will take precedence over
+# system settings.
+#------------------------------------------------------------------------
+
+# HTTP Proxy settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 80) and nonProxyHosts is a '|' separated list of hostnames which
+# should be accessed directly, ignoring the proxy server (default value is
+# localhost & 127.0.0.1).
+#
+# http.proxyHost=
+# http.proxyPort=80
+http.nonProxyHosts=localhost|127.*|[::1]
+#
+# HTTPS Proxy Settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 443). The HTTPS protocol handlers uses the http nonProxyHosts list.
+#
+# https.proxyHost=
+# https.proxyPort=443
+#
+# FTP Proxy settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 80) and nonProxyHosts is a '|' separated list of hostnames which
+# should be accessed directly, ignoring the proxy server (default value is
+# localhost & 127.0.0.1).
+#
+# ftp.proxyHost=
+# ftp.proxyPort=80
+ftp.nonProxyHosts=localhost|127.*|[::1]
+#
+# Gopher Proxy settings. proxyHost is the name of the proxy server
+# (e.g. proxy.mydomain.com), proxyPort is the port number to use (default
+# value is 80)
+#
+# gopher.proxyHost=
+# gopher.proxyPort=80
+#
+# Socks proxy settings. socksProxyHost is the name of the proxy server
+# (e.g. socks.domain.com), socksProxyPort is the port number to use
+# (default value is 1080)
+#
+# socksProxyHost=
+# socksProxyPort=1080
+#
+# HTTP Keep Alive settings. remainingData is the maximum amount of data
+# in kilobytes that will be cleaned off the underlying socket so that it
+# can be reused (default value is 512K), queuedConnections is the maximum
+# number of Keep Alive connections to be on the queue for clean up (default
+# value is 10).
+# http.KeepAlive.remainingData=512
+# http.KeepAlive.queuedConnections=10
+
+# Authentication Scheme restrictions for HTTP and HTTPS.
+#
+# In some environments certain authentication schemes may be undesirable
+# when proxying HTTP or HTTPS. For example, "Basic" results in effectively the
+# cleartext transmission of the user's password over the physical network.
+# This section describes the mechanism for disabling authentication schemes
+# based on the scheme name. Disabled schemes will be treated as if they are not
+# supported by the implementation.
+#
+# The 'jdk.http.auth.tunneling.disabledSchemes' property lists the authentication
+# schemes that will be disabled when tunneling HTTPS over a proxy, HTTP CONNECT.
+# The 'jdk.http.auth.proxying.disabledSchemes' property lists the authentication
+# schemes that will be disabled when proxying HTTP.
+#
+# In both cases the property is a comma-separated list of, case-insensitive,
+# authentication scheme names, as defined by their relevant RFCs. An
+# implementation may, but is not required to, support common schemes whose names
+# include: 'Basic', 'Digest', 'NTLM', 'Kerberos', 'Negotiate'. A scheme that
+# is not known, or not supported, by the implementation is ignored.
+#
+# Note: This property is currently used by the JDK Reference implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+#jdk.http.auth.proxying.disabledSchemes=
+jdk.http.auth.tunneling.disabledSchemes=Basic
+
diff --git a/staging/linux-x86/jre/lib/psfont.properties.ja b/staging/linux-x86/jre/lib/psfont.properties.ja
new file mode 100644
index 0000000..d17cf40
--- /dev/null
+++ b/staging/linux-x86/jre/lib/psfont.properties.ja
@@ -0,0 +1,119 @@
+#
+#
+# Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# Japanese PostScript printer property file
+#
+font.num=16
+#
+serif=serif
+timesroman=serif
+sansserif=sansserif
+helvetica=sansserif
+monospaced=monospaced
+courier=monospaced
+dialog=sansserif
+dialoginput=monospaced
+#
+serif.latin1.plain=Times-Roman
+serif.latin1.italic=Times-Italic
+serif.latin1.bolditalic=Times-BoldItalic
+serif.latin1.bold=Times-Bold
+#
+sansserif.latin1.plain=Helvetica
+sansserif.latin1.italic=Helvetica-Oblique
+sansserif.latin1.bolditalic=Helvetica-BoldOblique
+sansserif.latin1.bold=Helvetica-Bold
+#
+monospaced.latin1.plain=Courier
+monospaced.latin1.italic=Courier-Oblique
+monospaced.latin1.bolditalic=Courier-BoldOblique
+monospaced.latin1.bold=Courier-Bold
+#
+serif.x11jis0208.plain=Ryumin-Light-H
+serif.x11jis0208.italic=Ryumin-Light-H
+serif.x11jis0208.bolditalic=Ryumin-Light-H
+serif.x11jis0208.bold=Ryumin-Light-H
+#
+sansserif.x11jis0208.plain=GothicBBB-Medium-H
+sansserif.x11jis0208.italic=GothicBBB-Medium-H
+sansserif.x11jis0208.bolditalic=GothicBBB-Medium-H
+sansserif.x11jis0208.bold=GothicBBB-Medium-H
+#
+monospaced.x11jis0208.plain=GothicBBB-Medium-H
+monospaced.x11jis0208.italic=GothicBBB-Medium-H
+monospaced.x11jis0208.bolditalic=GothicBBB-Medium-H
+monospaced.x11jis0208.bold=GothicBBB-Medium-H
+#
+serif.x11jis0201.plain=Ryumin-Light.Hankaku
+serif.x11jis0201.italic=Ryumin-Light.Hankaku
+serif.x11jis0201.bolditalic=Ryumin-Light.Hankaku
+serif.x11jis0201.bold=Ryumin-Light.Hankaku
+#
+sansserif.x11jis0201.plain=GothicBBB-Medium.Hankaku
+sansserif.x11jis0201.italic=GothicBBB-Medium.Hankaku
+sansserif.x11jis0201.bolditalic=GothicBBB-Medium.Hankaku
+sansserif.x11jis0201.bold=GothicBBB-Medium.Hankaku
+#
+monospaced.x11jis0201.plain=GothicBBB-Medium.Hankaku
+monospaced.x11jis0201.italic=GothicBBB-Medium.Hankaku
+monospaced.x11jis0201.bolditalic=GothicBBB-Medium.Hankaku
+monospaced.x11jis0201.bold=GothicBBB-Medium.Hankaku
+#
+Helvetica=0
+Helvetica-Bold=1
+Helvetica-Oblique=2
+Helvetica-BoldOblique=3
+Times-Roman=4
+Times-Bold=5
+Times-Italic=6
+Times-BoldItalic=7
+Courier=8
+Courier-Bold=9
+Courier-Oblique=10
+Courier-BoldOblique=11
+GothicBBB-Medium-H=12
+Ryumin-Light-H=13
+GothicBBB-Medium.Hankaku=14
+Ryumin-Light.Hankaku=15
+#
+font.0=Helvetica ISOF
+font.1=Helvetica-Bold ISOF
+font.2=Helvetica-Oblique ISOF
+font.3=Helvetica-BoldOblique ISOF
+font.4=Times-Roman ISOF
+font.5=Times-Bold ISOF
+font.6=Times-Italic ISOF
+font.7=Times-BoldItalic ISOF
+font.8=Courier ISOF
+font.9=Courier-Bold ISOF
+font.10=Courier-Oblique ISOF
+font.11=Courier-BoldOblique ISOF
+font.12=GothicBBB-Medium-H findfont
+font.13=Ryumin-Light-H findfont
+font.14=GothicBBB-Medium.Hankaku findfont
+font.15=Ryumin-Light.Hankaku findfont
+#
diff --git a/staging/linux-x86/jre/lib/psfontj2d.properties b/staging/linux-x86/jre/lib/psfontj2d.properties
new file mode 100644
index 0000000..5eb2c4b
--- /dev/null
+++ b/staging/linux-x86/jre/lib/psfontj2d.properties
@@ -0,0 +1,323 @@
+#
+#
+# Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This 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).
+#
+# You 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.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+
+#
+# PostScript printer property file for Java 2D printing.
+#
+# WARNING: This is an internal implementation file, not a public file.
+# Any customisation or reliance on the existence of this file and its
+# contents or syntax is discouraged and unsupported.
+# It may be incompatibly changed or removed without any notice.
+#
+#
+font.num=35
+#
+# Legacy logical font family names and logical font aliases should all
+# map to the primary logical font names.
+#
+serif=serif
+times=serif
+timesroman=serif
+sansserif=sansserif
+helvetica=sansserif
+dialog=sansserif
+dialoginput=monospaced
+monospaced=monospaced
+courier=monospaced
+#
+# Next, physical fonts which can be safely mapped to standard postscript fonts
+# These keys generally map to a value which is the same as the key, so
+# the key/value is just a way to say the font has a mapping.
+# Sometimes however we map more than one screen font to the same PS font.
+#
+avantgarde=avantgarde_book
+avantgarde_book=avantgarde_book
+avantgarde_demi=avantgarde_demi
+avantgarde_book_oblique=avantgarde_book_oblique
+avantgarde_demi_oblique=avantgarde_demi_oblique
+#
+itcavantgarde=avantgarde_book
+itcavantgarde=avantgarde_book
+itcavantgarde_demi=avantgarde_demi
+itcavantgarde_oblique=avantgarde_book_oblique
+itcavantgarde_demi_oblique=avantgarde_demi_oblique
+#
+bookman=bookman_light
+bookman_light=bookman_light
+bookman_demi=bookman_demi
+bookman_light_italic=bookman_light_italic
+bookman_demi_italic=bookman_demi_italic
+#
+# Exclude "helvetica" on its own as that's a legacy name for a logical font
+helvetica_bold=helvetica_bold
+helvetica_oblique=helvetica_oblique
+helvetica_bold_oblique=helvetica_bold_oblique
+#
+itcbookman_light=bookman_light
+itcbookman_demi=bookman_demi
+itcbookman_light_italic=bookman_light_italic
+itcbookman_demi_italic=bookman_demi_italic
+#
+# Exclude "courier" on its own as that's a legacy name for a logical font
+courier_bold=courier_bold
+courier_oblique=courier_oblique
+courier_bold_oblique=courier_bold_oblique
+#
+courier_new=courier
+courier_new_bold=courier_bold
+#
+monotype_century_schoolbook=newcenturyschoolbook
+monotype_century_schoolbook_bold=newcenturyschoolbook_bold
+monotype_century_schoolbook_italic=newcenturyschoolbook_italic
+monotype_century_schoolbook_bold_italic=newcenturyschoolbook_bold_italic
+#
+newcenturyschoolbook=newcenturyschoolbook
+newcenturyschoolbook_bold=newcenturyschoolbook_bold
+newcenturyschoolbook_italic=newcenturyschoolbook_italic
+newcenturyschoolbook_bold_italic=newcenturyschoolbook_bold_italic
+#
+palatino=palatino
+palatino_bold=palatino_bold
+palatino_italic=palatino_italic
+palatino_bold_italic=palatino_bold_italic
+#
+# Exclude "times" on its own as that's a legacy name for a logical font
+times_bold=times_roman_bold
+times_italic=times_roman_italic
+times_bold_italic=times_roman_bold_italic
+#
+times_roman=times_roman
+times_roman_bold=times_roman_bold
+times_roman_italic=times_roman_italic
+times_roman_bold_italic=times_roman_bold_italic
+#
+times_new_roman=times_roman
+times_new_roman_bold=times_roman_bold
+times_new_roman_italic=times_roman_italic
+times_new_roman_bold_italic=times_roman_bold_italic
+#
+zapfchancery_italic=zapfchancery_italic
+itczapfchancery_italic=zapfchancery_italic
+#
+# Next the mapping of the font name + charset + style to Postscript font name
+# for the logical fonts.
+#
+serif.latin1.plain=Times-Roman
+serif.latin1.bold=Times-Bold
+serif.latin1.italic=Times-Italic
+serif.latin1.bolditalic=Times-BoldItalic
+serif.symbol.plain=Symbol
+serif.dingbats.plain=ZapfDingbats
+serif.symbol.bold=Symbol
+serif.dingbats.bold=ZapfDingbats
+serif.symbol.italic=Symbol
+serif.dingbats.italic=ZapfDingbats
+serif.symbol.bolditalic=Symbol
+serif.dingbats.bolditalic=ZapfDingbats
+#
+sansserif.latin1.plain=Helvetica
+sansserif.latin1.bold=Helvetica-Bold
+sansserif.latin1.italic=Helvetica-Oblique
+sansserif.latin1.bolditalic=Helvetica-BoldOblique
+sansserif.symbol.plain=Symbol
+sansserif.dingbats.plain=ZapfDingbats
+sansserif.symbol.bold=Symbol
+sansserif.dingbats.bold=ZapfDingbats
+sansserif.symbol.italic=Symbol
+sansserif.dingbats.italic=ZapfDingbats
+sansserif.symbol.bolditalic=Symbol
+sansserif.dingbats.bolditalic=ZapfDingbats
+#
+monospaced.latin1.plain=Courier
+monospaced.latin1.bold=Courier-Bold
+monospaced.latin1.italic=Courier-Oblique
+monospaced.latin1.bolditalic=Courier-BoldOblique
+monospaced.symbol.plain=Symbol
+monospaced.dingbats.plain=ZapfDingbats
+monospaced.symbol.bold=Symbol
+monospaced.dingbats.bold=ZapfDingbats
+monospaced.symbol.italic=Symbol
+monospaced.dingbats.italic=ZapfDingbats
+monospaced.symbol.bolditalic=Symbol
+monospaced.dingbats.bolditalic=ZapfDingbats
+#
+# Next the mapping of the font name + charset + style to Postscript font name
+# for the physical fonts. Since these always report style as plain, the
+# style key is always plain. So we map using the face name to the correct
+# style for the postscript font. This is possible since the face names can
+# be replied upon to be different for each style.
+# However an application may try to create a Font applying a style to an
+# physical name. We want to map to the correct Postscript font there too
+# if possible but we do not map cases where the application tries to
+# augment a style (eg ask for a bold version of a bold font)
+# Defer to the 2D package to attempt create an artificially styled version
+#
+avantgarde_book.latin1.plain=AvantGarde-Book
+avantgarde_demi.latin1.plain=AvantGarde-Demi
+avantgarde_book_oblique.latin1.plain=AvantGarde-BookOblique
+avantgarde_demi_oblique.latin1.plain=AvantGarde-DemiOblique
+#
+avantgarde_book.latin1.bold=AvantGarde-Demi
+avantgarde_book.latin1.italic=AvantGarde-BookOblique
+avantgarde_book.latin1.bolditalic=AvantGarde-DemiOblique
+avantgarde_demi.latin1.italic=AvantGarde-DemiOblique
+avantgarde_book_oblique.latin1.bold=AvantGarde-DemiOblique
+#
+bookman_light.latin1.plain=Bookman-Light
+bookman_demi.latin1.plain=Bookman-Demi
+bookman_light_italic.latin1.plain=Bookman-LightItalic
+bookman_demi_italic.latin1.plain=Bookman-DemiItalic
+#
+bookman_light.latin1.bold=Bookman-Demi
+bookman_light.latin1.italic=Bookman-LightItalic
+bookman_light.latin1.bolditalic=Bookman-DemiItalic
+bookman_light_bold.latin1.italic=Bookman-DemiItalic
+bookman_light_italic.latin1.bold=Bookman-DemiItalic
+#
+courier.latin1.plain=Courier
+courier_bold.latin1.plain=Courier-Bold
+courier_oblique.latin1.plain=Courier-Oblique
+courier_bold_oblique.latin1.plain=Courier-BoldOblique
+courier.latin1.bold=Courier-Bold
+courier.latin1.italic=Courier-Oblique
+courier.latin1.bolditalic=Courier-BoldOblique
+courier_bold.latin1.italic=Courier-BoldOblique
+courier_italic.latin1.bold=Courier-BoldOblique
+#
+helvetica_bold.latin1.plain=Helvetica-Bold
+helvetica_oblique.latin1.plain=Helvetica-Oblique
+helvetica_bold_oblique.latin1.plain=Helvetica-BoldOblique
+helvetica.latin1.bold=Helvetica-Bold
+helvetica.latin1.italic=Helvetica-Oblique
+helvetica.latin1.bolditalic=Helvetica-BoldOblique
+helvetica_bold.latin1.italic=Helvetica-BoldOblique
+helvetica_italic.latin1.bold=Helvetica-BoldOblique
+#
+newcenturyschoolbook.latin1.plain=NewCenturySchlbk-Roman
+newcenturyschoolbook_bold.latin1.plain=NewCenturySchlbk-Bold
+newcenturyschoolbook_italic.latin1.plain=NewCenturySchlbk-Italic
+newcenturyschoolbook_bold_italic.latin1.plain=NewCenturySchlbk-BoldItalic
+newcenturyschoolbook.latin1.bold=NewCenturySchlbk-Bold
+newcenturyschoolbook.latin1.italic=NewCenturySchlbk-Italic
+newcenturyschoolbook.latin1.bolditalic=NewCenturySchlbk-BoldItalic
+newcenturyschoolbook_bold.latin1.italic=NewCenturySchlbk-BoldItalic
+newcenturyschoolbook_italic.latin1.bold=NewCenturySchlbk-BoldItalic
+#
+palatino.latin1.plain=Palatino-Roman
+palatino_bold.latin1.plain=Palatino-Bold
+palatino_italic.latin1.plain=Palatino-Italic
+palatino_bold_italic.latin1.plain=Palatino-BoldItalic
+palatino.latin1.bold=Palatino-Bold
+palatino.latin1.italic=Palatino-Italic
+palatino.latin1.bolditalic=Palatino-BoldItalic
+palatino_bold.latin1.italic=Palatino-BoldItalic
+palatino_italic.latin1.bold=Palatino-BoldItalic
+#
+times_roman.latin1.plain=Times-Roman
+times_roman_bold.latin1.plain=Times-Bold
+times_roman_italic.latin1.plain=Times-Italic
+times_roman_bold_italic.latin1.plain=Times-BoldItalic
+times_roman.latin1.bold=Times-Bold
+times_roman.latin1.italic=Times-Italic
+times_roman.latin1.bolditalic=Times-BoldItalic
+times_roman_bold.latin1.italic=Times-BoldItalic
+times_roman_italic.latin1.bold=Times-BoldItalic
+#
+zapfchancery_italic.latin1.plain=ZapfChancery-MediumItalic
+#
+# Finally the mappings of PS font names to indexes.
+#
+AvantGarde-Book=0
+AvantGarde-BookOblique=1
+AvantGarde-Demi=2
+AvantGarde-DemiOblique=3
+Bookman-Demi=4
+Bookman-DemiItalic=5
+Bookman-Light=6
+Bookman-LightItalic=7
+Courier=8
+Courier-Bold=9
+Courier-BoldOblique=10
+Courier-Oblique=11
+Helvetica=12
+Helvetica-Bold=13
+Helvetica-BoldOblique=14
+Helvetica-Narrow=15
+Helvetica-Narrow-Bold=16
+Helvetica-Narrow-BoldOblique=17
+Helvetica-Narrow-Oblique=18
+Helvetica-Oblique=19
+NewCenturySchlbk-Bold=20
+NewCenturySchlbk-BoldItalic=21
+NewCenturySchlbk-Italic=22
+NewCenturySchlbk-Roman=23
+Palatino-Bold=24
+Palatino-BoldItalic=25
+Palatino-Italic=26
+Palatino-Roman=27
+Symbol=28
+Times-Bold=29
+Times-BoldItalic=30
+Times-Italic=31
+Times-Roman=32
+ZapfDingbats=33
+ZapfChancery-MediumItalic=34
+#
+font.0=AvantGarde-Book ISOF
+font.1=AvantGarde-BookOblique ISOF
+font.2=AvantGarde-Demi ISOF
+font.3=AvantGarde-DemiOblique ISOF
+font.4=Bookman-Demi ISOF
+font.5=Bookman-DemiItalic ISOF
+font.6=Bookman-Light ISOF
+font.7=Bookman-LightItalic ISOF
+font.8=Courier ISOF
+font.9=Courier-Bold ISOF
+font.10=Courier-BoldOblique ISOF
+font.11=Courier-Oblique ISOF
+font.12=Helvetica ISOF
+font.13=Helvetica-Bold ISOF
+font.14=Helvetica-BoldOblique ISOF
+font.15=Helvetica-Narrow ISOF
+font.16=Helvetica-Narrow-Bold ISOF
+font.17=Helvetica-Narrow-BoldOblique ISOF
+font.18=Helvetica-Narrow-Oblique ISOF
+font.19=Helvetica-Oblique ISOF
+font.20=NewCenturySchlbk-Bold ISOF
+font.21=NewCenturySchlbk-BoldItalic ISOF
+font.22=NewCenturySchlbk-Italic ISOF
+font.23=NewCenturySchlbk-Roman ISOF
+font.24=Palatino-Bold ISOF
+font.25=Palatino-BoldItalic ISOF
+font.26=Palatino-Italic ISOF
+font.27=Palatino-Roman ISOF
+font.28=Symbol findfont
+font.29=Times-Bold ISOF
+font.30=Times-BoldItalic ISOF
+font.31=Times-Italic ISOF
+font.32=Times-Roman ISOF
+font.33=ZapfDingbats findfont
+font.34=ZapfChancery-MediumItalic ISOF
+#
diff --git a/staging/linux-x86/jre/lib/resources.jar b/staging/linux-x86/jre/lib/resources.jar
new file mode 100644
index 0000000..e79e0ca
--- /dev/null
+++ b/staging/linux-x86/jre/lib/resources.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/rt.jar b/staging/linux-x86/jre/lib/rt.jar
new file mode 100644
index 0000000..cf81d99
--- /dev/null
+++ b/staging/linux-x86/jre/lib/rt.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/security/blacklisted.certs b/staging/linux-x86/jre/lib/security/blacklisted.certs
new file mode 100644
index 0000000..00a1dcf
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/blacklisted.certs
@@ -0,0 +1,20 @@
+Algorithm=SHA-256
+14E6D2764A4B06701C6CBC376A253775F79C782FBCB6C0EE6F99DE4BA1024ADD
+31C8FD37DB9B56E708B03D1F01848B068C6DA66F36FB5D82C008C6040FA3E133
+3946901F46B0071E90D78279E82FABABCA177231A704BE72C5B0E8918566EA66
+450F1B421BB05C8609854884559C323319619E8B06B001EA2DCBB74A23AA3BE2
+4CBBF8256BC9888A8007B2F386940A2E394378B0D903CBB3863C5A6394B889CE
+4FEE0163686ECBD65DB968E7494F55D84B25486D438E9DE558D629D28CD4D176
+5E83124D68D24E8E177E306DF643D5EA99C5A94D6FC34B072F7544A1CABB7C7B
+76A45A496031E4DD2D7ED23E8F6FF97DBDEA980BAAC8B0BA94D7EDB551348645
+8A1BD21661C60015065212CC98B1ABB50DFD14C872A208E66BAE890F25C448AF
+9ED8F9B0E8E42A1656B8E1DD18F42BA42DC06FE52686173BA2FC70E756F207DC
+A686FEE577C88AB664D0787ECDFFF035F4806F3DE418DC9E4D516324FFF02083
+B8686723E415534BC0DBD16326F9486F85B0B0799BF6639334E61DAAE67F36CD
+D24566BF315F4E597D6E381C87119FB4198F5E9E2607F5F4AB362EF7E2E7672F
+D3A936E1A7775A45217C8296A1F22AC5631DCDEC45594099E78EEEBBEDCBA967
+DF21016B00FC54F9FE3BC8B039911BB216E9162FAD2FD14D990AB96E951B49BE
+EC30C9C3065A06BB07DC5B1C6B497F370C1CA65C0F30C08E042BA6BCECC78F2C
+F5B6F88F75D391A4B1EB336F9E201239FB6B1377DB8CFA7B84736216E5AFFFD7
+FC02FD48DB92D4DCE6F11679D38354CF750CFC7F584A520EB90BDE80E241F2BD
+FDEDB5BDFCB67411513A61AEE5CB5B5D7C52AF06028EFC996CC1B05B1D6CEA2B
diff --git a/staging/linux-x86/jre/lib/security/cacerts b/staging/linux-x86/jre/lib/security/cacerts
new file mode 100644
index 0000000..318a166
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/cacerts
Binary files differ
diff --git a/staging/linux-x86/jre/lib/security/java.policy b/staging/linux-x86/jre/lib/security/java.policy
new file mode 100644
index 0000000..120694d
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/java.policy
@@ -0,0 +1,49 @@
+
+// Standard extensions get all permissions by default
+
+grant codeBase "file:${{java.ext.dirs}}/*" {
+ permission java.security.AllPermission;
+};
+
+// default permissions granted to all domains
+
+grant {
+ // Allows any thread to stop itself using the java.lang.Thread.stop()
+ // method that takes no argument.
+ // Note that this permission is granted by default only to remain
+ // backwards compatible.
+ // It is strongly recommended that you either remove this permission
+ // from this policy file or further restrict it to code sources
+ // that you specify, because Thread.stop() is potentially unsafe.
+ // See the API specification of java.lang.Thread.stop() for more
+ // information.
+ permission java.lang.RuntimePermission "stopThread";
+
+ // allows anyone to listen on dynamic ports
+ permission java.net.SocketPermission "localhost:0", "listen";
+
+ // "standard" properies that can be read by anyone
+
+ permission java.util.PropertyPermission "java.version", "read";
+ permission java.util.PropertyPermission "java.vendor", "read";
+ permission java.util.PropertyPermission "java.vendor.url", "read";
+ permission java.util.PropertyPermission "java.class.version", "read";
+ permission java.util.PropertyPermission "os.name", "read";
+ permission java.util.PropertyPermission "os.version", "read";
+ permission java.util.PropertyPermission "os.arch", "read";
+ permission java.util.PropertyPermission "file.separator", "read";
+ permission java.util.PropertyPermission "path.separator", "read";
+ permission java.util.PropertyPermission "line.separator", "read";
+
+ permission java.util.PropertyPermission "java.specification.version", "read";
+ permission java.util.PropertyPermission "java.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.specification.name", "read";
+
+ permission java.util.PropertyPermission "java.vm.specification.version", "read";
+ permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.specification.name", "read";
+ permission java.util.PropertyPermission "java.vm.version", "read";
+ permission java.util.PropertyPermission "java.vm.vendor", "read";
+ permission java.util.PropertyPermission "java.vm.name", "read";
+};
+
diff --git a/staging/linux-x86/jre/lib/security/java.security b/staging/linux-x86/jre/lib/security/java.security
new file mode 100644
index 0000000..27cb94e
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/java.security
@@ -0,0 +1,910 @@
+#
+# This is the "master security properties file".
+#
+# An alternate java.security properties file may be specified
+# from the command line via the system property
+#
+# -Djava.security.properties=<URL>
+#
+# This properties file appends to the master security properties file.
+# If both properties files specify values for the same key, the value
+# from the command-line properties file is selected, as it is the last
+# one loaded.
+#
+# Also, if you specify
+#
+# -Djava.security.properties==<URL> (2 equals),
+#
+# then that properties file completely overrides the master security
+# properties file.
+#
+# To disable the ability to specify an additional properties file from
+# the command line, set the key security.overridePropertiesFile
+# to false in the master security properties file. It is set to true
+# by default.
+
+# In this file, various security properties are set for use by
+# java.security classes. This is where users can statically register
+# Cryptography Package Providers ("providers" for short). The term
+# "provider" refers to a package or set of packages that supply a
+# concrete implementation of a subset of the cryptography aspects of
+# the Java Security API. A provider may, for example, implement one or
+# more digital signature algorithms or message digest algorithms.
+#
+# Each provider must implement a subclass of the Provider class.
+# To register a provider in this master security properties file,
+# specify the Provider subclass name and priority in the format
+#
+# security.provider.<n>=<className>
+#
+# This declares a provider, and specifies its preference
+# order n. The preference order is the order in which providers are
+# searched for requested algorithms (when no specific provider is
+# requested). The order is 1-based; 1 is the most preferred, followed
+# by 2, and so on.
+#
+# <className> must specify the subclass of the Provider class whose
+# constructor sets the values of various properties that are required
+# for the Java Security API to look up the algorithms or other
+# facilities implemented by the provider.
+#
+# There must be at least one provider specification in java.security.
+# There is a default provider that comes standard with the JDK. It
+# is called the "SUN" provider, and its Provider subclass
+# named Sun appears in the sun.security.provider package. Thus, the
+# "SUN" provider is registered via the following:
+#
+# security.provider.1=sun.security.provider.Sun
+#
+# (The number 1 is used for the default provider.)
+#
+# Note: Providers can be dynamically registered instead by calls to
+# either the addProvider or insertProviderAt method in the Security
+# class.
+
+#
+# List of providers and their preference orders (see above):
+#
+security.provider.1=sun.security.provider.Sun
+security.provider.2=sun.security.rsa.SunRsaSign
+security.provider.3=sun.security.ec.SunEC
+security.provider.4=com.sun.net.ssl.internal.ssl.Provider
+security.provider.5=com.sun.crypto.provider.SunJCE
+security.provider.6=sun.security.jgss.SunProvider
+security.provider.7=com.sun.security.sasl.Provider
+security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
+security.provider.9=sun.security.smartcardio.SunPCSC
+
+#
+# Sun Provider SecureRandom seed source.
+#
+# Select the primary source of seed data for the "SHA1PRNG" and
+# "NativePRNG" SecureRandom implementations in the "Sun" provider.
+# (Other SecureRandom implementations might also use this property.)
+#
+# On Unix-like systems (for example, Solaris/Linux/MacOS), the
+# "NativePRNG" and "SHA1PRNG" implementations obtains seed data from
+# special device files such as file:/dev/random.
+#
+# On Windows systems, specifying the URLs "file:/dev/random" or
+# "file:/dev/urandom" will enable the native Microsoft CryptoAPI seeding
+# mechanism for SHA1PRNG.
+#
+# By default, an attempt is made to use the entropy gathering device
+# specified by the "securerandom.source" Security property. If an
+# exception occurs while accessing the specified URL:
+#
+# SHA1PRNG:
+# the traditional system/thread activity algorithm will be used.
+#
+# NativePRNG:
+# a default value of /dev/random will be used. If neither
+# are available, the implementation will be disabled.
+# "file" is the only currently supported protocol type.
+#
+# The entropy gathering device can also be specified with the System
+# property "java.security.egd". For example:
+#
+# % java -Djava.security.egd=file:/dev/random MainClass
+#
+# Specifying this System property will override the
+# "securerandom.source" Security property.
+#
+# In addition, if "file:/dev/random" or "file:/dev/urandom" is
+# specified, the "NativePRNG" implementation will be more preferred than
+# SHA1PRNG in the Sun provider.
+#
+securerandom.source=file:/dev/random
+
+#
+# A list of known strong SecureRandom implementations.
+#
+# To help guide applications in selecting a suitable strong
+# java.security.SecureRandom implementation, Java distributions should
+# indicate a list of known strong implementations using the property.
+#
+# This is a comma-separated list of algorithm and/or algorithm:provider
+# entries.
+#
+securerandom.strongAlgorithms=NativePRNGBlocking:SUN
+
+#
+# Class to instantiate as the javax.security.auth.login.Configuration
+# provider.
+#
+login.configuration.provider=sun.security.provider.ConfigFile
+
+#
+# Default login configuration file
+#
+#login.config.url.1=file:${user.home}/.java.login.config
+
+#
+# Class to instantiate as the system Policy. This is the name of the class
+# that will be used as the Policy object.
+#
+policy.provider=sun.security.provider.PolicyFile
+
+# The default is to have a single system-wide policy file,
+# and a policy file in the user's home directory.
+policy.url.1=file:${java.home}/lib/security/java.policy
+policy.url.2=file:${user.home}/.java.policy
+
+# whether or not we expand properties in the policy file
+# if this is set to false, properties (${...}) will not be expanded in policy
+# files.
+policy.expandProperties=true
+
+# whether or not we allow an extra policy to be passed on the command line
+# with -Djava.security.policy=somefile. Comment out this line to disable
+# this feature.
+policy.allowSystemProperty=true
+
+# whether or not we look into the IdentityScope for trusted Identities
+# when encountering a 1.1 signed JAR file. If the identity is found
+# and is trusted, we grant it AllPermission.
+policy.ignoreIdentityScope=false
+
+#
+# Default keystore type.
+#
+keystore.type=jks
+
+#
+# Controls compatibility mode for the JKS keystore type.
+#
+# When set to 'true', the JKS keystore type supports loading
+# keystore files in either JKS or PKCS12 format. When set to 'false'
+# it supports loading only JKS keystore files.
+#
+keystore.type.compat=true
+
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageAccess unless the
+# corresponding RuntimePermission ("accessClassInPackage."+package) has
+# been granted.
+package.access=sun.,\
+ com.sun.xml.internal.,\
+ com.sun.imageio.,\
+ com.sun.istack.internal.,\
+ com.sun.jmx.,\
+ com.sun.media.sound.,\
+ com.sun.naming.internal.,\
+ com.sun.proxy.,\
+ com.sun.corba.se.,\
+ com.sun.org.apache.bcel.internal.,\
+ com.sun.org.apache.regexp.internal.,\
+ com.sun.org.apache.xerces.internal.,\
+ com.sun.org.apache.xpath.internal.,\
+ com.sun.org.apache.xalan.internal.extensions.,\
+ com.sun.org.apache.xalan.internal.lib.,\
+ com.sun.org.apache.xalan.internal.res.,\
+ com.sun.org.apache.xalan.internal.templates.,\
+ com.sun.org.apache.xalan.internal.utils.,\
+ com.sun.org.apache.xalan.internal.xslt.,\
+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\
+ com.sun.org.apache.xalan.internal.xsltc.trax.,\
+ com.sun.org.apache.xalan.internal.xsltc.util.,\
+ com.sun.org.apache.xml.internal.res.,\
+ com.sun.org.apache.xml.internal.security.,\
+ com.sun.org.apache.xml.internal.serializer.utils.,\
+ com.sun.org.apache.xml.internal.utils.,\
+ com.sun.org.glassfish.,\
+ com.oracle.xmlns.internal.,\
+ com.oracle.webservices.internal.,\
+ oracle.jrockit.jfr.,\
+ org.jcp.xml.dsig.internal.,\
+ jdk.internal.,\
+ jdk.nashorn.internal.,\
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.
+
+#
+# List of comma-separated packages that start with or equal this string
+# will cause a security exception to be thrown when
+# passed to checkPackageDefinition unless the
+# corresponding RuntimePermission ("defineClassInPackage."+package) has
+# been granted.
+#
+# by default, none of the class loaders supplied with the JDK call
+# checkPackageDefinition.
+#
+package.definition=sun.,\
+ com.sun.xml.internal.,\
+ com.sun.imageio.,\
+ com.sun.istack.internal.,\
+ com.sun.jmx.,\
+ com.sun.media.sound.,\
+ com.sun.naming.internal.,\
+ com.sun.proxy.,\
+ com.sun.corba.se.,\
+ com.sun.org.apache.bcel.internal.,\
+ com.sun.org.apache.regexp.internal.,\
+ com.sun.org.apache.xerces.internal.,\
+ com.sun.org.apache.xpath.internal.,\
+ com.sun.org.apache.xalan.internal.extensions.,\
+ com.sun.org.apache.xalan.internal.lib.,\
+ com.sun.org.apache.xalan.internal.res.,\
+ com.sun.org.apache.xalan.internal.templates.,\
+ com.sun.org.apache.xalan.internal.utils.,\
+ com.sun.org.apache.xalan.internal.xslt.,\
+ com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
+ com.sun.org.apache.xalan.internal.xsltc.compiler.,\
+ com.sun.org.apache.xalan.internal.xsltc.trax.,\
+ com.sun.org.apache.xalan.internal.xsltc.util.,\
+ com.sun.org.apache.xml.internal.res.,\
+ com.sun.org.apache.xml.internal.security.,\
+ com.sun.org.apache.xml.internal.serializer.utils.,\
+ com.sun.org.apache.xml.internal.utils.,\
+ com.sun.org.glassfish.,\
+ com.oracle.xmlns.internal.,\
+ com.oracle.webservices.internal.,\
+ oracle.jrockit.jfr.,\
+ org.jcp.xml.dsig.internal.,\
+ jdk.internal.,\
+ jdk.nashorn.internal.,\
+ jdk.nashorn.tools.,\
+ com.sun.activation.registries.
+
+#
+# Determines whether this properties file can be appended to
+# or overridden on the command line via -Djava.security.properties
+#
+security.overridePropertiesFile=true
+
+#
+# Determines the default key and trust manager factory algorithms for
+# the javax.net.ssl package.
+#
+ssl.KeyManagerFactory.algorithm=SunX509
+ssl.TrustManagerFactory.algorithm=PKIX
+
+#
+# The Java-level namelookup cache policy for successful lookups:
+#
+# any negative value: caching forever
+# any positive value: the number of seconds to cache an address for
+# zero: do not cache
+#
+# default value is forever (FOREVER). For security reasons, this
+# caching is made forever when a security manager is set. When a security
+# manager is not set, the default behavior in this implementation
+# is to cache for 30 seconds.
+#
+# NOTE: setting this to anything other than the default value can have
+# serious security implications. Do not set it unless
+# you are sure you are not exposed to DNS spoofing attack.
+#
+#networkaddress.cache.ttl=-1
+
+# The Java-level namelookup cache policy for failed lookups:
+#
+# any negative value: cache forever
+# any positive value: the number of seconds to cache negative lookup results
+# zero: do not cache
+#
+# In some Microsoft Windows networking environments that employ
+# the WINS name service in addition to DNS, name service lookups
+# that fail may take a noticeably long time to return (approx. 5 seconds).
+# For this reason the default caching policy is to maintain these
+# results for 10 seconds.
+#
+#
+networkaddress.cache.negative.ttl=10
+
+#
+# Properties to configure OCSP for certificate revocation checking
+#
+
+# Enable OCSP
+#
+# By default, OCSP is not used for certificate revocation checking.
+# This property enables the use of OCSP when set to the value "true".
+#
+# NOTE: SocketPermission is required to connect to an OCSP responder.
+#
+# Example,
+# ocsp.enable=true
+
+#
+# Location of the OCSP responder
+#
+# By default, the location of the OCSP responder is determined implicitly
+# from the certificate being validated. This property explicitly specifies
+# the location of the OCSP responder. The property is used when the
+# Authority Information Access extension (defined in RFC 3280) is absent
+# from the certificate or when it requires overriding.
+#
+# Example,
+# ocsp.responderURL=http://ocsp.example.net:80
+
+#
+# Subject name of the OCSP responder's certificate
+#
+# By default, the certificate of the OCSP responder is that of the issuer
+# of the certificate being validated. This property identifies the certificate
+# of the OCSP responder when the default does not apply. Its value is a string
+# distinguished name (defined in RFC 2253) which identifies a certificate in
+# the set of certificates supplied during cert path validation. In cases where
+# the subject name alone is not sufficient to uniquely identify the certificate
+# then both the "ocsp.responderCertIssuerName" and
+# "ocsp.responderCertSerialNumber" properties must be used instead. When this
+# property is set then those two properties are ignored.
+#
+# Example,
+# ocsp.responderCertSubjectName="CN=OCSP Responder, O=XYZ Corp"
+
+#
+# Issuer name of the OCSP responder's certificate
+#
+# By default, the certificate of the OCSP responder is that of the issuer
+# of the certificate being validated. This property identifies the certificate
+# of the OCSP responder when the default does not apply. Its value is a string
+# distinguished name (defined in RFC 2253) which identifies a certificate in
+# the set of certificates supplied during cert path validation. When this
+# property is set then the "ocsp.responderCertSerialNumber" property must also
+# be set. When the "ocsp.responderCertSubjectName" property is set then this
+# property is ignored.
+#
+# Example,
+# ocsp.responderCertIssuerName="CN=Enterprise CA, O=XYZ Corp"
+
+#
+# Serial number of the OCSP responder's certificate
+#
+# By default, the certificate of the OCSP responder is that of the issuer
+# of the certificate being validated. This property identifies the certificate
+# of the OCSP responder when the default does not apply. Its value is a string
+# of hexadecimal digits (colon or space separators may be present) which
+# identifies a certificate in the set of certificates supplied during cert path
+# validation. When this property is set then the "ocsp.responderCertIssuerName"
+# property must also be set. When the "ocsp.responderCertSubjectName" property
+# is set then this property is ignored.
+#
+# Example,
+# ocsp.responderCertSerialNumber=2A:FF:00
+
+#
+# Policy for failed Kerberos KDC lookups:
+#
+# When a KDC is unavailable (network error, service failure, etc), it is
+# put inside a blacklist and accessed less often for future requests. The
+# value (case-insensitive) for this policy can be:
+#
+# tryLast
+# KDCs in the blacklist are always tried after those not on the list.
+#
+# tryLess[:max_retries,timeout]
+# KDCs in the blacklist are still tried by their order in the configuration,
+# but with smaller max_retries and timeout values. max_retries and timeout
+# are optional numerical parameters (default 1 and 5000, which means once
+# and 5 seconds). Please notes that if any of the values defined here is
+# more than what is defined in krb5.conf, it will be ignored.
+#
+# Whenever a KDC is detected as available, it is removed from the blacklist.
+# The blacklist is reset when krb5.conf is reloaded. You can add
+# refreshKrb5Config=true to a JAAS configuration file so that krb5.conf is
+# reloaded whenever a JAAS authentication is attempted.
+#
+# Example,
+# krb5.kdc.bad.policy = tryLast
+# krb5.kdc.bad.policy = tryLess:2,2000
+krb5.kdc.bad.policy = tryLast
+
+# Algorithm restrictions for certification path (CertPath) processing
+#
+# In some environments, certain algorithms or key lengths may be undesirable
+# for certification path building and validation. For example, "MD2" is
+# generally no longer considered to be a secure hash algorithm. This section
+# describes the mechanism for disabling algorithms based on algorithm name
+# and/or key length. This includes algorithms used in certificates, as well
+# as revocation information such as CRLs and signed OCSP Responses.
+# The syntax of the disabled algorithm string is described as follows:
+# DisabledAlgorithms:
+# " DisabledAlgorithm { , DisabledAlgorithm } "
+#
+# DisabledAlgorithm:
+# AlgorithmName [Constraint] { '&' Constraint }
+#
+# AlgorithmName:
+# (see below)
+#
+# Constraint:
+# KeySizeConstraint | CAConstraint | DenyAfterConstraint |
+# UsageConstraint
+#
+# KeySizeConstraint:
+# keySize Operator KeyLength
+#
+# Operator:
+# <= | < | == | != | >= | >
+#
+# KeyLength:
+# Integer value of the algorithm's key length in bits
+#
+# CAConstraint:
+# jdkCA
+#
+# DenyAfterConstraint:
+# denyAfter YYYY-MM-DD
+#
+# UsageConstraint:
+# usage [TLSServer] [TLSClient] [SignedJAR]
+#
+# The "AlgorithmName" is the standard algorithm name of the disabled
+# algorithm. See "Java Cryptography Architecture Standard Algorithm Name
+# Documentation" for information about Standard Algorithm Names. Matching
+# is performed using a case-insensitive sub-element matching rule. (For
+# example, in "SHA1withECDSA" the sub-elements are "SHA1" for hashing and
+# "ECDSA" for signatures.) If the assertion "AlgorithmName" is a
+# sub-element of the certificate algorithm name, the algorithm will be
+# rejected during certification path building and validation. For example,
+# the assertion algorithm name "DSA" will disable all certificate algorithms
+# that rely on DSA, such as NONEwithDSA, SHA1withDSA. However, the assertion
+# will not disable algorithms related to "ECDSA".
+#
+# A "Constraint" defines restrictions on the keys and/or certificates for
+# a specified AlgorithmName:
+#
+# KeySizeConstraint:
+# keySize Operator KeyLength
+# The constraint requires a key of a valid size range if the
+# "AlgorithmName" is of a key algorithm. The "KeyLength" indicates
+# the key size specified in number of bits. For example,
+# "RSA keySize <= 1024" indicates that any RSA key with key size less
+# than or equal to 1024 bits should be disabled, and
+# "RSA keySize < 1024, RSA keySize > 2048" indicates that any RSA key
+# with key size less than 1024 or greater than 2048 should be disabled.
+# This constraint is only used on algorithms that have a key size.
+#
+# CAConstraint:
+# jdkCA
+# This constraint prohibits the specified algorithm only if the
+# algorithm is used in a certificate chain that terminates at a marked
+# trust anchor in the lib/security/cacerts keystore. If the jdkCA
+# constraint is not set, then all chains using the specified algorithm
+# are restricted. jdkCA may only be used once in a DisabledAlgorithm
+# expression.
+# Example:  To apply this constraint to SHA-1 certificates, include
+# the following:  "SHA1 jdkCA"
+#
+# DenyAfterConstraint:
+# denyAfter YYYY-MM-DD
+# This constraint prohibits a certificate with the specified algorithm
+# from being used after the date regardless of the certificate's
+# validity.  JAR files that are signed and timestamped before the
+# constraint date with certificates containing the disabled algorithm
+# will not be restricted.  The date is processed in the UTC timezone.
+# This constraint can only be used once in a DisabledAlgorithm
+# expression.
+# Example: To deny usage of RSA 2048 bit certificates after Feb 3 2020,
+# use the following: "RSA keySize == 2048 & denyAfter 2020-02-03"
+#
+# UsageConstraint:
+# usage [TLSServer] [TLSClient] [SignedJAR]
+# This constraint prohibits the specified algorithm for
+# a specified usage. This should be used when disabling an algorithm
+# for all usages is not practical. 'TLSServer' restricts the algorithm
+# in TLS server certificate chains when server authentication is
+# performed. 'TLSClient' restricts the algorithm in TLS client
+# certificate chains when client authentication is performed.
+# 'SignedJAR' constrains use of certificates in signed jar files.
+# The usage type follows the keyword and more than one usage type can
+# be specified with a whitespace delimiter.
+# Example: "SHA1 usage TLSServer TLSClient"
+#
+# When an algorithm must satisfy more than one constraint, it must be
+# delimited by an ampersand '&'. For example, to restrict certificates in a
+# chain that terminate at a distribution provided trust anchor and contain
+# RSA keys that are less than or equal to 1024 bits, add the following
+# constraint: "RSA keySize <= 1024 & jdkCA".
+#
+# All DisabledAlgorithms expressions are processed in the order defined in the
+# property. This requires lower keysize constraints to be specified
+# before larger keysize constraints of the same algorithm. For example:
+# "RSA keySize < 1024 & jdkCA, RSA keySize < 2048".
+#
+# Note: The algorithm restrictions do not apply to trust anchors or
+# self-signed certificates.
+#
+# Note: This property is currently used by Oracle's PKIX implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+# Example:
+# jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048
+#
+#
+jdk.certpath.disabledAlgorithms=MD2, MD5, SHA1 jdkCA & usage TLSServer, \
+ RSA keySize < 1024, DSA keySize < 1024, EC keySize < 224
+
+#
+# Algorithm restrictions for signed JAR files
+#
+# In some environments, certain algorithms or key lengths may be undesirable
+# for signed JAR validation. For example, "MD2" is generally no longer
+# considered to be a secure hash algorithm. This section describes the
+# mechanism for disabling algorithms based on algorithm name and/or key length.
+# JARs signed with any of the disabled algorithms or key sizes will be treated
+# as unsigned.
+#
+# The syntax of the disabled algorithm string is described as follows:
+# DisabledAlgorithms:
+# " DisabledAlgorithm { , DisabledAlgorithm } "
+#
+# DisabledAlgorithm:
+# AlgorithmName [Constraint] { '&' Constraint }
+#
+# AlgorithmName:
+# (see below)
+#
+# Constraint:
+# KeySizeConstraint | DenyAfterConstraint
+#
+# KeySizeConstraint:
+# keySize Operator KeyLength
+#
+# DenyAfterConstraint:
+# denyAfter YYYY-MM-DD
+#
+# Operator:
+# <= | < | == | != | >= | >
+#
+# KeyLength:
+# Integer value of the algorithm's key length in bits
+#
+# Note: This property is currently used by the JDK Reference
+# implementation. It is not guaranteed to be examined and used by other
+# implementations.
+#
+# See "jdk.certpath.disabledAlgorithms" for syntax descriptions.
+#
+jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
+
+#
+# Algorithm restrictions for Secure Socket Layer/Transport Layer Security
+# (SSL/TLS) processing
+#
+# In some environments, certain algorithms or key lengths may be undesirable
+# when using SSL/TLS. This section describes the mechanism for disabling
+# algorithms during SSL/TLS security parameters negotiation, including
+# protocol version negotiation, cipher suites selection, peer authentication
+# and key exchange mechanisms.
+#
+# Disabled algorithms will not be negotiated for SSL/TLS connections, even
+# if they are enabled explicitly in an application.
+#
+# For PKI-based peer authentication and key exchange mechanisms, this list
+# of disabled algorithms will also be checked during certification path
+# building and validation, including algorithms used in certificates, as
+# well as revocation information such as CRLs and signed OCSP Responses.
+# This is in addition to the jdk.certpath.disabledAlgorithms property above.
+#
+# See the specification of "jdk.certpath.disabledAlgorithms" for the
+# syntax of the disabled algorithm string.
+#
+# Note: The algorithm restrictions do not apply to trust anchors or
+# self-signed certificates.
+#
+# Note: This property is currently used by the JDK Reference implementation.
+# It is not guaranteed to be examined and used by other implementations.
+#
+# Example:
+# jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
+jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768, \
+ EC keySize < 224
+
+# Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)
+# processing in JSSE implementation.
+#
+# In some environments, a certain algorithm may be undesirable but it
+# cannot be disabled because of its use in legacy applications. Legacy
+# algorithms may still be supported, but applications should not use them
+# as the security strength of legacy algorithms are usually not strong enough
+# in practice.
+#
+# During SSL/TLS security parameters negotiation, legacy algorithms will
+# not be negotiated unless there are no other candidates.
+#
+# The syntax of the legacy algorithms string is described as this Java
+# BNF-style:
+# LegacyAlgorithms:
+# " LegacyAlgorithm { , LegacyAlgorithm } "
+#
+# LegacyAlgorithm:
+# AlgorithmName (standard JSSE algorithm name)
+#
+# See the specification of security property "jdk.certpath.disabledAlgorithms"
+# for the syntax and description of the "AlgorithmName" notation.
+#
+# Per SSL/TLS specifications, cipher suites have the form:
+# SSL_KeyExchangeAlg_WITH_CipherAlg_MacAlg
+# or
+# TLS_KeyExchangeAlg_WITH_CipherAlg_MacAlg
+#
+# For example, the cipher suite TLS_RSA_WITH_AES_128_CBC_SHA uses RSA as the
+# key exchange algorithm, AES_128_CBC (128 bits AES cipher algorithm in CBC
+# mode) as the cipher (encryption) algorithm, and SHA-1 as the message digest
+# algorithm for HMAC.
+#
+# The LegacyAlgorithm can be one of the following standard algorithm names:
+# 1. JSSE cipher suite name, e.g., TLS_RSA_WITH_AES_128_CBC_SHA
+# 2. JSSE key exchange algorithm name, e.g., RSA
+# 3. JSSE cipher (encryption) algorithm name, e.g., AES_128_CBC
+# 4. JSSE message digest algorithm name, e.g., SHA
+#
+# See SSL/TLS specifications and "Java Cryptography Architecture Standard
+# Algorithm Name Documentation" for information about the algorithm names.
+#
+# Note: This property is currently used by the JDK Reference implementation.
+# It is not guaranteed to be examined and used by other implementations.
+# There is no guarantee the property will continue to exist or be of the
+# same syntax in future releases.
+#
+# Example:
+# jdk.tls.legacyAlgorithms=DH_anon, DES_CBC, SSL_RSA_WITH_RC4_128_MD5
+#
+jdk.tls.legacyAlgorithms= \
+ K_NULL, C_NULL, M_NULL, \
+ DHE_DSS_EXPORT, DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, \
+ DH_RSA_EXPORT, RSA_EXPORT, \
+ DH_anon, ECDH_anon, \
+ RC4_128, RC4_40, DES_CBC, DES40_CBC, \
+ 3DES_EDE_CBC
+
+# The pre-defined default finite field Diffie-Hellman ephemeral (DHE)
+# parameters for Transport Layer Security (SSL/TLS/DTLS) processing.
+#
+# In traditional SSL/TLS/DTLS connections where finite field DHE parameters
+# negotiation mechanism is not used, the server offers the client group
+# parameters, base generator g and prime modulus p, for DHE key exchange.
+# It is recommended to use dynamic group parameters. This property defines
+# a mechanism that allows you to specify custom group parameters.
+#
+# The syntax of this property string is described as this Java BNF-style:
+# DefaultDHEParameters:
+# DefinedDHEParameters { , DefinedDHEParameters }
+#
+# DefinedDHEParameters:
+# "{" DHEPrimeModulus , DHEBaseGenerator "}"
+#
+# DHEPrimeModulus:
+# HexadecimalDigits
+#
+# DHEBaseGenerator:
+# HexadecimalDigits
+#
+# HexadecimalDigits:
+# HexadecimalDigit { HexadecimalDigit }
+#
+# HexadecimalDigit: one of
+# 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
+#
+# Whitespace characters are ignored.
+#
+# The "DefinedDHEParameters" defines the custom group parameters, prime
+# modulus p and base generator g, for a particular size of prime modulus p.
+# The "DHEPrimeModulus" defines the hexadecimal prime modulus p, and the
+# "DHEBaseGenerator" defines the hexadecimal base generator g of a group
+# parameter. It is recommended to use safe primes for the custom group
+# parameters.
+#
+# If this property is not defined or the value is empty, the underlying JSSE
+# provider's default group parameter is used for each connection.
+#
+# If the property value does not follow the grammar, or a particular group
+# parameter is not valid, the connection will fall back and use the
+# underlying JSSE provider's default group parameter.
+#
+# Note: This property is currently used by OpenJDK's JSSE implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+# Example:
+# jdk.tls.server.defaultDHEParameters=
+# { \
+# FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 \
+# 29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD \
+# EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 \
+# E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
+# EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
+# FFFFFFFF FFFFFFFF, 2}
+
+# Cryptographic Jurisdiction Policy defaults
+#
+# Import and export control rules on cryptographic software vary from
+# country to country. By default, the JDK provides two different sets of
+# cryptographic policy files:
+#
+# unlimited: These policy files contain no restrictions on cryptographic
+# strengths or algorithms.
+#
+# limited: These policy files contain more restricted cryptographic
+# strengths, and are still available if your country or
+# usage requires the traditional restrictive policy.
+#
+# The JDK JCE framework uses the unlimited policy files by default.
+# However the user may explicitly choose a set either by defining the
+# "crypto.policy" Security property or by installing valid JCE policy
+# jar files into the traditional JDK installation location. To better
+# support older JDK Update releases, the "crypto.policy" property is not
+# defined by default. See below for more information.
+#
+# The following logic determines which policy files are used:
+#
+# <java-home> refers to the directory where the JRE was
+# installed and may be determined using the "java.home"
+# System property.
+#
+# 1. If the Security property "crypto.policy" has been defined,
+# then the following mechanism is used:
+#
+# The policy files are stored as jar files in subdirectories of
+# <java-home>/lib/security/policy. Each directory contains a complete
+# set of policy files.
+#
+# The "crypto.policy" Security property controls the directory
+# selection, and thus the effective cryptographic policy.
+#
+# The default set of directories is:
+#
+# limited | unlimited
+#
+# 2. If the "crypto.policy" property is not set and the traditional
+# US_export_policy.jar and local_policy.jar files
+# (e.g. limited/unlimited) are found in the legacy
+# <java-home>/lib/security directory, then the rules embedded within
+# those jar files will be used. This helps preserve compatibility
+# for users upgrading from an older installation.
+#
+# 3. If the jar files are not present in the legacy location
+# and the "crypto.policy" Security property is not defined,
+# then the JDK will use the unlimited settings (equivalent to
+# crypto.policy=unlimited)
+#
+# Please see the JCA documentation for additional information on these
+# files and formats.
+#
+# YOU ARE ADVISED TO CONSULT YOUR EXPORT/IMPORT CONTROL COUNSEL OR ATTORNEY
+# TO DETERMINE THE EXACT REQUIREMENTS.
+#
+# Please note that the JCE for Java SE, including the JCE framework,
+# cryptographic policy files, and standard JCE providers provided with
+# the Java SE, have been reviewed and approved for export as mass market
+# encryption item by the US Bureau of Industry and Security.
+#
+# Note: This property is currently used by the JDK Reference implementation.
+# It is not guaranteed to be examined and used by other implementations.
+#
+#crypto.policy=unlimited
+
+#
+# The policy for the XML Signature secure validation mode. The mode is
+# enabled by setting the property "org.jcp.xml.dsig.secureValidation" to
+# true with the javax.xml.crypto.XMLCryptoContext.setProperty() method,
+# or by running the code with a SecurityManager.
+#
+# Policy:
+# Constraint {"," Constraint }
+# Constraint:
+# AlgConstraint | MaxTransformsConstraint | MaxReferencesConstraint |
+# ReferenceUriSchemeConstraint | KeySizeConstraint | OtherConstraint
+# AlgConstraint
+# "disallowAlg" Uri
+# MaxTransformsConstraint:
+# "maxTransforms" Integer
+# MaxReferencesConstraint:
+# "maxReferences" Integer
+# ReferenceUriSchemeConstraint:
+# "disallowReferenceUriSchemes" String { String }
+# KeySizeConstraint:
+# "minKeySize" KeyAlg Integer
+# OtherConstraint:
+# "noDuplicateIds" | "noRetrievalMethodLoops"
+#
+# For AlgConstraint, Uri is the algorithm URI String that is not allowed.
+# See the XML Signature Recommendation for more information on algorithm
+# URI Identifiers. For KeySizeConstraint, KeyAlg is the standard algorithm
+# name of the key type (ex: "RSA"). If the MaxTransformsConstraint,
+# MaxReferencesConstraint or KeySizeConstraint (for the same key type) is
+# specified more than once, only the last entry is enforced.
+#
+# Note: This property is currently used by the JDK Reference implementation. It
+# is not guaranteed to be examined and used by other implementations.
+#
+jdk.xml.dsig.secureValidationPolicy=\
+ disallowAlg http://www.w3.org/TR/1999/REC-xslt-19991116,\
+ disallowAlg http://www.w3.org/2001/04/xmldsig-more#rsa-md5,\
+ disallowAlg http://www.w3.org/2001/04/xmldsig-more#hmac-md5,\
+ disallowAlg http://www.w3.org/2001/04/xmldsig-more#md5,\
+ maxTransforms 5,\
+ maxReferences 30,\
+ disallowReferenceUriSchemes file http https,\
+ minKeySize RSA 1024,\
+ minKeySize DSA 1024,\
+ noDuplicateIds,\
+ noRetrievalMethodLoops
+
+#
+# Serialization process-wide filter
+#
+# A filter, if configured, is used by java.io.ObjectInputStream during
+# deserialization to check the contents of the stream.
+# A filter is configured as a sequence of patterns, each pattern is either
+# matched against the name of a class in the stream or defines a limit.
+# Patterns are separated by ";" (semicolon).
+# Whitespace is significant and is considered part of the pattern.
+#
+# If a pattern includes a "=", it sets a limit.
+# If a limit appears more than once the last value is used.
+# Limits are checked before classes regardless of the order in the sequence of patterns.
+# If any of the limits are exceeded, the filter status is REJECTED.
+#
+# maxdepth=value - the maximum depth of a graph
+# maxrefs=value - the maximum number of internal references
+# maxbytes=value - the maximum number of bytes in the input stream
+# maxarray=value - the maximum array length allowed
+#
+# Other patterns, from left to right, match the class or package name as
+# returned from Class.getName.
+# If the class is an array type, the class or package to be matched is the element type.
+# Arrays of any number of dimensions are treated the same as the element type.
+# For example, a pattern of "!example.Foo", rejects creation of any instance or
+# array of example.Foo.
+#
+# If the pattern starts with "!", the status is REJECTED if the remaining pattern
+# is matched; otherwise the status is ALLOWED if the pattern matches.
+# If the pattern ends with ".**" it matches any class in the package and all subpackages.
+# If the pattern ends with ".*" it matches any class in the package.
+# If the pattern ends with "*", it matches any class with the pattern as a prefix.
+# If the pattern is equal to the class name, it matches.
+# Otherwise, the status is UNDECIDED.
+#
+#jdk.serialFilter=pattern;pattern
+
+#
+# RMI Registry Serial Filter
+#
+# The filter pattern uses the same format as jdk.serialFilter.
+# This filter can override the builtin filter if additional types need to be
+# allowed or rejected from the RMI Registry.
+#
+#sun.rmi.registry.registryFilter=pattern;pattern
+
+#
+# RMI Distributed Garbage Collector (DGC) Serial Filter
+#
+# The filter pattern uses the same format as jdk.serialFilter.
+# This filter can override the builtin filter if additional types need to be
+# allowed or rejected from the RMI DGC.
+#
+# The builtin DGC filter can approximately be represented as the filter pattern:
+#
+#sun.rmi.transport.dgcFilter=\
+# java.rmi.server.ObjID;\
+# java.rmi.server.UID;\
+# java.rmi.dgc.VMID;\
+# java.rmi.dgc.Lease;\
+# maxdepth=5;maxarray=10000
+
diff --git a/staging/linux-x86/jre/lib/security/policy/limited/US_export_policy.jar b/staging/linux-x86/jre/lib/security/policy/limited/US_export_policy.jar
new file mode 100644
index 0000000..dccc6ac
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/policy/limited/US_export_policy.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/security/policy/limited/local_policy.jar b/staging/linux-x86/jre/lib/security/policy/limited/local_policy.jar
new file mode 100644
index 0000000..bf05a73
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/policy/limited/local_policy.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/security/policy/unlimited/US_export_policy.jar b/staging/linux-x86/jre/lib/security/policy/unlimited/US_export_policy.jar
new file mode 100644
index 0000000..dccc6ac
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/policy/unlimited/US_export_policy.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/security/policy/unlimited/local_policy.jar b/staging/linux-x86/jre/lib/security/policy/unlimited/local_policy.jar
new file mode 100644
index 0000000..e1358fd
--- /dev/null
+++ b/staging/linux-x86/jre/lib/security/policy/unlimited/local_policy.jar
Binary files differ
diff --git a/staging/linux-x86/jre/lib/sound.properties b/staging/linux-x86/jre/lib/sound.properties
new file mode 100644
index 0000000..68309d1
--- /dev/null
+++ b/staging/linux-x86/jre/lib/sound.properties
@@ -0,0 +1,39 @@
+############################################################
+# Sound Configuration File
+############################################################
+#
+# This properties file is used to specify default service
+# providers for javax.sound.midi.MidiSystem and
+# javax.sound.sampled.AudioSystem.
+#
+# The following keys are recognized by MidiSystem methods:
+#
+# javax.sound.midi.Receiver
+# javax.sound.midi.Sequencer
+# javax.sound.midi.Synthesizer
+# javax.sound.midi.Transmitter
+#
+# The following keys are recognized by AudioSystem methods:
+#
+# javax.sound.sampled.Clip
+# javax.sound.sampled.Port
+# javax.sound.sampled.SourceDataLine
+# javax.sound.sampled.TargetDataLine
+#
+# The values specify the full class name of the service
+# provider, or the device name.
+#
+# See the class descriptions for details.
+#
+# Example 1:
+# Use MyDeviceProvider as default for SourceDataLines:
+# javax.sound.sampled.SourceDataLine=com.xyz.MyDeviceProvider
+#
+# Example 2:
+# Specify the default Synthesizer by its name "InternalSynth".
+# javax.sound.midi.Synthesizer=#InternalSynth
+#
+# Example 3:
+# Specify the default Receiver by provider and name:
+# javax.sound.midi.Receiver=com.sun.media.sound.MidiProvider#SunMIDI1
+#
diff --git a/staging/linux-x86/jre/lib/tzdb.dat b/staging/linux-x86/jre/lib/tzdb.dat
new file mode 100644
index 0000000..08535ce
--- /dev/null
+++ b/staging/linux-x86/jre/lib/tzdb.dat
Binary files differ
diff --git a/staging/linux-x86/lib/amd64/jli/libjli.so b/staging/linux-x86/lib/amd64/jli/libjli.so
new file mode 100755
index 0000000..e95f4e8
--- /dev/null
+++ b/staging/linux-x86/lib/amd64/jli/libjli.so
Binary files differ
diff --git a/staging/linux-x86/lib/amd64/libjawt.so b/staging/linux-x86/lib/amd64/libjawt.so
new file mode 100755
index 0000000..b36d25f
--- /dev/null
+++ b/staging/linux-x86/lib/amd64/libjawt.so
Binary files differ
diff --git a/staging/linux-x86/lib/ct.sym b/staging/linux-x86/lib/ct.sym
new file mode 100644
index 0000000..d160ad1
--- /dev/null
+++ b/staging/linux-x86/lib/ct.sym
Binary files differ
diff --git a/staging/linux-x86/lib/dt.jar b/staging/linux-x86/lib/dt.jar
new file mode 100644
index 0000000..7cc89d4
--- /dev/null
+++ b/staging/linux-x86/lib/dt.jar
Binary files differ
diff --git a/staging/linux-x86/lib/ir.idl b/staging/linux-x86/lib/ir.idl
new file mode 100644
index 0000000..921a7cf
--- /dev/null
+++ b/staging/linux-x86/lib/ir.idl
@@ -0,0 +1,778 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file contains OMG IDL from CORBA V2.0, July 1995.
+ * It also contains the TypeCode creation APIs in CORBA::ORB
+ **/
+
+#pragma prefix "omg.org"
+
+module CORBA {
+ typedef string Identifier;
+ typedef string ScopedName;
+ typedef string RepositoryId;
+
+ enum DefinitionKind {
+ dk_none, dk_all,
+ dk_Attribute, dk_Constant, dk_Exception, dk_Interface,
+ dk_Module, dk_Operation, dk_Typedef,
+ dk_Alias, dk_Struct, dk_Union, dk_Enum,
+ dk_Primitive, dk_String, dk_Sequence, dk_Array,
+ dk_Repository,
+ dk_Wstring, dk_Fixed,
+ dk_Value, dk_ValueBox, dk_ValueMember, // orbos 98-01-18: Objects By Value
+ dk_Native
+ };
+
+
+ interface IRObject
+ /**
+ An IRObject IDL interface represents the most generic interface
+ from which all other Interface Repository interfaces are derived,
+ even the Repository itself.
+ */
+ {
+ // read interface
+ readonly attribute DefinitionKind def_kind;
+
+ // write interface
+ void destroy ();
+ };
+
+
+
+ typedef string VersionSpec;
+
+ interface Contained;
+ interface Repository;
+ interface Container;
+
+ interface Contained : IRObject
+ /**
+ The Contained Interface is inherited by all Interface Repository
+ interfaces that are contained by other objects.
+ */
+ {
+ // read/write interface
+
+ attribute RepositoryId id;
+ attribute Identifier name;
+ attribute VersionSpec version;
+
+ // read interface
+
+ readonly attribute Container defined_in;
+ readonly attribute ScopedName absolute_name;
+ readonly attribute Repository containing_repository;
+
+ struct Description {
+ DefinitionKind kind;
+ any value;
+ };
+
+ Description describe ();
+
+ // write interface
+
+ void move (
+ in Container new_container,
+ in Identifier new_name,
+ in VersionSpec new_version
+ );
+ };
+
+
+ interface ModuleDef;
+ interface ConstantDef;
+ interface IDLType;
+ interface StructDef;
+ interface UnionDef;
+ interface EnumDef;
+ interface AliasDef;
+ interface InterfaceDef;
+ interface ExceptionDef;
+ interface ValueDef; // orbos 98-01-18: Objects By Value
+ interface ValueMemberDef; // orbos 98-01-18: Objects By Value
+ interface ValueBoxDef; // orbos 98-01-18: Objects By Value
+ interface NativeDef;
+
+
+ typedef sequence <InterfaceDef> InterfaceDefSeq;
+
+
+ typedef sequence <Contained> ContainedSeq;
+
+ struct StructMember {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <StructMember> StructMemberSeq;
+
+ struct UnionMember {
+ Identifier name;
+ any label;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <UnionMember> UnionMemberSeq;
+
+
+ typedef sequence <Identifier> EnumMemberSeq;
+
+ // orbos 98-01-18: Objects By Value -- begin
+ typedef short Visibility;
+ const Visibility PRIVATE_MEMBER = 0;
+ const Visibility PUBLIC_MEMBER = 1;
+
+ struct ValueMember {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ IDLType type_def;
+ Visibility access;
+ };
+ typedef sequence <ValueMember> ValueMemberSeq;
+
+ struct Initializer {
+ StructMemberSeq members;
+ };
+ typedef sequence <Initializer> InitializerSeq;
+
+ typedef sequence <ValueDef> ValueDefSeq;
+
+ // orbos 98-01-18: Objects By Value -- end
+
+
+ interface Container : IRObject
+ /**
+ The Container interface is used to form a containment hierarchy
+ in the Interface Repository. A Container can contain any number
+ of objects derived from the Contained interface.
+ */
+ {
+ // read interface
+
+ Contained lookup ( in ScopedName search_name);
+
+ ContainedSeq contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ ContainedSeq lookup_name (
+ in Identifier search_name,
+ in long levels_to_search,
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ struct Description {
+ Contained contained_object;
+ DefinitionKind kind;
+ any value;
+ };
+
+ typedef sequence<Description> DescriptionSeq;
+
+ DescriptionSeq describe_contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited,
+ in long max_returned_objs
+ );
+
+ // write interface
+
+ ModuleDef create_module (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ ConstantDef create_constant (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in any value
+ );
+
+ StructDef create_struct (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+ UnionDef create_union (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType discriminator_type,
+ in UnionMemberSeq members
+ );
+
+ EnumDef create_enum (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EnumMemberSeq members
+ );
+
+ AliasDef create_alias (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type
+ );
+
+ ExceptionDef create_exception (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+
+ InterfaceDef create_interface (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_abstract,
+ in InterfaceDefSeq base_interfaces
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueDef create_value(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_custom,
+ in boolean is_abstract,
+ in octet flags, // must be 0
+ in ValueDef base_value,
+ in boolean has_safe_base,
+ in ValueDefSeq abstract_base_values,
+ in InterfaceDefSeq supported_interfaces,
+ in InitializerSeq initializers
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueBoxDef create_value_box(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type_def
+ );
+
+ NativeDef create_native(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ };
+
+
+
+ interface IDLType : IRObject
+ /**
+ The IDLType interface is an abstract interface inherited by all
+ IR objects that represent the OMG IDL types. It provides access
+ to the TypeCode describing the type, and is used in defining the
+ other interfaces wherever definitions of IDLType must be referenced.
+ */
+ {
+ readonly attribute TypeCode type;
+ };
+
+
+
+ interface PrimitiveDef;
+ interface StringDef;
+ interface SequenceDef;
+ interface ArrayDef;
+
+ enum PrimitiveKind {
+ pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong,
+ pk_float, pk_double, pk_boolean, pk_char, pk_octet,
+ pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref
+ };
+
+ interface Repository : Container
+ /**
+ Repository is an interface that provides global access to the
+ Interface Repository. Repository objects can contain constants,
+ typedefs, exceptions, interfaces, and modules.
+ */
+ {
+ // read interface
+
+ Contained lookup_id (in RepositoryId search_id);
+
+ PrimitiveDef get_primitive (in PrimitiveKind kind);
+
+ // write interface
+
+ StringDef create_string (in unsigned long bound);
+
+ SequenceDef create_sequence (
+ in unsigned long bound,
+ in IDLType element_type
+ );
+
+ ArrayDef create_array (
+ in unsigned long length,
+ in IDLType element_type
+ );
+ };
+
+
+ interface ModuleDef : Container, Contained
+ /**
+ A ModuleDef can contain constants, typedefs, exceptions, interfaces,
+ and other module objects.
+ */
+ {
+ };
+
+ struct ModuleDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ };
+
+
+ interface ConstantDef : Contained
+ /**
+ A ConstantDef object defines a named constant.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute any value;
+ };
+
+ struct ConstantDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ any value;
+ };
+
+
+ interface TypedefDef : Contained, IDLType
+ /**
+ TypedefDef is an abstract interface used as a base interface for
+ all named non-object types(structures, unions, enumerations,
+ aliases). The TypedefDef interface is not inherited by the definition
+ objects for the primitive or anonymous types.
+ */
+ {
+ };
+
+ struct TypeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+ interface StructDef : TypedefDef, Container
+ /**
+ A StructDef represents an OMG IDL structure definition.
+ */
+ {
+ attribute StructMemberSeq members;
+ };
+
+
+ interface UnionDef : TypedefDef, Container
+ /**
+ A UnionDef represents an OMG IDL union definition.
+ */
+ {
+ readonly attribute TypeCode discriminator_type;
+ attribute IDLType discriminator_type_def;
+ attribute UnionMemberSeq members;
+ };
+
+
+ interface EnumDef : TypedefDef
+ /**
+ A EnumDef represents an OMG IDL enum definition.
+ */
+ {
+ attribute EnumMemberSeq members;
+ };
+
+
+ interface AliasDef : TypedefDef
+ /**
+ An AliasDef represents an OMG IDL typedef that aliases other
+ definition.
+ */
+ {
+ attribute IDLType original_type_def;
+ };
+
+
+ interface PrimitiveDef: IDLType
+ /**
+ A PrimitiveDef represents one of the IDL primitive types. As
+ primitive types are unnamed, this interface is not derived from
+ TypedefDef or Contained.
+ */
+ {
+ readonly attribute PrimitiveKind kind;
+ };
+
+
+ interface StringDef : IDLType
+ /**
+ A StringDef represents an OMG IDL string type. As string
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ };
+
+
+ interface SequenceDef : IDLType
+ /**
+ A SequenceDef represents an OMG IDL sequence type. As sequence
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+ interface ArrayDef : IDLType
+ /**
+ An ArrayDef represents an OMG IDL array type. As array
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long length;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+
+ interface ExceptionDef : Contained, Container
+ /**
+ An ExceptionDef represents an exception definition.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute StructMemberSeq members;
+ };
+ struct ExceptionDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+
+ enum AttributeMode {ATTR_NORMAL, ATTR_READONLY};
+
+ interface AttributeDef : Contained
+ /**
+ An AttributeDef represents the information that defines an
+ attribute of an interface.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute AttributeMode mode;
+ };
+
+ struct AttributeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ AttributeMode mode;
+ };
+
+
+
+ enum OperationMode {OP_NORMAL, OP_ONEWAY};
+
+ enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT};
+ struct ParameterDescription {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ ParameterMode mode;
+ };
+ typedef sequence <ParameterDescription> ParDescriptionSeq;
+
+ typedef Identifier ContextIdentifier;
+ typedef sequence <ContextIdentifier> ContextIdSeq;
+
+ typedef sequence <ExceptionDef> ExceptionDefSeq;
+ typedef sequence <ExceptionDescription> ExcDescriptionSeq;
+
+ interface OperationDef : Contained
+ /**
+ An OperationDef represents the information that defines an
+ operation of an interface.
+ */
+ {
+ readonly attribute TypeCode result;
+ attribute IDLType result_def;
+ attribute ParDescriptionSeq params;
+ attribute OperationMode mode;
+ attribute ContextIdSeq contexts;
+ attribute ExceptionDefSeq exceptions;
+ };
+
+ struct OperationDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode result;
+ OperationMode mode;
+ ContextIdSeq contexts;
+ ParDescriptionSeq parameters;
+ ExcDescriptionSeq exceptions;
+ };
+
+
+
+ typedef sequence <RepositoryId> RepositoryIdSeq;
+ typedef sequence <OperationDescription> OpDescriptionSeq;
+ typedef sequence <AttributeDescription> AttrDescriptionSeq;
+
+ interface InterfaceDef : Container, Contained, IDLType
+ /**
+ An InterfaceDef object represents an interface definition. It can
+ contains constants, typedefs, exceptions, operations, and
+ attributes.
+ */
+ {
+ // read/write interface
+
+ attribute InterfaceDefSeq base_interfaces;
+ attribute boolean is_abstract;
+
+ // read interface
+
+ boolean is_a (in RepositoryId interface_id);
+
+ struct FullInterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ boolean is_abstract;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ RepositoryIdSeq base_interfaces;
+ TypeCode type;
+ };
+
+ FullInterfaceDescription describe_interface();
+
+ // write interface
+
+ AttributeDef create_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+
+ struct InterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq base_interfaces;
+ };
+
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+ interface ValueMemberDef : Contained
+
+ /** A <code>ValueMemberDef</code> object represents the public
+ and private data member definition of a <code>Value</code> type
+ */
+
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute Visibility access;
+ };
+
+ interface ValueDef : Container, Contained, IDLType
+ /**
+ A ValueDef object represents the definition of the
+ <code>Value</code> object used to pass the object state
+ between hosts
+ */
+
+ {
+ // read/write interface
+ attribute InterfaceDefSeq supported_interfaces;
+ attribute InitializerSeq initializers;
+ attribute ValueDef base_value;
+ attribute ValueDefSeq abstract_base_values;
+ attribute boolean is_abstract;
+ attribute boolean is_custom;
+ attribute octet flags; // always 0
+ attribute boolean has_safe_base;
+
+ // read interface
+ boolean is_a(in RepositoryId value_id);
+
+ struct FullValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ ValueMemberSeq members;
+ InitializerSeq initializers;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ TypeCode type;
+ };
+
+ FullValueDescription describe_value();
+
+ // write interface
+
+ ValueMemberDef create_value_member(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type_def,
+ in Visibility access
+ );
+
+ AttributeDef create_attribute(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+ struct ValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ };
+
+ interface ValueBoxDef : IDLType
+
+ /** ValueBoxDef is an interface that reresents a value type with
+ a single data member inside its state section and no
+ inheritance or methods. For example, when transmitting a
+ string or sequence as an actual parameter on an interface
+ operation or as a data member of a value type that is an
+ actual parameter, it may be important to preserve any sharing
+ of the string or sequence within the object graph being
+ transmitted. Because current IDL data types do not preserve
+ referential integrity in this way, this requirement is
+ conveniently handled by using a value type. Value types also
+ support the transmission of nulls (as a distinguished value),
+ whereas IDL data types such as string and sequence (which are
+ mapped to empty strings and sequences) do not. The Java to IDL
+ mapping requires both preservation of referential integrity
+ and transmission of nulls. Because it would be cumbersome to
+ require the full IDL syntax for a value type for this specific
+ usage, this shorthand notation is introduced to cover this use
+ of value types for simple containment of a single data member.
+ */
+
+{
+ attribute IDLType original_type_def;
+ };
+
+ // orbos 98-01-18: Objects By Value -- end
+
+ interface NativeDef : TypedefDef {
+ };
+};
diff --git a/staging/linux-x86/lib/jconsole.jar b/staging/linux-x86/lib/jconsole.jar
new file mode 100644
index 0000000..c301a7e
--- /dev/null
+++ b/staging/linux-x86/lib/jconsole.jar
Binary files differ
diff --git a/staging/linux-x86/lib/jexec b/staging/linux-x86/lib/jexec
new file mode 100755
index 0000000..481e6fa
--- /dev/null
+++ b/staging/linux-x86/lib/jexec
Binary files differ
diff --git a/staging/linux-x86/lib/orb.idl b/staging/linux-x86/lib/orb.idl
new file mode 100644
index 0000000..81ed1af
--- /dev/null
+++ b/staging/linux-x86/lib/orb.idl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This 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).
+ *
+ * You 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.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// IDL not generated by rmic, do not edit
+// These are all in IDL module CORBA
+// The Java classes are in the package org.omg.CORBA
+// See ValueType Semantics:Standard Value Box Definitions (5.3) in CORBA 2.3 spec
+
+#ifndef __org_omg_CORBA__
+#define __org_omg_CORBA__
+
+#pragma prefix "omg.org"
+
+module CORBA{
+
+ valuetype StringValue string;
+ valuetype WStringValue wstring;
+
+};
+
+#include "ir.idl"
+
+#pragma prefix ""
+
+#endif
diff --git a/staging/linux-x86/lib/sa-jdi.jar b/staging/linux-x86/lib/sa-jdi.jar
new file mode 100644
index 0000000..e91c217
--- /dev/null
+++ b/staging/linux-x86/lib/sa-jdi.jar
Binary files differ
diff --git a/staging/linux-x86/lib/tools.jar b/staging/linux-x86/lib/tools.jar
new file mode 100644
index 0000000..4c994cb
--- /dev/null
+++ b/staging/linux-x86/lib/tools.jar
Binary files differ
diff --git a/staging/linux-x86/release b/staging/linux-x86/release
new file mode 100644
index 0000000..1744a05
--- /dev/null
+++ b/staging/linux-x86/release
@@ -0,0 +1,5 @@
+JAVA_VERSION="1.8.0_152"
+OS_NAME="Linux"
+OS_VERSION="2.6"
+OS_ARCH="amd64"
+SOURCE=""
diff --git a/staging/linux-x86/sample/README b/staging/linux-x86/sample/README
new file mode 100644
index 0000000..ae56b64
--- /dev/null
+++ b/staging/linux-x86/sample/README
@@ -0,0 +1,6 @@
+The source code provided with samples and demos for the JDK is meant
+to illustrate the usage of a given feature or technique and has been
+deliberately simplified. Additional steps required for a
+production-quality application, such as security checks, input
+validation, and proper error handling, might not be present in the
+sample code.
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java
new file mode 100644
index 0000000..f4fd2c5
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Device.java
@@ -0,0 +1,66 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * Represents the device configuration. The values are loaded from an XML file by JAXB.
+ */
+@XmlRootElement
+public class Device {
+
+ @XmlElement()
+ private Map<Module, Integer> supportedModules = new EnumMap<>(Module.class);
+
+ /**
+ * Returns map of supported modules. The map key is module. The map value is version.
+ *
+ * @return map of supported modules.
+ */
+ public Map<Module, Integer> getSupportedModules() {
+ return Collections.unmodifiableMap(supportedModules);
+ }
+}
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml
new file mode 100644
index 0000000..2e0357d
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Kettle.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+
+
+
+ This source code is provided to illustrate the usage of a given feature
+ or technique and has been deliberately simplified. Additional steps
+ required for a production-quality application, such as security checks,
+ input validation and proper error handling, might not be present in
+ this sample code.
+
+ -->
+
+<device>
+ <supportedModules>
+ <entry>
+ <key>DISPLAY</key>
+ <value>2</value>
+ </entry>
+ <entry>
+ <key>THERMOMETER</key>
+ <value>1</value>
+ </entry>
+ <entry>
+ <key>CLOCK</key>
+ <value>4</value>
+ </entry>
+ </supportedModules>
+</device> \ No newline at end of file
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java
new file mode 100644
index 0000000..2b97b4e
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Module.java
@@ -0,0 +1,49 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * Represents available modules.
+ */
+public enum Module {
+
+ DISPLAY, CLOCK, THERMOMETER, HEATER, SPEAKER, GSM, LED;
+}
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java
new file mode 100644
index 0000000..6db5bae
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/PluginChecker.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package checker;
+
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.xml.bind.JAXBContext;
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.bind.JAXBException;
+
+/**
+ * Reads the device configuration from the XML file specified by -Adevice=device.xml.
+ * For each class in a project, checks required modules. If the device doesn't have
+ * the required module, then a compilation error will be shown.
+ */
+@SupportedAnnotationTypes("checker.RequireContainer")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
+public class PluginChecker extends javax.annotation.processing.AbstractProcessor {
+
+ /**
+ * Name of the option to get the path to the xml with device configuration.
+ */
+ public static final String DEVICE_OPTION = "device";
+ private Device device;
+
+ /**
+ * Only the device option is supported.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getSupportedOptions() {
+ return new HashSet<>(Arrays.asList(DEVICE_OPTION));
+ }
+
+ /**
+ * Initializes the processor by loading the device configuration.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnv) {
+ super.init(processingEnv);
+ try {
+ String deviceOption = processingEnv.getOptions().get(DEVICE_OPTION);
+ device = (Device) JAXBContext.newInstance(Device.class)
+ .createUnmarshaller().unmarshal(new File(deviceOption));
+ } catch (JAXBException e) {
+ throw new RuntimeException(
+ "Please specify device by -Adevice=device.xml\n"
+ + e.toString(), e);
+ }
+ }
+
+ /**
+ * Processes @Require annotations and checks that Device meets requirements.
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment roundEnv) {
+ for (Element el : roundEnv.getElementsAnnotatedWith(RequireContainer.class)) {
+ for (Require req : el.getAnnotationsByType(Require.class)) {
+ //for every Require annotation checks if device has module of required version.
+ Integer version = device.getSupportedModules().get(req.value());
+
+ if (version == null
+ || version < req.minVersion()
+ || version > req.maxVersion()) {
+ //if module is optional then show only warning not error
+ if (req.optional()) {
+ processingEnv.getMessager()
+ .printMessage(Diagnostic.Kind.WARNING,
+ "Plugin [" + el + "] requires " + req
+ + "\n but device " + (version == null
+ ? "doesn't have such module."
+ + " This module is optional."
+ + " So plugin will work but miss"
+ + " some functionality"
+ : "has " + version
+ + " version of that module"));
+ } else {
+ processingEnv.getMessager()
+ .printMessage(Diagnostic.Kind.ERROR,
+ "Plugin [" + el + "] requires " + req
+ + "\n but device "
+ + (version == null
+ ? "doesn't have such module"
+ : "has " + version
+ + " version of that module"));
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java
new file mode 100644
index 0000000..6681c28
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/Require.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package checker;
+
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates that a plug-in depends on a module.
+ */
+@Retention(RetentionPolicy.CLASS)
+@Repeatable(RequireContainer.class)
+public @interface Require {
+
+ /**
+ * Returns the required module.
+ *
+ * @return required module.
+ */
+ Module value();
+
+ /**
+ * Returns the minimum supported version of a module.
+ *
+ * @return minimum supported version of a module.
+ */
+ int minVersion() default 1;
+
+ /**
+ * Returns the maximum supported version of a module.
+ *
+ * @return maximum supported version of a module.
+ */
+ int maxVersion() default Integer.MAX_VALUE;
+
+ /**
+ * Returns true if a module is optional. A module is optional if a system
+ * works without that module but is missing some functionality. Returns false if a system
+ * won't work without the specified module.
+ *
+ * @return true if module is optional. False otherwise.
+ */
+ boolean optional() default false;
+}
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java
new file mode 100644
index 0000000..d18e0d5
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/PluginChecker/src/checker/RequireContainer.java
@@ -0,0 +1,51 @@
+package checker;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * A container for the repeatable @Require annotation.
+ */
+@Retention(RetentionPolicy.CLASS)
+public @interface RequireContainer {
+
+ Require[] value();
+}
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java b/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java
new file mode 100644
index 0000000..3a9d842
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/BoilerPlugin.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+
+/**
+ * BoilerPlugin provides support for boiling water and keeping water warm.
+ */
+@Require(value = Module.CLOCK, maxVersion = 3)
+@Require(value = Module.THERMOMETER)
+@Require(value = Module.HEATER)
+@Require(value = Module.LED, optional = true) //will use if present
+public class BoilerPlugin {
+
+ /**
+ * Heats water up to 100 degrees Celsius.
+ */
+ public void boil() {
+ boil(100);
+ }
+
+ /**
+ * Heats water up to temperature.
+ *
+ * @param temperature - desired temperature of the water in the boiler
+ */
+ public void boil(int temperature) {
+ /*
+ * Turn on heater and wait while temperature reaches desired temperature
+ * in Celsius. Finally, turn off heater.
+ * If present, the LED light changes color according to the temperature.
+ */
+ }
+
+ /**
+ * Keeps desired temperature.
+ *
+ * @param temperature - desired temperature of the water in the boiler
+ * @param seconds - period of time for checking temperature in seconds
+ */
+ public void keepWarm(int temperature, int seconds) {
+ //Every n seconds check temperature and warm up, if necessary.
+ }
+
+}
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java b/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java
new file mode 100644
index 0000000..b7be610
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/ExtendedBoilerPlugin.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+import java.util.Calendar;
+
+/**
+ * Introduces new features for BoilerPlugin. Features are boiling water by an
+ * SMS and boiling water by date with notification by a phone call.
+ */
+@Require(value = Module.SPEAKER)
+@Require(value = Module.GSM, minVersion = 3)
+@Require(value = Module.DISPLAY)
+public class ExtendedBoilerPlugin extends BoilerPlugin {
+
+ /**
+ * Boils water at the appointed time and wakes you up by a ring and phone
+ * call. Shows "Good morning" and a quote of the day from the Internet on the
+ * display.
+ *
+ * @param calendar - date and time when water should be boiled
+ * @param phoneNumber - phone number to call
+ */
+ public void boilAndWakeUp(Calendar calendar, int phoneNumber) {
+ //implementation
+ }
+
+ /**
+ * Boils water at the appointed time by getting an SMS of fixed format.
+ * Sends an SMS on finish.
+ *
+ * @param sms - text of SMS
+ */
+ public void boilBySMS(String sms) {
+ //implementation
+ }
+}
diff --git a/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java b/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java
new file mode 100644
index 0000000..678785c
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/DependencyChecker/Plugins/src/plugins/TimerPlugin.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+package plugins;
+
+import checker.Module;
+import checker.Require;
+
+/**
+ * Timer plug-in is used to support an alarm and a timer. It depends on Display and
+ * Clock modules.
+ */
+@Require(Module.DISPLAY)
+@Require(value = Module.CLOCK, maxVersion = 3)
+public class TimerPlugin {
+
+ /**
+ * Sets timer.
+ *
+ * @param time - the remaining time.
+ */
+ public void timer(long time) {
+ //start timer
+ //show the remaining time on display
+ }
+
+ /**
+ * Sets alarm.
+ *
+ * @param time - the alarm time.
+ */
+ public void alarm(long time) {
+ //start alarm
+ //show current time and alarm time on display
+ }
+}
diff --git a/staging/linux-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java b/staging/linux-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java
new file mode 100644
index 0000000..0a14913
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/Validator/src/PositiveIntegerSupplier.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.util.function.Supplier;
+
+/**
+ * Supplies a positive number.
+ */
+@Validate(value = Validator.INTEGER_NUMBER,
+ description = "It's not an Integer ")
+@Validate(value = Validator.POSITIVE_NUMBER,
+ description = "It's not a positive Number")
+public class PositiveIntegerSupplier implements Supplier<String> {
+
+ /**
+ * Returns a string representation of a positive integer.
+ *
+ * @return string representation of a positive integer.
+ */
+ @Override
+ public String get() {
+ return "20005"; //random number
+ }
+}
diff --git a/staging/linux-x86/sample/annotations/Validator/src/SupplierValidator.java b/staging/linux-x86/sample/annotations/Validator/src/SupplierValidator.java
new file mode 100644
index 0000000..479ac86
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/Validator/src/SupplierValidator.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import javax.xml.bind.ValidationException;
+import java.util.function.Supplier;
+
+/**
+ * Validates the supplier.
+ */
+public class SupplierValidator {
+
+ /**
+ * Validates the supplier.
+ *
+ * @param supplier - Supplier that needs to be validated.
+ * @return true if supplier has passed validation check. False otherwise.
+ */
+ public static boolean validate(Supplier<?> supplier) {
+ for (Validate annotation
+ : supplier.getClass().getAnnotationsByType(Validate.class)) {
+ try {
+ annotation.value().validate(supplier);
+ } catch (ValidationException e) {
+ System.out.println(annotation.description());
+ e.printStackTrace();
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/staging/linux-x86/sample/annotations/Validator/src/Validate.java b/staging/linux-x86/sample/annotations/Validator/src/Validate.java
new file mode 100644
index 0000000..e0404ea
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/Validator/src/Validate.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Indicates that the class should be validated by the specified validator.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(ValidateContainer.class)
+public @interface Validate {
+
+ /**
+ * Returns the validator that should validate the annotated class.
+ *
+ * @return Validator that should validate annotated class.
+ */
+ Validator value();
+
+ /**
+ * Returns text to describe the failure of the validation check.
+ *
+ * @return text to describe the failure of the validation check.
+ */
+ String description() default "";
+}
+
+/**
+ * A container for the repeatable @Validate annotation.
+ *
+ * @author Andrey Nazarov
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@interface ValidateContainer {
+
+ Validate[] value();
+}
diff --git a/staging/linux-x86/sample/annotations/Validator/src/Validator.java b/staging/linux-x86/sample/annotations/Validator/src/Validator.java
new file mode 100644
index 0000000..9e074f5
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/Validator/src/Validator.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+import javax.xml.bind.ValidationException;
+import java.util.function.Supplier;
+
+/**
+ * Enum of Validator implementations.
+ */
+public enum Validator {
+
+ /**
+ * This validator checks that the string represents an integer.
+ */
+ INTEGER_NUMBER {
+ /**
+ * Checks that the string represents an integer.
+ *
+ * @param string - a string supplier
+ * @throws ValidationException if the validation check fails
+ */
+ @Override
+ void validate(Supplier<?> string) throws ValidationException {
+ try {
+ Integer.parseInt((String) string.get());
+ } catch (NumberFormatException ex) {
+ throw new ValidationException("Error while validating "
+ + string.get());
+ }
+ }
+ },
+ /**
+ * This validator checks that the string represents a positive number.
+ */
+ POSITIVE_NUMBER {
+ /**
+ * Checks that the string represents a positive number.
+ *
+ * @param string - an string supplier
+ * @throws ValidationException if the validation check fails
+ */
+ @Override
+ void validate(Supplier<?> string) throws ValidationException {
+ try {
+ if (Double.compare(0.0, Double.parseDouble(
+ (String) string.get())) > 0) {
+ throw new Exception();
+ }
+ } catch (Exception ex) {
+ throw new ValidationException("Error while validating "
+ + string.get());
+ }
+ }
+ };
+
+ /**
+ * Checks that the supplier is valid.
+ *
+ * @param string - a string supplier
+ * @throws ValidationException if validation check fails
+ */
+ abstract void validate(Supplier<?> string) throws ValidationException;
+
+}
diff --git a/staging/linux-x86/sample/annotations/index.html b/staging/linux-x86/sample/annotations/index.html
new file mode 100644
index 0000000..804c83d
--- /dev/null
+++ b/staging/linux-x86/sample/annotations/index.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Repeating Annotations Demo</title>
+</head>
+<body>
+<h2>Repeating Annotations Demo</h2>
+
+<p>
+ This demo shows how to use repeating annotations at runtime and at compile time.
+</p>
+
+<ul>
+ <li><h3>Dependency checker.</h3>
+
+ <p>
+ Shows how to define repeating annotations and process them at compile time.
+ The problem domain is some code that performs useful operations on hardware devices.
+ The code relies on "modules" to be present on the devices. Applicability of the code to a particular
+ device is checked while compiling the code for a particular device.
+ A set of modules provided by a device is listed in an xml file that turns red during the compilation
+ phase and is compared with the required module set specified by annotations.
+ For instance, there is kettle with hardware modules: thermometer, display, and clock.
+ There is also a boiler plug-in that requires clock, thermometer, heater, and optionally an LED light.
+
+ Build the PluginChecker annotation processor first.
+ Then, run javac with the annotation processor against plug-in sources using the following command: </p>
+
+ <code>javac -cp "PluginChecker.jar" -processor checker.PluginChecker -Adevice=Kettle.xml -proc:only &lt;source
+ files&gt;</code>
+
+ <p>
+ where <code>PluginChecker.jar</code> - path to jar file that contains PluginChecker annotation processor
+ class. </br>
+ <code>Kettle.xml</code> - path to device descriptor Kettle.xml </br>
+ <code>&lt;source files&gt;</code> - source files in Plugins/src
+ </p>
+ For more information, see the source files.
+ </p>
+ <ul>
+ <li>Annotation processor sources: <a href="DependencyChecker/PluginChecker/src/">DependencyChecker/PluginChecker/src</a>
+ <li>Processing of repeating annotations can be found in <a href="DependencyChecker/PluginChecker/src/checker/PluginChecker.java">PluginChecker.java</a>
+ <li>Usage of repeating annotation is shown in modules sources.<a href="DependencyChecker/Plugins/src">DependencyChecker/Plugins/src</a>
+ </ul>
+
+ <li><h3>Validator.</h3>
+
+ <p>
+ Shows how to define repeating annotations and process them at runtime.
+ A problem domain is code that needs to validate provided Suppliers for conformance to some criteria.
+ The criteria are implemented by the Validator class which is applied by using annotations that are placed in
+ the code whenever validation is needed. For more information, see the
+ source files.
+ </p>
+
+ <p>
+ <ul>
+ <li>Usage of repeating annotation is described in <a href="Validator/src/PositiveIntegerSupplier.java">PositiveIntegerSupplier.java</a>
+ <li> Example of how to define a repeating annotation type can be found in
+ <a href="Validator/src/Validate.java">Validate.java</a>
+ <li> Usages of the new reflective methods can be found in <a href="Validator/src/SupplierValidator.java">SupplierValidator.java</a>
+ </ul>
+ </p>
+ Sources: <a href="Validator/src/">Validator/src/</a>
+</ul>
+</body>
+</html> \ No newline at end of file
diff --git a/staging/linux-x86/sample/forkjoin/mergesort/MergeDemo.java b/staging/linux-x86/sample/forkjoin/mergesort/MergeDemo.java
new file mode 100644
index 0000000..528f383
--- /dev/null
+++ b/staging/linux-x86/sample/forkjoin/mergesort/MergeDemo.java
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.util.Arrays;
+import java.util.Random;
+
+import static java.lang.Integer.parseInt;
+
+/**
+ * MergeExample is a class that runs a demo benchmark of the {@code ForkJoin} framework
+ * by benchmarking a {@link MergeSort} algorithm that is implemented using
+ * {@link java.util.concurrent.RecursiveAction}.
+ * The {@code ForkJoin} framework is setup with different parallelism levels
+ * and the sort is executed with arrays of different sizes to see the
+ * trade offs by using multiple threads for different sizes of the array.
+ */
+public class MergeDemo {
+ // Use a fixed seed to always get the same random values back
+ private final Random random = new Random(759123751834L);
+ private static final int ITERATIONS = 10;
+
+ /**
+ * Represents the formula {@code f(n) = start + (step * n)} for n = 0 & n < iterations
+ */
+ private static class Range {
+ private final int start;
+ private final int step;
+ private final int iterations;
+
+ private Range(int start, int step, int iterations) {
+ this.start = start;
+ this.step = step;
+ this.iterations = iterations;
+ }
+
+ /**
+ * Parses start, step and iterations from args
+ * @param args the string array containing the arguments
+ * @param start which element to start the start argument from
+ * @return the constructed range
+ */
+ public static Range parse(String[] args, int start) {
+ if (args.length < start + 3) {
+ throw new IllegalArgumentException("Too few elements in array");
+ }
+ return new Range(parseInt(args[start]), parseInt(args[start + 1]), parseInt(args[start + 2]));
+ }
+
+ public int get(int iteration) {
+ return start + (step * iteration);
+ }
+
+ public int getIterations() {
+ return iterations;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(start).append(" ").append(step).append(" ").append(iterations);
+ return builder.toString();
+ }
+ }
+
+ /**
+ * Wraps the different parameters that is used when running the MergeExample.
+ * {@code sizes} represents the different array sizes
+ * {@code parallelism} represents the different parallelism levels
+ */
+ private static class Configuration {
+ private final Range sizes;
+ private final Range parallelism;
+
+ private final static Configuration defaultConfig = new Configuration(new Range(20000, 20000, 10),
+ new Range(2, 2, 10));
+
+ private Configuration(Range sizes, Range parallelism) {
+ this.sizes = sizes;
+ this.parallelism = parallelism;
+ }
+
+ /**
+ * Parses the arguments and attempts to create a configuration containing the
+ * parameters for creating the array sizes and parallelism sizes
+ * @param args the input arguments
+ * @return the configuration
+ */
+ public static Configuration parse(String[] args) {
+ if (args.length == 0) {
+ return defaultConfig;
+ } else {
+ try {
+ if (args.length == 6) {
+ return new Configuration(Range.parse(args, 0), Range.parse(args, 3));
+ }
+ } catch (NumberFormatException e) {
+ System.err.println("MergeExample: error: Argument was not a number.");
+ }
+ System.err.println("MergeExample <size start> <size step> <size steps> <parallel start> <parallel step>" +
+ " <parallel steps>");
+ System.err.println("example: MergeExample 20000 10000 3 1 1 4");
+ System.err.println("example: will run with arrays of sizes 20000, 30000, 40000" +
+ " and parallelism: 1, 2, 3, 4");
+ return null;
+ }
+ }
+
+ /**
+ * Creates an array for reporting the test result time in
+ * @return an array containing {@code sizes.iterations * parallelism.iterations} elements
+ */
+ private long[][] createTimesArray() {
+ return new long[sizes.getIterations()][parallelism.getIterations()];
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("");
+ if (this == defaultConfig) {
+ builder.append("Default configuration. ");
+ }
+ builder.append("Running with parameters: ");
+ builder.append(sizes);
+ builder.append(" ");
+ builder.append(parallelism);
+ return builder.toString();
+ }
+ }
+
+ /**
+ * Generates an array of {@code elements} random elements
+ * @param elements the number of elements requested in the array
+ * @return an array of {@code elements} random elements
+ */
+ private int[] generateArray(int elements) {
+ int[] array = new int[elements];
+ for (int i = 0; i < elements; ++i) {
+ array[i] = random.nextInt();
+ }
+ return array;
+ }
+
+ /**
+ * Runs the test
+ * @param config contains the settings for the test
+ */
+ private void run(Configuration config) {
+ Range sizes = config.sizes;
+ Range parallelism = config.parallelism;
+
+ // Run a couple of sorts to make the JIT compile / optimize the code
+ // which should produce somewhat more fair times
+ warmup();
+
+ long[][] times = config.createTimesArray();
+
+ for (int size = 0; size < sizes.getIterations(); size++) {
+ runForSize(parallelism, sizes.get(size), times, size);
+ }
+
+ printResults(sizes, parallelism, times);
+ }
+
+ /**
+ * Prints the results as a table
+ * @param sizes the different sizes of the arrays
+ * @param parallelism the different parallelism levels used
+ * @param times the median times for the different sizes / parallelism
+ */
+ private void printResults(Range sizes, Range parallelism, long[][] times) {
+ System.out.println("Time in milliseconds. Y-axis: number of elements. X-axis parallelism used.");
+ long[] sums = new long[times[0].length];
+ System.out.format("%8s ", "");
+ for (int i = 0; i < times[0].length; i++) {
+ System.out.format("%4d ", parallelism.get(i));
+ }
+ System.out.println("");
+ for (int size = 0; size < sizes.getIterations(); size++) {
+ System.out.format("%8d: ", sizes.get(size));
+ for (int i = 0; i < times[size].length; i++) {
+ sums[i] += times[size][i];
+ System.out.format("%4d ", times[size][i]);
+ }
+ System.out.println("");
+ }
+ System.out.format("%8s: ", "Total");
+ for (long sum : sums) {
+ System.out.format("%4d ", sum);
+ }
+ System.out.println("");
+ }
+
+ private void runForSize(Range parallelism, int elements, long[][] times, int size) {
+ for (int step = 0; step < parallelism.getIterations(); step++) {
+ long time = runForParallelism(ITERATIONS, elements, parallelism.get(step));
+ times[size][step] = time;
+ }
+ }
+
+ /**
+ * Runs <i>iterations</i> number of test sorts of a random array of <i>element</i> length
+ * @param iterations number of iterations
+ * @param elements number of elements in the random array
+ * @param parallelism parallelism for the ForkJoin framework
+ * @return the median time of runs
+ */
+ private long runForParallelism(int iterations, int elements, int parallelism) {
+ MergeSort mergeSort = new MergeSort(parallelism);
+ long[] times = new long[iterations];
+
+ for (int i = 0; i < iterations; i++) {
+ // Suggest the VM to run a garbage collection to reduce the risk of getting one
+ // while running the test run
+ System.gc();
+ long start = System.currentTimeMillis();
+ mergeSort.sort(generateArray(elements));
+ times[i] = System.currentTimeMillis() - start;
+ }
+
+ return medianValue(times);
+ }
+
+ /**
+ * Calculates the median value of the array
+ * @param times array of times
+ * @return the median value
+ */
+ private long medianValue(long[] times) {
+ if (times.length == 0) {
+ throw new IllegalArgumentException("Empty array");
+ }
+ // Make a copy of times to avoid having side effects on the parameter value
+ Arrays.sort(times.clone());
+ long median = times[times.length / 2];
+ if (times.length > 1 && times.length % 2 != 0) {
+ median = (median + times[times.length / 2 + 1]) / 2;
+ }
+ return median;
+ }
+
+ /**
+ * Generates 1000 arrays of 1000 elements and sorts them as a warmup
+ */
+ private void warmup() {
+ MergeSort mergeSort = new MergeSort(Runtime.getRuntime().availableProcessors());
+ for (int i = 0; i < 1000; i++) {
+ mergeSort.sort(generateArray(1000));
+ }
+ }
+
+ public static void main(String[] args) {
+ Configuration configuration = Configuration.parse(args);
+ if (configuration == null) {
+ System.exit(1);
+ }
+ System.out.println(configuration);
+ new MergeDemo().run(configuration);
+ }
+}
diff --git a/staging/linux-x86/sample/forkjoin/mergesort/MergeSort.java b/staging/linux-x86/sample/forkjoin/mergesort/MergeSort.java
new file mode 100644
index 0000000..0ae48dc
--- /dev/null
+++ b/staging/linux-x86/sample/forkjoin/mergesort/MergeSort.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.util.Arrays;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinTask;
+import java.util.concurrent.RecursiveAction;
+
+/**
+ * A class for sorting an array of {@code ints} in parallel.
+ * A {@code ForkJoinPool} is used for the parallelism, using the merge sort
+ * algorithm the array is split into halves and a new sub task is created
+ * for each part. Each sub task is dispatched to the {@code ForkJoinPool}
+ * which will schedule the task to a {@code Thread}.
+ * This happens until the size of the array is at most 2
+ * elements long. At this point the array is sorted using a simple compare
+ * and possibly a swap. The tasks then finish by using insert sort to
+ * merge the two just sorted arrays.
+ *
+ * The idea of this class is to demonstrate the usage of RecursiveAction not
+ * to implement the best possible parallel merge sort. This version creates
+ * a small array for each merge (creating a lot of objects), this could
+ * be avoided by keeping a single array.
+ */
+public class MergeSort {
+ private final ForkJoinPool pool;
+
+ private static class MergeSortTask extends RecursiveAction {
+ private final int[] array;
+ private final int low;
+ private final int high;
+ private static final int THRESHOLD = 8;
+
+ /**
+ * Creates a {@code MergeSortTask} containing the array and the bounds of the array
+ *
+ * @param array the array to sort
+ * @param low the lower element to start sorting at
+ * @param high the non-inclusive high element to sort to
+ */
+ protected MergeSortTask(int[] array, int low, int high) {
+ this.array = array;
+ this.low = low;
+ this.high = high;
+ }
+
+ @Override
+ protected void compute() {
+ if (high - low <= THRESHOLD) {
+ Arrays.sort(array, low, high);
+ } else {
+ int middle = low + ((high - low) >> 1);
+ // Execute the sub tasks and wait for them to finish
+ invokeAll(new MergeSortTask(array, low, middle), new MergeSortTask(array, middle, high));
+ // Then merge the results
+ merge(middle);
+ }
+ }
+
+ /**
+ * Merges the two sorted arrays this.low, middle - 1 and middle, this.high - 1
+ * @param middle the index in the array where the second sorted list begins
+ */
+ private void merge(int middle) {
+ if (array[middle - 1] < array[middle]) {
+ return; // the arrays are already correctly sorted, so we can skip the merge
+ }
+ int[] copy = new int[high - low];
+ System.arraycopy(array, low, copy, 0, copy.length);
+ int copyLow = 0;
+ int copyHigh = high - low;
+ int copyMiddle = middle - low;
+
+ for (int i = low, p = copyLow, q = copyMiddle; i < high; i++) {
+ if (q >= copyHigh || (p < copyMiddle && copy[p] < copy[q]) ) {
+ array[i] = copy[p++];
+ } else {
+ array[i] = copy[q++];
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates a {@code MergeSort} containing a ForkJoinPool with the indicated parallelism level
+ * @param parallelism the parallelism level used
+ */
+ public MergeSort(int parallelism) {
+ pool = new ForkJoinPool(parallelism);
+ }
+
+ /**
+ * Sorts all the elements of the given array using the ForkJoin framework
+ * @param array the array to sort
+ */
+ public void sort(int[] array) {
+ ForkJoinTask<Void> job = pool.submit(new MergeSortTask(array, 0, array.length));
+ job.join();
+ }
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/build.properties b/staging/linux-x86/sample/jmx/jmx-scandir/build.properties
new file mode 100644
index 0000000..cad4a6a
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/build.properties
@@ -0,0 +1,58 @@
+# IMPORTANT NOTE
+#
+# If you made a private copy of this project you may have to update the
+# nbjdk.home variable at the end of this file.
+#
+# To be able to run the test-suite, you will also have to set the
+# variable:
+#
+# libs.junit.classpath=<junit.jar>
+#
+
+main.dir=.
+
+src.dir=${main.dir}/src
+test.src.dir=${main.dir}/test
+
+build.dir=build
+classes.dir=${build.dir}/classes
+
+dist.dir=dist
+jar=${dist.dir}/jmx-scandir.jar
+javadoc.dir=${dist.dir}/javadoc
+
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+
+build.sysclasspath=ignore
+# E.g.: cp=lib/x.jar:lib/y.jar
+cp=
+extra.run.cp=
+
+# To be able to run the test-suite, set the following property:
+# libs.junit.classpath=...
+
+javac.test.classpath=\
+ ${classes.dir}:\
+ ${libs.junit.classpath}
+
+main.agent.class=com.sun.jmx.examples.scandir.ScanDirAgent
+main.client.class=com.sun.jmx.examples.scandir.ScanDirClient
+main.class=${main.client.class}
+
+run.jvmargs=-Djava.util.logging.config.file=logging.properties
+common.jvmargs=${run.jvmargs} -Djavax.net.ssl.keyStore=keystore -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=truststore -Djavax.net.ssl.trustStorePassword=trustword
+client.jvmargs=${common.jvmargs}
+agent.jvmargs=${common.jvmargs} -Dcom.sun.management.config.file=src/etc/management.properties -Dscandir.config.file=src/etc/testconfig.xml
+
+client.args=localhost 4545
+
+run.cp=${cp}:${classes.dir}:${extra.run.cp}
+run.test.classpath=${run.cp}:${build.test.classes.dir}
+
+debug=true
+deprecation=false
+
+# Update this variable if need be to point to the JDK 6 location.
+#
+nbjdk.home=${basedir}/../../..
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/build.xml b/staging/linux-x86/sample/jmx/jmx-scandir/build.xml
new file mode 100644
index 0000000..e54fcec
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/build.xml
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+
+<!--
+ This is ant (http://ant.apache.org) build script to build the
+ "jmx-scandir" sample. Either this build.xml can be used standalone
+ with "ant" tool or can be opened as a project with NetBeans IDE
+ (http://www.netbeans.org).
+-->
+
+<project name="jmx-scandir" default="jar" basedir=".">
+
+ <import file="nbproject/jdk.xml"/>
+
+
+ <target name="-prop-init">
+ <property file="user.build.properties"/>
+ <property file="build.properties"/>
+ </target>
+
+ <target name="-init" depends="-prop-init,-jdk-init"/>
+
+ <target name="compile" depends="-init" description="Compile main sources.">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ </javac>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}"/>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile" description="Build JAR file for main sources.">
+ <mkdir dir="${dist.dir}" />
+ <jar jarfile="${jar}" compress="true">
+ <manifest>
+ <attribute name="Main-Class" value="${main.agent.class}"/>
+ </manifest>
+ <fileset dir="${classes.dir}"/>
+ </jar>
+ </target>
+
+ <target name="run-client" depends="compile" description="Run client.">
+ <fail unless="main.client.class">Must set property 'main.client.class' (e.g. in build.properties)</fail>
+ <java classname="${main.client.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg line="${client.jvmargs}" />
+ <arg line="${client.args}" />
+ </java>
+ </target>
+
+ <target name="run-agent" depends="compile" description="Run agent.">
+ <fail unless="main.agent.class">Must set property 'main.agent.class' (e.g. in build.properties)</fail>
+ <java classname="${main.agent.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg line="${agent.jvmargs}" />
+ </java>
+ </target>
+
+ <target name="run" depends="run-agent" description="Run agent." />
+
+ <target name="run-single" depends="-init,compile">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <java classname="${run.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ </java>
+ </target>
+
+ <target name="javadoc" depends="-init" description="Build Javadoc.">
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc destdir="${javadoc.dir}">
+ <classpath path="${cp}"/>
+ <sourcepath>
+ <pathelement location="${src.dir}"/>
+ </sourcepath>
+ <fileset dir="${src.dir}"/>
+ </javadoc>
+ </target>
+
+ <target name="clean" depends="-init" description="Clean build products.">
+ <delete dir="${build.dir}"/>
+ <delete file="${jar}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+
+ <target name="profile">
+ <ant antfile="nbproject/netbeans-targets.xml" target="profile"/>
+ </target>
+
+ <!-- JUnit targets -->
+
+ <target name="compile-test" depends="-init,compile">
+ <fail unless="libs.junit.classpath">Must set libs.junit.classpath variable to the JUnit classpath in the build.properties file.</fail>
+ <mkdir dir="${build.test.classes.dir}"/>
+ <javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="${debug}" classpath="${javac.test.classpath}"/>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.src.dir}" excludes="**/*.java"/>
+ </copy>
+ </target>
+
+ <target name="-do-test-run" depends="-init,compile-test">
+ <mkdir dir="${build.test.results.dir}"/>
+ <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.src.dir}" includes="**/*Test.java"/>
+ </batchtest>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper type="glob" from="test-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${run.jvmargs}"/>
+ </junit>
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+
+ <target name="test" depends="-init,compile-test,-do-test-run" description="Run unit tests."/>
+
+ <target name="-do-test-run-single" depends="-init,compile-test">
+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+ <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.src.dir}" includes="${test.includes}"/>
+ </batchtest>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper type="glob" from="test-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${run.jvmargs}"/>
+ </junit>
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+
+ <target name="test-single" depends="-init,compile-test,-do-test-run-single" description="Run single unit test."/>
+</project>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpg
new file mode 100644
index 0000000..6a58f0e
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-ant-run.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpg
new file mode 100644
index 0000000..86add09
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local-java-jar.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpg
new file mode 100644
index 0000000..0259e96
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/connect-local.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpg
new file mode 100644
index 0000000..001b0fa
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection-failed.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpg
new file mode 100644
index 0000000..90d07a0
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/remote-connection.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpg
new file mode 100644
index 0000000..9e0a10c
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-config.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpg
new file mode 100644
index 0000000..75e7baf
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-result.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpg b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpg
new file mode 100644
index 0000000..5bceae5
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/docfiles/scandir-start.jpg
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/index.html b/staging/linux-x86/sample/jmx/jmx-scandir/index.html
new file mode 100644
index 0000000..4fd2ae6
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/index.html
@@ -0,0 +1,2217 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+ <head>
+<!--
+ Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+ <title>JMX(TM) "scandir" Example</title>
+ </head>
+ <body>
+
+ <h1><center>Java<font size="-1"><sup>TM</sup></font> Management Extensions (JMX<font size="-1"><sup>TM</sup></font>) <i>scandir</i> Example</center></h1>
+
+ <h2><a name="h2-Introduction">Introduction</a></h2>
+ <ul>
+ <p>The JMX <i>scandir</i> example is an application that
+ scans parts of a filesystem - e.g. a set of directories
+ used by a number of lab machines when running tests - in
+ order to clean up and optimize disk space by removing
+ obsolete files - e.g. files that are leaked by the test
+ suites running on those machines, like coredump files, or
+ temporary files that might remain after a test crash.
+ It could also serve as a basis for an application that
+ would monitor disk usage and suggest removal of old big
+ long-unaccessed files.
+ </p>
+ <p>The JMX <i>scandir</i> example does not however implement
+ the full fledged logic that such an application might
+ have. It implements a subset of this logic which is
+ sufficient to demonstrate common patterns and
+ solutions used when implementing a monitoring and
+ management interface for an application with JMX
+ Technology.</p>
+ <p>This example is an advanced JMX example, which presents
+ advanced JMX concepts. It is assumed that the reader is already
+ familiar with the JMX API. Newcomers to JMX Technology are
+ invited to have a look at the <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/jmx/"
+ >JMX API Overview, Tutorial and Examples</a> before going any further.
+ </p>
+ <p></p>
+ <hr>
+ <blockquote>
+ <u>Note:</u> This example was developed using <a
+ href="http://www.netbeans.org">NetBeans 5.0 IDE</a>. The instructions
+ given in this document to build, run, and test the example assume that
+ you have at your disposal:
+ <ul><li>either <a href="http://www.netbeans.org">NetBeans 5.0 IDE</a>,</li>
+ <li>or <a href="http://ant.apache.org/">Apache Ant 1.6.5</a> and
+ <a href="http://sourceforge.net/projects/junit/">JUnit 3.8.1 or
+ 3.8.2</a><br>
+ (JUnit is only needed to run the example's unit tests).
+ </li>
+ </ul>
+ <p><a name="setup">In order to build the example</a>,
+ <u>you may need to copy the jmx-scandir</u>
+ directory to somewhere where you have write permissions.
+ <br>In that case, you will need to update the <i>nbjdk.home</i> variable
+ in the copied <i><a href="build.properties">build.properties</a></i>
+ file located at the root of the copied project directory.
+ Please make sure that this variable points to the JDK 6 home directory.
+ </p>
+ <p>If you wish to run the testsuite from within the <a
+ href="http://www.netbeans.org">NetBeans IDE</a> you will also have
+ to set the <i>libs.junit.classpath</i> variable in
+ <a href="build.properties">build.properties</a>.
+ The <i>libs.junit.classpath</i> variable should point to your
+ <a href="http://sourceforge.net/projects/junit/">junit.jar</a>,
+ version 3.8.1 or 3.8.2.
+ </p>
+ </blockquote>
+ <hr>
+ <p></p>
+ <p><u>Table Of Contents:</u></p>
+ <p><center>[<a href="#h2-Generating">Generating&nbsp;the&nbsp;Java&nbsp;Documentation</a>]
+ [<a href="#h2-Overview">Overview&nbsp;of&nbsp;the&nbsp;<i>scandir</i>&nbsp;Example</a>]
+ [<a href="#h2-API-Doc">API&nbsp;Documentation&nbsp;and&nbsp;Sources</a>]
+ [<a href="#h2-Patterns">Patterns,&nbsp;Best&nbsp;Practices,&nbsp;and&nbsp;Common&nbsp;Pitfalls</a>]
+ [<a href="#h2-Testing">Testing&nbsp;the&nbsp;<i>scandir</i>&nbsp;Example</a>]
+ [<a href="#h2-Running">Running&nbsp;the&nbsp;<i>scandir</i>&nbsp;Example</a>]
+ [<a href="#h2-Playing">Playing&nbsp;with&nbsp;JConsole</a>]
+ [<a href="#h2-Turning">Turning&nbsp;the&nbsp;example&nbsp;into&nbsp;a&nbsp;Secure&nbsp;JMX&nbsp;Application</a>]
+ [<a href="#h2-Connecting">Connecting&nbsp;to&nbsp;the&nbsp;Secure&nbsp;JMX&nbsp;Application</a>]
+ [<a href="#h2-Conclusion">Conclusion</a>]
+ [<a href="#h2-References">References</a>]</center></p>
+
+ </ul>
+ <h2><a name="h2-Generating">Generating the Java Documentation</a></h2>
+
+ <ul>
+ <p>Before reading further, you will need to generate the
+ Java Documentation for the example's sources.</p>
+ <p>In the example root directory (where the <code>build.xml</code>
+ file is located) run the following command:
+ <pre>ant javadoc</pre>
+ </p>
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE and generate the Javadoc from its <code>Build</code>
+ menu.
+ </p>
+ <p>If building the documentation fails, please make sure to read the
+ <a href="#setup">note</a> at the beginning of this document.</p>
+ </ul>
+
+ <h2><a name="h2-Overview">Overview of the <i>scandir</i> Example</a></h2>
+
+ <ul>
+ <p>The JMX <i>scandir</i> example is built around the
+ following MBeans:</p>
+ <ul>
+ <li>The first MBean we will present here is the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a>. <br>A
+ <code>DirectoryScannerMXBean</code> is an MBean that scans a
+ file system starting at a given root directory, and then looks
+ for files that match the given criteria. When such a file is
+ found, the <code>DirectoryScannerMXBean</code> takes the
+ action for which it was configured: emit a notification,
+ <i>and/or</i> log a <code>record</code> for this file,
+ <i>and/or</i> delete that file. The code that would actually
+ delete the file is commented out - so that nothing valuable is
+ lost if the example is run by mistake on the wrong set of
+ directories.<br> <code>DirectoryScannerMXBeans</code> are
+ created by the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> - see next item on the list, from its
+ configuration.
+ </li>
+ <li>
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> is the actual entry point of the
+ application. It reads the application's
+ configuration, and from that configuration,
+ will create a <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html"
+title="The ResultLogManager is in charge of managing result logs"
+ >ResultLogManager</a> and some <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a>.
+ <br>The <code>ScanManagerMXBean</code> lets you start, stop, and
+ schedule directory scans. The
+ <code>ScanManagerMXBean</code> is a singleton
+ MBean: there can be at most one instance of such
+ an MBean registered in a given MBeanServer.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> is an MBean which is able to
+ load/save the configuration to/from an XML file. It
+ will also let you modify that configuration - by e.g.
+ creating new directory scanners in there.
+ The corresponding MBeans will be created later, only
+ when you later
+ ask the <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> </code> to apply the
+ configuration again.<br>
+ The <code>ScanDirConfigMXBean</code> is created by the
+ <code>ScanManagerMXBean</code>, when the
+ <code>ScanManagerMXBean</code> is registered.
+ It is also possible to create an alternate
+ <code>ScanDirConfigMXBean</code>, and to switch the
+ <code>ScanDirConfigMXBean</code> to use one or the other
+ configuration.
+ <br>An example of XML configuration file is given
+ <a href="src/etc/testconfig.xml"
+ title="An Example Of Configuration"
+ >here</a>. Although you could edit such a file by
+ hand, it is easier to do it programmatically (or
+ with <a href="#JConsole">JConsole</a>) through
+ the <code>ScanDirConfigMXBean</code> interface.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> is in charge of managing result logs.
+ <br>Directory Scanners can be configured to log a
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/ResultRecord.html"
+title="A ResultRecord contains information about a file matching the criteria of a Directory Scanner"
+ >ResultRecord</a> whenever they take action upon a file that
+ matches their criteria. The <code>ResultLogManagerMXBean</code> is
+ responsible for logging these result records.
+ The <code>ResultLogManagerMXBean</code> can be configured to log
+ such records to a flat file, or into a log held in memory, or
+ both. Both logs (file and memory) can be configured with a
+ maximum capacity.
+ <br>When the maximum capacity of the memory
+ log is reached, its first entry (i.e. its oldest entry) is
+ removed to make place for the latest one.
+ <br>When the maximum
+ capacity of the file log is reached, the file is
+ renamed by appending a tilde '~' to its name and a
+ new result log is created.
+ <br>The <code>ResultLogManagerMXBean</code>
+ will let you interactively clear these result logs, change their
+ capacity, and decide where (memory or file) to log.
+ The memory log is useful in that its content can be interactively
+ returned by the <code>ResultLogManagerMXBean</code>, while
+ the file log doesn't have this facility.<br>
+ The result logs are intended to be used by e.g. an offline
+ program that would take some actions on the files that
+ matched the scan criteria:
+ <br>The <i>scandir</i> application
+ could be configured to only produce logs (i.e. takes no
+ action but logging the matching files), and the real
+ action could be performed by another program or module (e.g. mail the result log to the engineer who
+ maintains the lab, or parse that log and delete all the
+ files listed there, or parse the log and prepare and send
+ a single mail to each owner of matching files, containing
+ the list of files they should consider deleting).<br>
+ The <code>ResultLogManagerMXBean</code> is a singleton
+ MBean created by the <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> </code>
+ which reads and writes its configuration from the
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code>.
+ </li>
+ </ul>
+ <p>An application <code>main()</code> method is
+ provided in the <a
+ href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+ >ScanDirAgent</a> class. The <code>main()</code> simply registers
+ a <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> </code> in the platform MBeanServer, and
+ then waits for someone to call <code>close()</code> on the
+ <code>ScanManagerMXBean</code>.
+ </p>
+ <p>When the <code>ScanManagerMXBean</code> is registered, it
+ will create a default <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code> bound
+ to a default XML config file.
+ </p>
+ <p>The application's default XML config file is determined as
+ follows:
+ <ol>
+ <li>If the property <code>scandir.config.file</code> is
+ defined, the default application file will be the
+ file pointed to by this property. If that file
+ doesn't exist, it will be created when
+ <code>ScanDirConfigMXBean.save()</code> is
+ invoked.
+ </li>
+ <li>Otherwise the application config file is
+ assumed to be a file called <code>jmx-scandir.xml</code>,
+ located in the user's directory (as defined by
+ the System property <code>user.home</code>).
+ If that file doesn't exists, it will be created when
+ <code>ScanDirConfigMXBean.save()</code> is
+ invoked.
+ </li>
+ </ol>
+ <p>It is worth noting that this project is defined to
+ run with the following properties:
+ <pre>-Djava.util.logging.config.file=logging.properties</pre>
+ <pre>-Dscandir.config.file=src/etc/testconfig.xml</pre>
+ With <code>ScanDirAgent</code> defined as the project's
+ main class. Hence when you invoke from the NetBeans IDE
+ <i>Run Project</i> on the <i>jmx-scandir</i> project,
+ or <i>Run file</i> on the <code>ScanDirAgent</code>, the
+ application starts with the test configuration provided in
+ <a href="src/etc/testconfig.xml"
+ title="An Example Of Configuration"
+ >src/etc/testconfig.xml</a>
+ </p>
+ </ul>
+ <h2><a name="h2-API-Doc">API Documentation and Sources</a></h2>
+ <ul>
+ <p>Once generated, the Javadoc of example classes can
+ be found starting from <a href="dist/javadoc/index.html"
+ title="The API Documentation"
+ ><code>dist/javadoc/index.html</code></a>.</p>
+ <p>You can view the sources in the <a
+ href="src"
+ title="The Example Source Tree"
+ ><code>src</code></a> subdirectory.</p>
+ </ul>
+ <h2><a name="h2-Patterns">Patterns, Best Practices, and Common Pitfalls</a></h2>
+ <ul>
+ <p>This section discusses some common patterns and
+ design choices that this example demonstrates, and some pitfalls that
+ it avoids.
+ </ul>
+ <h3>MBeans or MXBeans?</h3>
+ <ul>
+ <p>What is an MXBean? MXBeans made their appearance in
+ J2SE 5.0 (Tiger), with the Management and Monitoring
+ API of the JVM. However, Java SE 6 is the first
+ Java SE release that contains a standard framework which
+ makes it possible to create and register your own MXBeans.
+ </p>
+ <p>MXBeans are a special kind of MBean, which once registered
+ in the MBeanServer, get automatically transformed into
+ OpenMBeans. From a developer point of view, nothing changes:
+ A Wombat MBean can become an MXBean simply by renaming
+ its <code>WombatMBean</code> interface into <code>WombatMXBean</code>.</p>
+ <p>Using MXBeans rather than plain Standard MBean brings its
+ own advantages:</p>
+ <ul>
+ <li>
+ Generic tools, like JConsole, will be able to
+ display and interact with your MXBeans nicely, even
+ if your MXBean interfaces reference custom types
+ - e.g. custom Java enums. This is because all the types
+ exposed by your MXBeans are converted to Open Types.
+ Just look at the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> with JConsole and you will
+ understand the benefits.
+ </li>
+ <li>
+ When writing a programmatic client, you can obtain
+ a proxy that implements the original MXBean interface,
+ and forget about the Open Type conversion.
+ The JUnit unit tests that come with this example
+ use this feature very widely. Have a look at them.
+ </li>
+ <li>
+ The MXBean framework also lets you nicely navigate
+ from one MXBean to another: your MXBeans can
+ have attributes and parameters which are proxies
+ to other MXBeans! We demonstrate this in the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> which exposes a list
+ of <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a></code> and points
+ towards a <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code>.
+ </li>
+ </ul>
+ <p>In short, MXBeans are so much easier to use that
+ this example doesn't even have a single regular
+ Standard MBean.
+ </p>
+ <p>See also <a
+href="http://weblogs.java.net/blog/emcmanus/archive/2006/02/what_is_an_mxbe.html"
+title="What is an MXBean?"
+ >What is an MXBean?</a>
+ and <a
+href="http://weblogs.java.net/blog/emcmanus/archive/2006/06/intermxbean_ref.html"
+title="Inter-MXBean references"
+ >Inter-MXBean References</a>.
+ </p>
+ <blockquote><u>Hint:</u> In order to simplify the task of coding a
+ JMX programmatic client, we recommend that getters, setters, and
+ operations defined in MBean and MXBean interfaces throw
+ <code>IOException</code>. Proxy objects will then be able
+ to rethrow directly any <code>IOException</code> received from
+ their underlying MBean Server connection, without wrapping
+ them into <code>UndeclaredThrowableExceptions</code>.<br>
+ Since the life cycle of the proxy object is not directly tied to
+ the life cycle of the MBean it proxies, you may also want to
+ have all methods in the MBean or MXBean interface throw
+ <code>InstanceNotFoundException</code> or more generally
+ <code>JMException</code>.
+ </blockquote>
+ </ul>
+ <h3>MBean Names - aka ObjectNames</h3>
+ <ul>
+ <p>As you must know if you've been studying JMX, MBeans are
+ named objects. The names of MBeans are represented by
+ instances of <code>ObjectName</code>. An ObjectName is
+ composed of a <i>domain</i>, followed by a colon ':',
+ followed by a comma-separated list of <i>key=value</i>
+ pairs.<br>
+ The ordering of the <i>key=value</i> pairs is not
+ important, but <code>ObjectNames</code> are case sensitive
+ (both keys and values are case sensitive) and <b>white space
+ is not ignored</b>.<br>
+ A common pitfall for JMX beginners is to inadvertently
+ insert white space after commas into an ObjectName,
+ and expect that two ObjectNames which differ only by such white
+ space will be considered identical. This is not the
+ case.<br>
+ As an example, the ObjectName '<b><code>D:k1=v1, k2=v2, k3=v3</code></b>' has
+ three keys, which are '<b><code>k1</code></b>', '<b><code> k2</code></b>',
+ and '<b><code> k3</code></b>': beware
+ of the space in the name of the second and third
+ keys!<br>
+ It is therefore a different ObjectName from
+ '<b><code>D:k1=v1,k2=v2,k3=v3</code></b>' (the keys are now
+ '<b><code>k1</code></b>', '<b><code>k2</code></b>', and
+ '<b><code>k3</code></b>'), but the same ObjectName as
+ '<b><code>D: k2=v2, k3=v3,k1=v1</code></b>', and yet different
+ from '<b><code>D:k2=v2, k3=v3, k1=v1</code></b>'!
+ <p>In this example, we are following the rules
+ for ObjectName suggested in the <a
+href="http://java.sun.com/products/JavaManagement/best-practices.html"
+ >JMX Best Practices</a>:</p>
+ <ul>
+ <li>ObjectNames should be <a
+ href="http://java.sun.com/products/JavaManagement/best-practices.html#mozTocId654884"
+ >predictable</a>
+ </li>
+ <li>The domain part of our ObjectNames starts with a Java
+ package name
+ </li>
+ <li>Our ObjectNames contain a <code>type=</code>
+ key property. This property is different for every
+ object type in our domain.
+ </li>
+ <li>For every ObjectName with a given type, we have the same set of key
+ properties with the same syntax and semantics for their values - in
+ fact we only use an additional <code>name=</code> key.
+ </li>
+ <li>When there can only be one instance of a given type
+ there aren't any other key properties than <code>type=</code>.
+ The ObjectNames of the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a>, which are both singleton MBeans, are
+ composed in this way.
+ </li>
+ <li>When there can be several instances of a given type,
+ we differentiate them by further key properties.
+ To achieve this, we are using the most usual key property
+ in addition to <code>type=</code>: the <code>name=</code> key.
+ In this example, a key property list of the form
+ <code>type=X,name=Y</code> is always enough to uniquely name
+ an MBean. Tools like jconsole are usually aware
+ of the semantics of the <code>type=</code> key and
+ <code>name=</code> key, and are therefore able to
+ display this form of name in a way that
+ is easier to read than other name forms.
+ </li>
+ </ul>
+ <p>The rules listed above are implemented by a couple
+ of static helper functions in the <a
+href="src/com/sun/jmx/examples/scandir/ScanManager.java"
+title="ScanManager.java"
+ >ScanManager</a> class. See the code of the
+ <b><code>makeSingletonName</code></b> and
+ <b><code>makeMBeanName</code></b> methods.
+ </p>
+ </ul>
+ <h3>Inter MBean Navigation</h3>
+ <ul>
+ <p>One of the most common problems that needs to be solved
+ when designing a management interface with JMX is to
+ choose a representation for inter-MBean relationships.<br>
+ Prior to Java 6, there were basically three possible
+ choices:</p>
+ <ul>
+ <li><b>Make the relation appear in the ObjectName</b>.
+ For instance, if MBean B was contained in
+ MBean A, you could choose to name MBean B so
+ that its parent relationship with MBean A
+ appeared in its name. <br>
+ The obvious limitation of this solution is that
+ it only allows to model one such relation (an
+ MBean has only one name) and the relation must
+ be fixed - it cannot change during the life of
+ the MBean since the name of an MBean cannot
+ change.<br>
+ This scheme is therefore mostly used when
+ the application MBeans are modeling objects
+ which are conceptually contained within
+ each other in a tree-like structure.
+ <br>For instance, most MBean names defined by
+ <a href="http://jcp.org/en/jsr/detail?id=77"
+ >J2EE Management (JSR 77)</a> follow
+ this scheme.
+ </li>
+ <li><b>Design getters and setters (or operations) which
+ return <code>ObjectName</code> or
+ <code>ObjectName[]</code> values</b>. The ObjectNames
+ point to the MBeans which are related to that
+ object. For instance , <a
+ href="http://glassfish.dev.java.net/"
+ title="Open Source Java EE 5 Application Server"
+ >GlassFish</a>
+ defines MBeans which also use this pattern.
+ </li>
+ <li><b>Use the JMX RelationService</b>. The JMX RelationService
+ is quite powerful, but simple relationships often
+ do not justify that overhead.
+ </li>
+ </ul>
+ <p>In Java 6, these three possibilities still remain, but
+ the new MXBean framework brings up an interesting
+ alternative. Instead of returning an ObjectName or
+ an ObjectName array, <b>an MXBean can return a proxy</b>
+ to its related MXBeans. This is how we have chosen to
+ implement our inter MBean relationships in this
+ example:
+ <br>For instance the
+ <code>ScanManagerMXBean</code>/<code>DirectoryScannerMXBean</code>
+ relationship and the
+ <code>ScanManagerMXBean</code>/<code>ScanDirConfigMXBean</code>
+ relationships are implemented in this way.
+ <p>
+ The additional benefit, as compared to returning ObjectNames or
+ using the RelationService is that interface type of the MBeans
+ which are pointed to by the relationship becomes directly
+ apparent. The method:
+ <pre>
+ public Map&lt;String,DirectoryScannerMXBean&gt; getDirectoryScanners();
+ </pre>
+ makes it immediately obvious that the MBeans to which we point are
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a>. It would have been much less obvious in prior
+ versions of Java SE, were the returned type would have had to be
+ <code>Map&lt;String,ObjectName&gt;</code>, or
+ even worse just <code>Map</code>.
+ </p>
+ <p>However, it must be clear that the behaviour will be
+ quite different when an MXBean is returned as compared
+ to when a simple bean is returned.
+ </p>
+ <p>When an MXBean is returned, the remote client sees either
+ an ObjectName, if it is a generic client like jconsole, or
+ a proxy to a remote MXBean, if the client is working with the
+ MXBean interface. Invoking an operation on one of the
+ proxy returned by a method such as
+ <code>getDirectoryScanners</code> will cause the
+ MBean to be invoked on the remote server side.
+ </p>
+ <p>If <code>getDirectoryScanners</code> were
+ defined as:
+ <pre>
+ public Map&lt;String,DirectoryScannerConfig&gt; getDirectoryScanners();
+ </pre>
+ then invoking a method on one of the returned objects
+ would have absolutely no effect on the remote
+ server side - because the returned objects in this
+ case would simply be a bunch of serialized data objects.
+ </p>
+ <p>It is worth noting that although an MXBean interface
+ can have getters and operations which return an MXBean
+ interface, a regular standard MBean shouldn't have
+ any getters or methods which return MBean interfaces or
+ MXBean interfaces.
+ </p>
+ <p>For more information see also <a
+href="http://weblogs.java.net/blog/emcmanus/archive/2006/06/intermxbean_ref.html"
+title="Inter-MXBean references"
+ >Inter-MXBean References</a>.
+ </p>
+ </ul>
+ <h3>The MBeanRegistration interface, or how an MBean can
+ know or provide its own name</h3>
+ <ul>
+ <p>
+ Sometimes, an MBean needs to have a reference to the
+ MBeanServer in which it is registered, or needs to know
+ with which ObjectName it has been registered.
+ </p>
+ <p>
+ Sometimes also, an MBean may need to perform some
+ checks before being registered, or will need
+ to carry out some actions right after it has been
+ successfully registered in the MBeanServer.
+ </p>
+ <p>
+ Sometimes again, an MBean may need to perform some
+ checks, or some cleaning actions, just before, or
+ just after, it is unregistered.
+ </p>
+ <p>
+ When an MBean has such needs, the easiest solution
+ for it is to implement the <code>MBeanRegistration</code>
+ interface.
+ </p>
+ <p>The <code>MBeanRegistration</code> interface is a callback
+ interface which defines pre and post registration and
+ unregistration callbacks.
+ </p>
+ <p>
+ When an MBean implementing this interface is created
+ (with <code>createMBean</code>) or registered
+ (with <code>registerMBean</code>) in an MBeanServer,
+ the MBeanServer will call the <code>preRegister</code>
+ and <code>postRegister</code> method implemented by
+ the MBean. The <code>preRegister</code> method
+ has an <code>MBeanServer</code> and <code>ObjectName</code>
+ parameter, which are passed by the MBeanServer to the
+ MBean. The MBean can store the reference it is being passed
+ in a private instance variable for later use.
+ </p>
+ <p>
+ Most of the MXBeans we have defined in this example
+ implement the <code>MBeanRegistration</code> interface. The table
+ below show how our MBeans use this interface to control
+ their own names, make sanity checks, perform
+ initialization steps or cleanup actions.
+ </p>
+ <p><br><center>
+ <table border="1" cellpadding="4" cellspacing="2"
+ bgcolor="#eeeeee" width="95%">
+ <thead>
+ <tr bgcolor="#cecece">
+ <th width="20%">MBean Requirement</th>
+ <th>callback</th>
+ <th>use case example</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td bgcolor="#dedede">get a reference to the MBeanServer</td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> needs a reference
+ to the MBeanServer in order to create and
+ register other MBeans, such as the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a>, and the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a>.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">reject registration if conditions are
+ not met.
+ </td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> will throw
+ an IllegalArgumentException in <code>preRegister</code>
+ if the ObjectName it is being passed is
+ illegal. Throwing an exception in
+ <code>preRegister</code> makes the registration fail.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">get my client-assigned MBean name</td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> propagates the
+ value of the <code>name=</code> property of
+ the ObjectName it is given into its
+ ScanManagerConfig bean.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">provide my own default ObjectName if none
+ was given to the MBeanServer
+ </td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The name that is returned by <code>preRegister</code>
+ is the ObjectName with which the MBean will be
+ eventually registered.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> is able to suggest
+ a value for its own ObjectName if none was
+ provided. Similarly, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a>
+ always returns its singleton ObjectName
+ defined by <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html#SCAN_MANAGER_NAME"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean.SCAN_MANAGER_NAME</a>.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">perform initialization steps</td>
+ <td><code>preRegister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> uses <code>preRegister</code>
+ to initialize its internal ScanManagerConfig bean.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">perform initialization steps, once it is
+ known that the registration was successful.
+ </td>
+ <td><code>postRegister</code></td>
+ <td bgcolor="#fafafa">The <code>postRegister</code> method
+ can be used to implement
+ initialization steps that need to be done once it
+ is known that the registration was successful, or to
+ undo any action performed by <code>preRegister</code> once it
+ is known that registration was not successful.
+ The <code>postRegister</code> method has a Boolean parameter
+ which tells the MBean whether it was or wasn't
+ successfully registered in the MBeanServer.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses <code>postRegister</code> to create
+ and register other MBeans, such as the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> and the default
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a>.
+ Note that <code>postRegister</code> is not expected to throw any
+ exception. If an exception needs to be thrown, it should
+ be thrown in <code>preRegister</code>.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">check whether the MBean can be deregistered</td>
+ <td><code>preDeregister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses this method to verify
+ that its state allows it to be deregistered.
+ In particular, it will refuse to be deregistered
+ if it is in the RUNNING or SCHEDULED state.
+ If <code>preDeregister</code> throws an exception, the unregisterMBean
+ call will fail and the MBean will remain registered in
+ the MBeanServer.
+ Take particular care when implementing business logic
+ in this method: if the logic you implement has an
+ unfortunate bug which makes it always throw an
+ exception, you will never be able to unregister
+ that MBean.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">clean up resources, refusing to be deregistered if
+ it fails
+ </td>
+ <td><code>preDeregister</code></td>
+ <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses this method to unregister
+ all the other MBeans it has created and registered in the
+ MBeanServer. This includes the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a>, the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBeans</a> it has created, and the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a> it has created when
+ applying its configuration.
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#dedede">clean up resources which need to be released in
+ a best-effort way, when it is known that the MBean is no
+ longer registered.
+ </td>
+ <td><code>postDeregister</code></td>
+ <td bgcolor="#fafafa"><code>postDeregister</code> is only called if the MBean was succesfully
+ unregistered.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses this method to cancel
+ its internal java.util.Timer.
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </center><br></p>
+ </ul>
+ <h3>The Singleton MBean Pattern</h3>
+ <ul>
+ <p>
+ A singleton MBean is an MBean which can only have one
+ instance registered in a given MBeanServer. <br>
+ A singleton MBean usually has a well-known name,
+ which can be defined as a constant. In that case,
+ clients no longer need to call <code>new ObjectName(...)</code>
+ and catch the declared <code>MalformedObjectNameException</code>.
+ </p>
+ <p>There are already quite a few examples of singleton
+ MBeans in the java.lang.management API. The
+ ThreadingMXBean, ClassLoadingMXBean, RuntimeMXBean, etc.
+ are all singleton MBeans.
+ </p>
+ <p>In this example, we have two singleton MBeans:
+ The <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a></code> and the
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a></code>. But in fact,
+ the only real singleton MBean is the
+ <code>ScanManagerMXBean</code>. The
+ <code>ResultLogManagerMXBean</code> just happens to
+ be a singleton MBean because it has a 1-1 relationship
+ with the <code>ScanManagerMXBean</code>.
+ </p>
+ <p>The <code>ScanManagerMXBean</code> implements the
+ singleton MBean pattern in this way:
+ </p>
+ <ul>
+ <li>The <code>ScanManagerMXBean</code> name has a single
+ key property: <code>type=ScanManagerMXBean</code>.</li>
+ <li>Its name is defined by an ObjectName constant called
+ <code>SCAN_MANAGER_NAME</code> in the <code>ScanManager</code> class</li>
+ <li>The <code>ScanManagerMXBean</code> enforces its status of
+ singleton MBean. It will refuse to be registered
+ with a name other than
+ the <code>SCAN_MANAGER_NAME</code>. You can therefore depend on
+ the fact that the <code>ScanManagerMXBean</code> will always
+ be registered with its singleton <code>SCAN_MANAGER_NAME</code>
+ (see <code>preRegister</code>)
+ </li>
+ <li>You are not obliged to provide a name when you
+ register the <code>ScanManagerMXBean</code>: if you pass null,
+ then the <code>ScanManager</code> will be registered with
+ its singleton <code>SCAN_MANAGER_NAME</code>
+ (see <code>preRegister</code>).
+ </li>
+ <li>The <code>ScanManager</code> class has a no-arg static
+ <code>register</code> method that will register
+ the singleton instance in the Platform MBeanServer.
+ This static <code>register</code> method returns
+ a proxy to the registered singleton.
+ </li>
+ <li>The <code>ScanManager</code> class has also a static
+ <code>register</code> method that will create
+ a singleton instance in a (possibly remote)
+ MBeanServerConnection - using
+ <code>createMBean</code>.
+ This static <code>register</code> method
+ also returns a proxy to the registered singleton.
+ </li>
+ <li>Only the MBeanServer has a reference to the
+ singleton instance. The singleton instance is
+ not returned to the caller, and not kept
+ in any other static data structure.
+ </li>
+ </ul>
+ <p>
+ On the other hand, the <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a></code>
+ has a much more relaxed implementation of the pattern:
+ <br>It simply provides its own singleton name if it is
+ registered with a null ObjectName, but will not enforce
+ the use of that name.
+ </p>
+ <p>Note that all singleton MBean names in this example
+ are created using the <code>ScanManager.makeSingletonName</code>
+ method, which implements the pattern for ObjectNames suggested
+ in the JMX Best Practices.
+ </p>
+ </ul>
+ <h3>Managing the Life Cycle of dependent MBeans</h3>
+ <ul>
+ <p>A common task that many JMX applications have
+ is to manage the life cycle of MBeans registered
+ in the MBeanServer.</p>
+ <p>In this example, we have decided to follow a simple
+ pattern:</p>
+ <ul>
+ <li>The application is initialized simply
+ by registering the singleton
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> in
+ the MBeanServer.
+ </li>
+ <li>The <code>ScanManagerMXBean</code> will then
+ in turn register any other MBean that the
+ application might need:
+ <ul>
+ <li>It creates and registers the singleton
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a></code>
+ </li>
+ <li>It creates and registers the default
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a></code>
+ which loads the initial configuration
+ </li>
+ <li>It creates as many
+ <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBeans</a></code> as
+ needed when the configuration is applied
+ </li>
+ <li>It lets you create alternate
+ <code>ScanDirConfigMXBean</code>, to
+ which you can later switch in order
+ to apply a new alternate configuration.
+ </li>
+ </ul>
+ </li>
+ <li>When a new configuration is applied (or if the
+ current configuration is reapplied), the
+ <code>ScanManagerMXBean</code> will unregister
+ any <code>DirectoryScannerMXBeans</code> it has
+ previously registered, and will re-create
+ brand new <code>DirectoryScannerMXBeans</code>
+ from the applied configuration.
+ </li>
+ <li>When you unregister the <code>ScanManagerMXBean</code>,
+ it does all the cleanup for you, by unregistering
+ all the MBeans that it has created during the
+ course of the application.
+ </li>
+ </ul>
+ <p>The <code>ScanManagerMXBean</code> makes use of its
+ <code>MBeanRegistration</code> interface in order
+ to register the other MBeans it needs (see the
+ <code>ScanManager.postRegister</code> method) and to unregister
+ every MBean it has created (see the <code>ScanManager.preDeregister</code>
+ method).
+ </p>
+ <p>You will note that the <code>ScanManagerMXBean</code>
+ will only allow itself to be deregistered if it can be
+ closed - that is if there's no other action in
+ progress.
+ This is to make sure that the deregistration of
+ dependent MBeans will work smoothly.
+ <br>
+ The deregistration of related MBeans will happen
+ in the <code>ScanManager.preDeregister</code>
+ method.
+ <br>
+ If one of these MBeans could not be deregistered,
+ then the <code>ScanManagerMXBean</code> will throw
+ an exception, refusing to be deregistered.
+ <br>This leaves you a chance to try to deregister it
+ again later. Since the <code>ScanManagerMXBean</code>
+ has switched its state to CLOSED before starting
+ to unregister its dependent MBeans, it will refuse
+ any further actions, ensuring that e.g. nobody
+ can try to start it or schedule it while it
+ is in that partially-deregistered state.
+ </p>
+ <p>Handling the LifeCycle of all the application's
+ MBeans in a single MBean is usually a good design
+ pattern, especially if the application is a
+ module which is intended to share a JVM - or
+ an MBeanServer - with other modules.
+ </p>
+ <p>This is specially useful if the application needs to
+ be loaded and unloaded on demand: in that
+ case, simply registering or unregistering the top level
+ MBean (in our example the <code>ScanManagerMXBean</code>) does
+ the trick.
+ </p>
+ </ul>
+ <h3>Emitting Notifications</h3>
+ <ul>
+ <p>In order to emit notifications, an MBean must be
+ an instance of <code>NotificationEmitter</code>.
+ The <code>NotificationEmitter</code> interface defines methods
+ that the MBeanServer will call on the MBean in order
+ to register <code>NotificationListeners</code> with the MBean.
+ </p>
+ <p>It is worth noting that the MBean may not be
+ invoked each time a JMX client wants to register
+ a listener. For instance, the RMIConnectorServer
+ registers <i>only once</i> a single listener with each MBean
+ which is a <code>NotificationEmitter</code>.
+ In that specific case, the listener may even be registered
+ with the MBean before any client has actually subscribed
+ for notifications from that particular MBean.
+ </p>
+ <p>An MBean can therefore make no assumption about
+ which client or how many clients have registered for
+ notifications.
+ </p>
+ <p>It is also worth noting that the logic of the
+ methods defined in <code>NotificationEmitter</code> would not
+ be trivial to implement from scratch. Fortunately
+ the JMX API defines a helper class, called
+ <code>NotificationBroadcasterSupport</code>, which
+ provides an implementation for these methods.
+ </p>
+ <p>There are actually three ways for an MBean to
+ implement <code>NotificationEmitter</code>, of which only two
+ are recommended.
+ </p>
+ </ul>
+
+ <h4>Extending NotificationBroadcasterSupport</h4>
+ <ul>
+ <p>This is the simplest way of coding an MBean which
+ is a <code>NotificationEmitter</code>:
+ </p>
+ <p>Simply extend <code>NotificationBroadcasterSupport</code>,
+ then override its <code>getNotificationInfo</code> method
+ which returns the <code>MBeanNotificationInfo[]</code> array
+ that should be included in your MBean's <code>MBeanInfo</code>
+ and that's it.
+ <br>You just need to call the <code>sendNotification</code> method
+ inherited from <code>NotificationBroadcasterSupport</code> whenever
+ your MBean needs to send a notification.
+ </p>
+ <p>In our example, both the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> and <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> extend
+ <code>NotificationBroadcasterSupport</code> in order
+ to send notifications.
+ </p>
+ </ul>
+ <h4>The Delegation Pattern: delegating to a
+ NotificationBroadcasterSupport delegate</h4>
+ <ul>
+ <p>There may be cases however where delegating to a
+ wrapped <code>NotificationBroadcasterSupport</code>
+ object may be preferred to extending
+ <code>NotificationBroadcasterSupport</code>.
+ </p>
+ <p>For instance, if your MBeans already derive from
+ some base class, extending <code>NotificationBroadcasterSupport</code>
+ might not be an option.
+ </p>
+ <p>Similarly, if you do not want to have the inherited
+ <code>public void sendNotification(Notification notification)</code>
+ method appear in the Javadoc of the concrete class of your
+ MBean, you may want to consider using the delegation
+ pattern instead of extending
+ <code>NotificationBroadcasterSupport</code>
+ </p>
+ <p>In our example both the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a> use the delegation
+ pattern rather than extending
+ <code>NotificationBroadcasterSupport</code>.
+ In the end, choosing between one or the other method
+ is more a question of taste, although the delegation
+ pattern could be considered more flexible since it
+ doesn't require extending any given superclass.
+ </p>
+ <p>It may be also worth noting that some tools like
+ the JMX Module of <a
+href="http://www.netbeans.org"
+ >NetBeans IDE</a>, will be able to
+ generate for you all the code that delegates to a
+ wrapped <code>NotificationBroadcasterSupport</code>.
+ </p>
+ </ul>
+
+ <h4>Implementing NotificationEmitter from scratch</h4>
+ <ul>
+ <p>This is the last possibility for an MBean that
+ needs to send notifications: simply implement
+ <code>NotificationEmitter</code> from scratch. This is highly
+ discouraged since that logic is not trivial, and
+ already provided by
+ <code>NotificationBroadcasterSupport</code> anyway.
+ </p>
+ </ul>
+
+ <h4>Beware of Synchronization Locks</h4>
+ <ul>
+
+ <p>One thing you must keep in mind when sending
+ notifications is not to send them from within
+ a synchronized block, or while holding a lock on
+ some resource.</p>
+ <p>Indeed, what happens when you send a notification
+ may vary greatly depending on whether the client
+ which has registered for notifications has done
+ so through a <code>JMXConnector</code> (like the
+ <code>JMXRMIConnector</code>)
+ or through a direct reference to the MBeanServer
+ (by calling
+ <code>MBeanServer.addNotificationListener</code>).
+ </p>
+ <p>In this latter case, the listener will be invoked
+ synchronously in the same thread that your MBean is
+ using to send its notification. If by misfortune, the
+ code of that listener now re-enters your MBean through a
+ call that flows through a JMXConnector, a deadlock
+ could occur. It is therefore very important to release
+ any lock you may have before calling
+ <code>sendNotification</code>.</p>
+ <p>An easy way to do that is demonstrated in the
+ <code>ScanManager</code> class. The ScanManager
+ has an internal private queue of pending notifications.
+ When a notification needs to be sent (e.g. because the
+ ScanManager state is being switched), the notification
+ is simply prepared and put into the pending notification
+ queue.
+ The notification queue is then processed later on,
+ at the end of the method, when the processing is finally
+ completed and all the locks have been released.
+ <br>At this point the notification queue might already
+ have been emptied by another thread - in which case
+ the pending notifications will have already been
+ removed from the queue. Which thread actually gets
+ to send the notifications is of no importance. The
+ important point is that all the locks detained by
+ your MBean code in that thread were released before
+ the notification was sent.
+ </p>
+ <p>In our example the <code>ScanManager</code> class
+ ensures this by:
+ <ul>
+ <li>Only calling <code>sendNotification</code>
+ in its private <code>sendQueuedNotifications</code>
+ method.
+ </li>
+ <li>Only calling <code>sendQueuedNotifications</code>
+ when all locks have been released.
+ </li>
+ <li>Never calling a method that calls
+ <code>sendQueuedNotifications</code> from within
+ a synchronized block.</li>
+ </ul>
+ </p>
+ </ul>
+
+
+
+ <h4>Don't subclass Notification</h4>
+ <ul>
+ <p>Another common best practice when you want
+ to improve interoperability is to use directly
+ the Notification base classes provided in the
+ JMX<sup>TM</sup> API. Do not create your own
+ subclasses of these standard classes.
+ </p>
+ <p>Indeed, if you code your own subclass, a generic
+ client, like jconsole, will not be able to receive
+ that notification unless it has that custom
+ subclass in its classpath.
+ </p>
+ <p>
+ If you want your application to be interoperable, it is
+ therefore preferable not to subclass any of the standard
+ Notification classes. You can define your own
+ Notification type string, and if you need to send
+ additional data, you can put a CompositeData, or a
+ HashMap of serializable standard types in the
+ Notification's user data fields.
+ </p>
+ <p>In this example, we are using directly the
+ standard notification classes:
+ <ul>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a> both use directly
+ <code>AttributeChangeNotification</code> to notify
+ changes in their <code>State</code> attribute.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a>
+ also uses the base <code>Notification</code>
+ class directly in order to notify whenever
+ it finds a matching file.
+ <br>In that case, we simply use the base
+ <code>Notification</code>
+ class with a new
+ <b><code>com.sun.jmx.examples.scandir.filematch</code></b>
+ type.
+ </li>
+ <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> and <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+title="The ResultLogManagerMXBean is in charge of managing result logs"
+ >ResultLogManagerMXBean</a> also both use the base
+ <code>Notification</code> class.
+ </li>
+ </ul>
+ <p>Careful readers will have noted that the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
+ >DirectoryScannerMXBean</a> both use the
+ <code>AttributeChangeNotification</code> class
+ to notify about their state change, whereas the
+ <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> uses the base
+ <code>Notification</code> class.
+ </p>
+ <p>In fact, this is because the semantics of these
+ notifications is not exactly the same - although
+ both denote a state change:
+ <ul>
+ <p>In the case of <code>ScanManagerMXBean</code>
+ and <code>DirectoryScannerMXBean</code>, the
+ notification which is emitted is more about a
+ state transition, from one state to another.
+ For instance, going from <code>RUNNING</code>
+ to <code>STOPPED</code>, or from
+ <code>SCHEDULED</code> to <code>STOPPED</code>.
+ <br>In that case, the
+ <code>AttributeChangeNotification</code> was
+ more appropriate because it made it possible
+ to send the previous and the new value of the
+ state attribute, thus reflecting the whole
+ state transition.
+ </p>
+ <p>In the case of the <code>ScanDirConfigMXBean</code>
+ however, what is of interest is the state in
+ which the MBean has arrived. Using the base
+ <code>Notification</code> class with three different
+ notification type strings -
+ <b><code>com.sun.jmx.examples.scandir.config.loaded</code></b>,
+ <b><code>com.sun.jmx.examples.scandir.config.modified</code></b>,
+ and
+ <b><code>com.sun.jmx.examples.scandir.config.saved</code></b> -
+ was therefore closer to what we wanted to model.
+ </p>
+ </ul>
+ </p>
+ </ul>
+
+ <h3>Configuration MBeans</h3>
+ <ul>
+ <p>A common practice when designing a management application is
+ to have an MBean, or a set of MBeans, dedicated to configuration.
+ Separating configuration from control and monitoring allows
+ more appropriate logic, and often simplifies the design and
+ implementation of the management interface.
+ </p>
+ <p>
+ In our example, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a> is dedicated to the application configuration.
+ </p>
+ <p>The <code>ScanDirConfigMXBean</code> will let you interactively
+ modify, save, or load the application configuration. The modifications
+ will not be taken into account until it is applied, by invoking
+ <code>applyConfiguration</code> on the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a>.
+ It is also possible to create many configurations, by creating as
+ many <code>ScanDirConfigMXBean</code>s, and then to choose and apply
+ one of these configurations by calling
+ <code>ScanManagerMXBean.setConfigurationMBean</code> and then
+ <code>ScanManagerMXBean.applyConfiguration</code>.
+ </p>
+ <p>In this way, all configurations aspects are gathered and concentrated
+ inside the <code>ScanDirConfigMXBean</code> instead of being scattered
+ throughout all the MBeans that compose the application.
+ </p>
+ <p>In order to save and store the application configuration data, the
+ <code>ScanDirConfigMXBean</code> uses a set of XML serializable Java beans
+ defined in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/package-summary.html"
+title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
+ >com.sun.jmx.examples.scandir.config</a> package. These beans are very
+ simple Java beans which have been lightly annotated for XML binding.
+ </p>
+ <p>It is worth noting that these same beans can also be handled by the
+ MXBean framework (our beans don't contain recursive data structures) and can
+ therefore be used directly as attributes and parameters of MXBeans, without
+ needing to be Java-serializable (the MXBean framework transform them in
+ CompositeData objects - which <b>are</b> serializable).
+ </p>
+ <p>The same <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/ScanManagerConfig.html"
+title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
+ >ScanManagerConfig</a> bean that we use to read from and write to the
+ XML configuration file is thus also used as attribute of the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+title="The ScanDirConfigMXBean is in charge of the configuration"
+ >ScanDirConfigMXBean</a>. It is transformed into a <code>CompositeData</code>
+ by the MXBean framework, and can be easily introspected with
+ <a href="#JConsole">jconsole</a>.
+ </p>
+ </ul>
+ <h3>MBeans Must Be Thread-Safe</h3>
+ <ul>
+ <p>A question often asked by newcomers to JMX technology
+ is whether the MBeanServer is thread-safe. Well, the MBeanServer <b>is</b>
+ thread safe, but it doesn't put any locks on the MBeans it contains. The
+ MBeans can be concurrently accessed by multiple threads, and must therefore
+ take care of their own thread safety.
+ </p>
+ <p>In this example, we have been using two methods to ensure thread
+ safety for our MBeans: synchronized blocks, and semaphores.
+ </p>
+ <p>Using synchronized blocks is probably the most common and easiest way
+ to implement thread safety in Java. When dealing with MBeans though, here
+ are a couple of rules to keep in mind:
+ <ul>
+ <li>Don't send notifications from within a synchronized block: there's
+ no way to tell whether the listener's code will be executed in the
+ same thread or a different thread, and holding a lock in these
+ conditions is therefore dangerous, as it could lead to deadlocks.</li>
+ <li>Also avoid invoking another MBean from a synchronized block
+ unless you are completely in control of both MBeans, and you can
+ ascertain that it won't lead to any deadlock. Indeed, if you invoke an
+ MBean exposed by another application, it can be sometime hard to
+ know with certainty whether holding a lock while invoking that
+ MBean will have any side effect. Maybe that MBean will make
+ further calls to other MBeans which will in turn try to call
+ your MBean, or maybe it will emit a
+ notification, and we'll be back to the considerations just
+ above.</li>
+ </ul>
+ </p>
+ <p>Another means of implementing thread-safe code is to use semaphores.
+ The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> uses a semaphore called
+ <code>sequencer</code> to ensure
+ that critical code sections are not executed concurrently. In this
+ MBean, we use <code>Semaphore.tryAcquire</code> to lock the sequencer
+ semaphore before entering the critical section. If the
+ <code>Semaphore.tryAcquire</code> returns true then we enter the critical
+ section. If it returns false, we throw an IllegalStateException, stating
+ that we couldn't acquire the lock. The code looks like this:
+ <pre>
+ if (!sequencer.tryAcquire())
+ throw new IllegalStateException("resource locked");
+ try {
+ // critical code here ...
+ } finally {
+ // Always use try/finally to ensure that the semaphore
+ // will be released, even if exceptions or errors are raised!
+ sequencer.release();
+ }
+ </pre>
+ </p>
+ <p>Using <code>Semaphore.tryAcquire</code> and throwing an exception if
+ the semaphore is already locked makes it safer to call other MBeans
+ from within the critical section: in potential deadlock situations
+ the calling code will get the <code>IllegalStateException</code>
+ instead of being blocked on the deadlocked lock.
+ </p>
+ <p>It is worth noting that each of these techniques has its own
+ advantages and disadvantages - which can make one of them more or less
+ appropriate depending on the inner logic of the MBean you're implementing.
+ </p>
+ <p>Careful readers will also have noted that we used
+ <code>IllegalStateException</code> directly, instead of defining
+ our own subclass of RuntimeException, which could have had a more
+ precise semantics. If you define a new exception for your JMX application,
+ you must keep in mind that your client will need to have the class
+ of your exception in its classpath to get that exception.
+ Otherwise your client will get a completely different exception, indicating a
+ deserialization issue.
+ </p>
+ </ul>
+
+ <h3>Waiting for Notifications</h3>
+ <ul>
+ <p>Implementing code that needs to wait for notifications is sometimes
+ difficult. Because notifications are asynchronous, doing something
+ like:
+ <pre>
+ // register a notification listener
+ ...
+ // start a management action
+ ...
+ // wait for a notification
+ ...
+ // do something based on whether the expected notification
+ // is received
+ ...
+ </pre>
+ is not always trivial. However, there's a very easy way to do that: use
+ a blocking queue of notifications.
+ <pre>
+ final BlockingQueue&lt;Notification&gt; notifQueue =
+ new LinkedBlockingQueue&lt;Notification&gt;();
+
+ final NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ // Just put the received notification in the queue.
+ // It will be consumed later on.
+ //
+ notifQueue.put(notification);
+ } catch (InterruptedException ex) {
+ // OK
+ }
+ }
+ };
+
+ // register the listener - possibly also as a JMXConnectionNotification
+ // listener to get Notification Lost notification
+ ...
+ // start management action
+ ...
+ // wait for notification
+ while (expected notif not received and delay not expired) {
+ Notification n = notifQueue.poll(3,TimeUnit.SECONDS);
+ // if expected notif, do something
+ ...
+ }
+ // if expected notification not received do something else.
+ ....
+ </pre>
+ </p>
+ <p>You will note that this is a technique we've been using in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+title="The ScanDirAgent class defines a main method for the scandir application"
+ >ScanDirAgent</a> class and in the example unit tests.
+ </p>
+ </ul>
+
+ <h3>Holding hard references to other MBeans: proxy or direct reference?</h3>
+ <ul>
+ <p>We have seen that MXBeans will let you return proxy references to other
+ MXBeans. But should that MXBean hold a direct reference to the MXBeans it
+ relates to, or would it be better for it to hold only a proxy?
+ </p>
+ <p>
+ As a general rule it is better when an MBean reference is
+ only held by the MBeanServer. It is a better design
+ to hold a reference to a proxy, rather than to hold
+ a hard reference to an MBean. However there are two cases
+ when holding a hard reference might be preferred:
+ <ol>
+ <li>When MBean A needs to call a method of method B which
+ is not part of its MBean interface</li>
+ <li>When the overhead of going through the MBeanServer
+ plus the MXBean framework is too great (frequently-called
+ method, with creation of OpenType)</li>
+ </ol>
+ However - holding a hard reference is only advisable
+ when both MBeans are created by the same piece of code,
+ and the application can ensure that the life cycle
+ of each MBean is consistent with regard to the other.
+ </p>
+ <p>In our example, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> holds only proxy references to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+ >ScanDirConfigMXBean</a> and the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
+ >DirectoryScannerMXBeans</a>. <br>
+ However it holds a direct reference to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html"
+ >ResultLogManager</a>. This makes it possible to pass a direct
+ reference to the <code>DirectoryScannerMXBeans</code>,
+ which can then log their results
+ more efficiently, and would also make it possible to remove
+ the <code>log</code> method from the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+ >ResultLogManagerMXBean</a> interface - leaving it in the
+ <code>ResultLogManager</code> class (possibly as a package method)
+ should we wish to do so.
+ </p>
+
+ </ul>
+
+ <h3>Agent Class</h3>
+ <ul>
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
+title="The ScanDirAgent class defines a main method for the scandir application"
+ >ScanDirAgent</a> is the Agent class for the <i>scandir</i> application.
+ This class contains the <code>main</code> method to start a standalone
+ <i>scandir</i> application.
+ </p>
+ <p>The <code>main</code> method simply registers a <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a> in the platform MBeanServer, and then waits
+ for someone to call <code>ScanManagerMXBean.close</code>.
+ </p>
+ <p>
+ When the <code>ScanManagerMXBean</code> state is switched to
+ <code>ScanManagerMXBean.ScanState.CLOSED</code>, the
+ <code>ScanManagerMXBean</code> is unregistered, and the application
+ terminates (i.e. the main thread completes).
+ </p>
+ <p>Standalone JMX applications usually have an Agent class that contain
+ their <code>main</code> method, which performs all the MBean
+ registration steps.
+ However, it is usually not a bad idea if that class can
+ be easily turned into an MBean. Indeed, this will make your
+ application easier to integrate in an environment where it would
+ no longer be standalone and would no longer control the implementation
+ of <code>main</code>. In our example the Agent
+ class could be easily turned into an MBean, exposing its three
+ <code>init</code>, <code>waitForClose</code> and <code>cleanup</code>
+ method. However we didn't go as far as turning it into an MBean since
+ the application can be already easily started by registering an instance
+ of <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
+title="The ScanManagerMXBean is the main MBean of the scandir application"
+ >ScanManagerMXBean</a>.
+ </p>
+ </ul>
+ <h3>Secure Client Class</h3>
+ <ul>
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
+title="The ScanDirClient class is a very short example of secure programmatic client"
+ >ScanDirClient</a> is an example class that shows how a
+ programmatic client can connect to a secured <i>scandir</i> application.
+ This class contains a <code>main</code> method which creates and
+ configures a <code>JMXConnector</code> client to connect with
+ a secured <i>scandir</i> daemon. This class will not work with
+ the default unsecured agent since it requires mutual authentication.
+ </p>
+ <p>How to secure a JMX <i>scandir</i> application and run
+ the secure <code>ScanDirClient</code> is discussed <a href="#secure"
+ >later</a> in this document.
+ </p>
+ <p>The <code>ScanDirClient</code> is not really part of the
+ application - and is given here only for the sake of
+ the example.
+ </p>
+ </ul>
+
+ <h2><a name="h2-Testing">Testing the <i>scandir</i> Example</a></h2>
+ <ul>
+ <p>Make sure that you have access to junit.jar (either 3.8.1 or 3.8.2).
+ Make sure also that you have junit.jar in your
+ <code>CLASSPATH</code>.<br>
+ Then in the example root directory (where the <code>build.xml</code>
+ file is located) run the following command:
+ <pre>ant test -Dlibs.junit.classpath=<i><u>path to junit jar (either 3.8.1 or 3.8.2)</u></i></pre>
+ </p>
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE and test the jmx-scandir project from the
+ <code>Run</code> menu.
+ </p>
+
+ </ul>
+
+ <h2><a name="h2-Running">Running the <i>scandir</i> Example</a></h2>
+ <ul>
+ <p>In the example root directory (where the <code>build.xml</code>
+ file is located) run the following commands:
+ <pre>ant jar
+ant run-single -Drun.class=com.sun.jmx.examples.scandir.ScanDirAgent -Djavac.includes=src</pre>
+ or simply <pre>ant run</pre>
+ </p>
+
+ <p>This will run the example using the configuration
+ file provided in the src/etc directory.
+ </p>
+ <p>Alternatively you can open the jmx-scandir project with the
+ NetBeans IDE. You can run the example by
+ selecting the <code>ScanDirAgent</code> file
+ and run it with <code>Run File</code> in the
+ <code>Run</code> menu or simply
+ set the <i>jmx-scandir</i> project as main project and
+ select <code>Run Main Project</code> from the
+ main menu. Both targets will use the configuration
+ file provided in the src/etc directory.
+ </p>
+ <p>When the application is started, you can connect to
+ it with <a href="#JConsole">jconsole</a>.
+ </p>
+ <blockquote>
+ <u>Note:</u> You can also run the <i>scandir</i>
+ application directly from the <code>java</code>
+ command line. Make sure to build the project jar
+ first.
+ <br>On Unix systems:
+ <pre>ant jar
+java -Djava.util.logging.config.file=logging.properties \
+ -Dscandir.config.file=src/etc/testconfig.xml \
+ -jar dist/jmx-scandir.jar</pre>
+ <br>On Windows systems:
+ <p><code>ant jar<br>
+java &nbsp;-Djava.util.logging.config.file=logging.properties
+ &nbsp;-Dscandir.config.file=src\etc\testconfig.xml
+ &nbsp;-jar&nbsp;dist\jmx-scandir.jar</code></p>
+ </blockquote>
+ </ul>
+
+ <h2><a name="h2-Playing">Playing with JConsole</a></h2>
+ <ul>
+ <p>Run the example as explained in the previous section, so
+ that it uses the provided <code>src/etc/testconfig.xml</code>
+ configuration file. Then start
+ jconsole. In the connection window choose the process that runs
+ <code>com.sun.jmx.examples.scandir.ScanDirAgent</code> or
+ <code>jmx-scandir.jar</code>.
+ </p>
+ <p><center>
+ <table border="0" cellpadding="2" cellspacing="2">
+ <tr><td>
+ <a href="docfiles/connect-local-ant-run.jpg"
+ title="jconsole connection window - connect to local process"
+ ><img height="440"
+ src="docfiles/connect-local-ant-run.jpg"
+ alt="jconsole connection window - connect to local process"
+ /></a>
+ </td>
+ <td>
+ <a href="docfiles/connect-local-java-jar.jpg"
+ title="jconsole connection window - connect to local process"
+ ><img height="440"
+ src="docfiles/connect-local-java-jar.jpg"
+ alt="jconsole connection window - connect to local process"
+ /></a>
+ </td></tr></table>
+ </center>
+ </p>
+ <p>Open the MBeans tab, and look for the
+ <code>ScanDirConfigMXBean</code>.
+ Click on its <code>Attributes</code> node and double click on its
+ <code>Configuration</code> attribute, to look at
+ the loaded configuration - values in bold can
+ be expanded by a double-click.
+ </p>
+ <p><center><a href="docfiles/scandir-config.jpg"
+ title="jconsole MBean tab: ScanDirConfigMXBean"
+ ><img
+ src="docfiles/scandir-config.jpg"
+ alt="jconsole MBean tab: ScanDirConfigMXBean"
+ /></a></center>
+ </p>
+ <p>Now go to the <code>ScanManagerMXBean</code>, click on
+ its <code>Notifications</code> node, and subscribe
+ for notifications. Then click on the
+ <code>Operations</code> node and invoke the
+ <code>start()</code> operation:
+ </p>
+ <p><center><a href="docfiles/scandir-start.jpg"
+ title="jconsole MBean tab: ScanDirConfigMXBean"
+ ><img
+ src="docfiles/scandir-start.jpg"
+ alt="jconsole MBean tab: ScanDirConfigMXBean"
+ /></a></center>
+ </p>
+ <p>You can see that the notifications counter was
+ incremented by three: you have just scheduled,
+ run, and completed a batch of directory scans.
+ </p>
+ <p>Now go to the <code>ResultLogManagerMXBean</code>,
+ click on its <code>Attributes</code> node, and
+ expand its <code>MemoryLog</code> attribute:
+ </p>
+ <p><center><a href="docfiles/scandir-result.jpg"
+ title="jconsole MBean tab: ScanDirConfigMXBean"
+ ><img
+ src="docfiles/scandir-result.jpg"
+ alt="jconsole MBean tab: ScanDirConfigMXBean"
+ /></a></center>
+ </p>
+ <p>You can see that the directory scan results have
+ been logged.</p>
+ <p>To make the application terminate go back to the
+ <code>ScanManagerMXBean</code> and invoke
+ <code>close()</code>. The <code>ScanDirAgent</code>
+ will receive the notification, step out of
+ the application main thread, and the application
+ will terminate.
+ </p>
+ <p>This is of course a very limited scenario. Feel free
+ to improvise with all the features of the example, creating
+ a new configuration -
+ <code>ScanManagerMXBean.createOtherConfigurationMBean</code> -
+ adding multiple directory scanners to that configuration -
+ <code>ScanDirConfigMXBean.addDirectoryScanner</code> -
+ then switching the <code>ScanManagerMXBean</code> current
+ configuration by changing the value of the <i>ConfigurationMBean</i>
+ attribute - <code>ScanManagerMXBean.setConfigurationMBean</code>
+ - then applying the new configuration -
+ <code>ScanManagerMXBean.applyConfiguration(true)</code> -
+ then scheduling repeated directory scans every 10 seconds -
+ <code>ScanManagerMXBean.schedule(0,10000)</code> -
+ subscribing for notifications, etc...
+ </p>
+ </ul>
+
+ <a name="secure"></a>
+ <h2><a name="h2-Turning">Turning the example into a Secure JMX Application</a></h2>
+ <ul>
+ <p>In this section, we will see how to configure and
+ start the <i>scandir</i> example so that the JVM agent
+ is bootstrapped with a secure JMXConnectorServer. Indeed, until
+ now we have only used the insecure local connection,
+ which can only be used as long as both the client and
+ the server run on the same machine. This section will
+ explain how to start the <code>ScanDirAgent</code> so
+ that a real secure RMIConnectorServer is started at bootstrap.
+ </p>
+ <p>To achieve this we will: <a href="#management.properties"
+ >provide our own management.properties</a>, <a
+ href="#password-access">create our own password and access files</a>,
+ <a href="#keystore-truststore">provide a keystore and truststore</a>,
+ <a href="#start-secure-agent">start the ScanDirAgent with the
+ appropriate system properties</a>.
+ </ul>
+ <h3>Configuring the JVM Agent for Secure Remote Connection</h3>
+ <ul>
+ <p>The easiest way to <a name="management.properties">configure the
+ JVM Agent</a> for Secure Remote
+ Connection is to use your own <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#properties"
+ title="This page describes the properties you can put in your management.properties file"
+ >management.properties</a> file.
+ In this example, we have copied the default
+ <code>$JRE/lib/management/management.properties</code>
+ file to the example's <code>src/etc</code> directory and
+ modified it in <a href="src/etc/management.properties"
+ title="our modified management.properties"
+ >this way</a>:
+ <ul>
+ <li>We have set the RMI port to <u>4545</u> - this is just a
+ random port number we have picked up. Feel free to use your
+ own value suited to your environment.
+ <pre># For setting the JMX RMI agent port use the following line
+com.sun.management.jmxremote.port=<b>4545</b></pre>
+ </li>
+ <li>We have <u>switched on</u> SSL <u>mutual authentication</u>
+ <pre># For RMI monitoring with SSL client authentication use the following line
+com.sun.management.jmxremote.ssl.<b>need.client.auth</b>=<b>true</b></pre>
+ </li>
+ <li>We have also <u>secured the RMI Registry</u> with SSL
+ <pre># For using an SSL/TLS <b>protected</b> RMI Registry use the following line
+com.sun.management.jmxremote.<b>registry.ssl</b>=<b>true</b></pre>
+ </li>
+ <li>We have provided <a
+ href="src/etc/password.properties">our own password file</a>
+ <pre># For a non-default password file location use the following line
+com.sun.management.jmxremote.password.file=<i>src/etc/password.properties</i></pre>
+ </li>
+ <li>We have provided <a
+ href="src/etc/access.properties">our own access file</a>
+ <pre># For a non-default password file location use the following line
+com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
+ </li>
+ </ul>
+ <p>You will note that we haven't provided any value
+ for the other security properties, like
+ <code>com.sun.management.jmxremote.authenticate=true</code>,
+ because these properties already default to a value
+ which enables security by default.
+ Note however that protecting the RMI Registry with SSL
+ improves the application security, but only as long as
+ mutual authentication is also switched on. Otherwise, just
+ anybody would be able to connect to the registry and
+ get the RMIServer stub.
+ </p>
+ <p>We do recommend that you <u>use the most secure configuration
+ when you deploy a JMX agent</u> - which means <u>switching on
+ SSL protection for the RMI registry</u> <b>and</b> <u>requiring
+ mutual authentication</u>, as we show in this example.
+ </p>
+ <p>We will use the <code>com.sun.management.config.file</code>
+ system property to pass our <a
+ href="src/etc/management.properties">management.properties</a>
+ file to the <code>ScanDirAgent</code>.
+ </p>
+ </ul>
+
+ <h3>Creating a password and access file</h3>
+ <ul>
+ <p>As explained above, we have created our own
+ <a href="src/etc/password.properties">password file</a>
+ and <a href="src/etc/access.properties">access file</a>
+ for <a name="password-access">access control and authorization</a>.
+ </p>
+ <p>In the password file, we have defined two logins:
+ <i>guest</i> and <i>admin</i>. The password for
+ <i>guest</i> is <i>guestpasswd</i> and the password
+ for <i>admin</i> is <i>adminpasswd</i>.
+ </p>
+ <p>In the access file, we have mapped these two logins
+ to access rights: the <i>admin</i> login has <i>read-write</i>
+ access, while the <i>guest</i> login only has <i>read-only</i>.
+ </p>
+ <p>Before starting the <code>ScanDirAgent</code>, you will
+ need to restrict access permission to the password file,
+ in such a way that nobody but you can read it. Otherwise, the
+ JVM Agent will refuse to start the JMXConnectorServer, as it will
+ fear that security can be compromised if other parties can
+ have read access to the password file. How to restrict
+ read access to the password file is explained in detail
+ <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#PasswordAccessFiles"
+ title="Using Password and Access Files"
+ >here</a>.
+ </p>
+ <p>As we have seen above, the location
+ of our access and password files is configured in our own <a
+ href="src/etc/management.properties">management.properties</a>
+ file.
+ </p>
+ </ul>
+ <h3>Keystore and Truststore</h3>
+ <ul>
+ <p>Using SSL with mutual authentication means that both
+ client and server will need a <a name="keystore-truststore"
+ >keystore and a truststore</a>
+ to store their own certificates, and the certificates of
+ the parties they trust. Usually, client and server will
+ have their own keystore and truststore.
+ </p>
+ <p>For the sake of simplicity - and to get you started
+ without the tedious necessity of creating your own keystore
+ and truststore, we are providing a dummy keystore and
+ truststore, containing a certificate self-signed by duke.
+ The password for our keystore is <i>password</i>, and the
+ password for our truststore is <i>trustword</i>.
+ We suggest that you first get the example running with the
+ keystore and truststore we are providing before attempting
+ to use your own keystore and truststore.
+ </p>
+ <p>A secure application will obviously need to use its own
+ keystore and truststore, <b><u>and should not rely on the keystore
+ and truststore we are providing here!</u></b>
+ </p>
+ <p>How to create your own keystore and truststore, is explained
+ in <a
+href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
+title="Monitoring and Management Using JMX"
+ >here</a>.
+ As shown <a href="#start-secure-agent">later</a>,
+ we will need to use <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
+ >system properties</a> to pass our truststore
+ and keystore to the <code>ScanDirAgent</code>.
+ </p>
+ </ul>
+ <h3>Starting a Secure <i>scandir</i> agent</h3>
+ <ul>
+ <p>To start a <a name="start-secure-agent"
+ >secure <i>scandir</i> agent</a>, go to the
+ <i>scandir</i> example root directory and type the
+ following command:</p>
+ <p>On Unix Systems:
+<pre>ant jar
+java \
+ -Djava.util.logging.config.file=logging.properties \
+ -Djavax.net.ssl.keyStore=keystore \
+ -Djavax.net.ssl.keyStorePassword=password \
+ -Djavax.net.ssl.trustStore=truststore \
+ -Djavax.net.ssl.trustStorePassword=trustword \
+ -Dcom.sun.management.config.file=src/etc/management.properties \
+ -Dscandir.config.file=src/etc/testconfig.xml \
+ -jar dist/jmx-scandir.jar</pre>
+ </p>
+ <p>On Windows Systems:
+<p><code>ant jar<br>
+java
+ &nbsp;-Djava.util.logging.config.file=logging.properties
+ &nbsp;-Djavax.net.ssl.keyStore=keystore
+ &nbsp;-Djavax.net.ssl.keyStorePassword=password
+ &nbsp;-Djavax.net.ssl.trustStore=truststore
+ &nbsp;-Djavax.net.ssl.trustStorePassword=trustword
+ &nbsp;-Dcom.sun.management.config.file=src\etc\management.properties
+ &nbsp;-Dscandir.config.file=src\etc\testconfig.xml
+ &nbsp;-jar&nbsp;dist\jmx-scandir.jar</code></p>
+ </p>
+ <p>If you start jconsole now, you will see that you
+ are still able to connect to the agent using the
+ local connection. However, if you try to connect
+ through the remote connector, using
+ <a href="docfiles/remote-connection.jpg">localhost:4545</a>,
+ the connection will <a href="docfiles/remote-connection-failed.jpg"
+ >fail</a>, even if you provide a correct login/password
+ pair. Indeed, since the JMXConnectorServer is now protected with SSL,
+ jconsole must also be configured with the appropriate SSL parameters
+ so that it can authenticate the server and get authenticated by the
+ server too as the SSL configuration of the server requires mutual
+ authentication.
+ </p>
+ <p>The next section will discuss how to connect to the
+ secure agent.
+ </p>
+ </ul>
+
+ <h2><a name="h2-Connecting">Connecting to the Secure JMX Application</a></h2>
+ <ul>
+ <p>We will now see how to connect to the secure agent,
+ using jconsole, and using a programmatic client.
+ </p>
+ </ul>
+
+ <h3>Using jconsole to connect to the secure agent</h3>
+ <ul>
+ <p>The only special thing you need to do in order to
+ be able to connect to your secure agent with
+ jconsole, is to give it a keystore (containing
+ its client certificate) and a truststore (containing
+ the certificates of the servers it can trust).
+ In our example, we use the same keystore/truststore
+ pair on the client and server side - but this is
+ not what a real application would do.
+ Indeed a real application would have different
+ certificates for the client and the server, and
+ thus use different keystores (and probably truststores).
+ More information on SSL authentication can be obtained from the <a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
+ title="How SSL Works"
+ >Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>.
+ </p>
+ <p>To start jconsole with our provided keystore and
+ truststore, go to the scandir example root directory and
+ type in the following command:
+ <p><code>jconsole
+ &nbsp;-J-Djava.util.logging.config.file=logging.properties
+ &nbsp;-J-Djavax.net.ssl.keyStore=keystore
+ &nbsp;-J-Djavax.net.ssl.keyStorePassword=password
+ &nbsp;-J-Djavax.net.ssl.trustStore=truststore
+ &nbsp;-J-Djavax.net.ssl.trustStorePassword=trustword</code></p>
+ </p>
+ <p>The <code>-J-Djava.util.logging.config.file=logging.properties</code>
+ flag is not mandatory, but passing a <code>logging.properties</code>
+ may help you debug connection problems if anything goes wrong.
+ </p>
+ <p>In jconsole connection window, choose to connect to a
+ remote process, using the address <i>localhost:4545</i>
+ and the guest login:
+ </p>
+ <p><center><a href="docfiles/remote-connection.jpg"
+ ><img src="docfiles/remote-connection.jpg"
+ alt="jconsole connection window"/></a></center>
+ </p>
+ <p>You will see that the agent will let view all the
+ MBeans and their attributes, but will reject any
+ attribute modification or remote method invocation.
+ </p>
+ <hr>
+ <p><u>Note:</u> if jconsole fails to connect and show
+ you <a href="docfiles/remote-connection-failed.jpg">this screen</a>
+ you have probably misspelled some of the properties on jconsole
+ command line, or you didn't start jconsole from the
+ scandir example root directory where our <code>truststore</code>
+ and <code>keystore</code> files are located. This article - <a
+ href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
+ title="Troubleshooting connection problems in JConsole"
+ >Troubleshooting connection problems in JConsole</a> - may help
+ you figure out what is going wrong.
+ </p>
+ <hr>
+ </ul>
+
+ <h3>Writing a programmatic client to connect to the secure agent</h3>
+ <ul>
+ <p>
+ In this section we will show the steps involved in writing
+ a programmatic client that will connect to our secure agent.
+ </p>
+ <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
+title="The ScanDirClient class is a very short example of secure programmatic client"
+ >ScanDirClient</a> is an example class that shows how a
+ programmatic client can connect to a secured <i>scandir</i> application.
+ This class contains a <code>main</code> method which creates and
+ configures a <code>JMXConnector</code> client to connect with
+ the secured <i>scandir</i> agent.
+ </p>
+ <p>The secure client differs only from a non secure client in
+ so far as it needs to use SSL RMI Factories and credentials to
+ connect to the secure agent. The steps required mainly involve:
+ <ul>
+ <li>Creating an empty environment map:
+ <pre>
+ // Create an environment map to hold connection properties
+ // like credentials etc... We will later pass this map
+ // to the JMX Connector.
+ //
+ System.out.println("\nInitialize the environment map");
+ final Map&lt;String,Object> env = new HashMap&lt;String,Object>();
+ </pre>
+ </li>
+ <li>Putting the client's credentials in that map:
+ <i>(here the client will log in as <b>guest</b>)</i>
+ <pre>
+ // Provide the credentials required by the server
+ // to successfully perform user authentication
+ //
+ final String[] credentials = new String[] { "guest" , "guestpasswd" };
+ env.put("jmx.remote.credentials", credentials);
+ </pre>
+ </li>
+ <li>Providing an <code>SslRMIClientSocketFactory</code> to interact
+ with the secure RMI Registry:
+ <pre>
+ // Provide the SSL/TLS-based RMI Client Socket Factory required
+ // by the JNDI/RMI Registry Service Provider to communicate with
+ // the SSL/TLS-protected RMI Registry
+ //
+ env.put("com.sun.jndi.rmi.factory.socket",
+ new SslRMIClientSocketFactory());
+ </pre>
+ </li>
+ <li>Creating a JMXConnector and connecting with the
+ secure server:
+ <pre>
+ // Create the RMI connector client and
+ // connect it to the secure RMI connector server.
+ // args[0] is the server's host - localhost
+ // args[1] is the secure server port - 4545
+ //
+ System.out.println("\nCreate the RMI connector client and " +
+ "connect it to the RMI connector server");
+ final JMXServiceURL url = new JMXServiceURL(
+ "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1]+
+ "/jmxrmi");
+ final JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
+ </pre>
+ </li>
+ </ul>
+ <p>For this to work, we also need to start the <code>ScanDirClient</code>
+ with the appropriate system properties that will point to our
+ <code>keystore</code> and <code>truststore</code>. To start the secure
+ client, go to the <i>scandir</i> example root directory and type
+ the following command:
+ <p><code>ant jar<br>
+java
+ &nbsp;-Djava.util.logging.config.file=logging.properties
+ &nbsp;-Djavax.net.ssl.keyStore=keystore
+ &nbsp;-Djavax.net.ssl.keyStorePassword=password
+ &nbsp;-Djavax.net.ssl.trustStore=truststore
+ &nbsp;-Djavax.net.ssl.trustStorePassword=trustword
+ &nbsp;-classpath&nbsp;dist/jmx-scandir.jar
+ &nbsp;com.sun.jmx.examples.scandir.ScanDirClient&nbsp;localhost&nbsp;4545
+ </code></p>
+ </p>
+ <p>You should be seeing this trace:
+<center><table width="90%" border="0" bgcolor="#eeeeee">
+<tr><td>
+<pre>
+Initialize the environment map
+
+Create the RMI connector client and connect it to the RMI connector server
+Connecting to: service:jmx:rmi:///jndi/rmi://localhost:4545/jmxrmi
+
+Get the MBeanServerConnection
+
+Get ScanDirConfigMXBean from ScanManagerMXBean
+
+Get 'Configuration' attribute on ScanDirConfigMXBean
+
+Configuration:
+
+&lt;ScanManager xmlns="jmx:com.sun.jmx.examples.scandir.config" name="testconfig">
+ &lt;InitialResultLogConfig>
+ &lt;LogFileMaxRecords>2048&lt;/LogFileMaxRecords>
+ &lt;LogFileName>build/scandir.log&lt;/LogFileName>
+ &lt;MemoryMaxRecords>128&lt;/MemoryMaxRecords>
+ &lt;/InitialResultLogConfig>
+ &lt;DirectoryScannerList>
+ &lt;DirectoryScanner name="scan-build">
+ &lt;Actions>NOTIFY LOGRESULT&lt;/Actions>
+ &lt;ExcludeFiles/>
+ &lt;IncludeFiles>
+ &lt;FileFilter>
+ &lt;FilePattern>.*\.class&lt;/FilePattern>
+ &lt;SizeExceedsMaxBytes>4096&lt;/SizeExceedsMaxBytes>
+ &lt;/FileFilter>
+ &lt;/IncludeFiles>
+ &lt;RootDirectory>build&lt;/RootDirectory>
+ &lt;/DirectoryScanner>
+ &lt;/DirectoryScannerList>
+&lt;/ScanManager>
+
+Invoke 'close' on ScanManagerMXBean
+
+Got expected security exception: java.lang.SecurityException: Access denied!
+Invalid access level for requested MBeanServer operation.
+
+Close the connection to the server
+
+Bye! Bye!
+</pre>
+</td></tr></table></center>
+ <p>If the <code>ScanDirClient</code> fails to connect with
+ the secure agent, then this article - <a
+ href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
+ title="Troubleshooting connection problems in JConsole"
+ >Troubleshooting connection problems in JConsole</a> - may help
+ you figure out what is going wrong. Indeed the connection steps
+ performed by the <code>ScanDirClient</code> are very similar to
+ those performed by <code>jconsole</code>, and the problems you
+ could encounter are identical. Just remember that
+ <code>jconsole</code> needs the extra <code>-J</code> flag to pass
+ system properties to the VM, which is not needed with regular
+ <code>java</code> launcher invocations.
+ </p>
+ </ul>
+
+ <h2><a name="h2-Conclusion">Conclusion</a></h2>
+ <ul>
+ <p>
+ In this document, we have presented an advanced
+ JMX example, and shown how to run a secure
+ JMX agent in a production environment.
+ We have also shown how to connect to such a
+ secure agent with both jconsole and a programmatic
+ client. We have also discuss various JMX
+ design-patterns and best practices.
+ Readers who would wish to learn more about JMX, and
+ Monitoring and Management of the JVM, are invited
+ to follow the links given in reference below.
+ </p>
+ </ul>
+ <h2><a name="h2-References">References</a></h2>
+ <ol>
+ <li><a href="http://java.sun.com/products/JavaManagement/best-practices.html"
+ >JMX Best Practices</a>: This document describes best practices that
+ have been identified for modeling using the JMX API. </li>
+ <li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html"
+ >Monitoring and Management Using JMX</a>: How to enable, configure, and
+ connect to the JVM JMX agent.</li>
+ <li><a name="JConsole"><a
+href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html"
+>Using JConsole</a>: JConsole is a JMX-Compliant monitoring tool which allows
+ you to interact graphically with your own MBeans.
+ </li>
+ <li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/"
+ >Monitoring and Management for the Java Platform</a>: The Java Platform
+ Standard Edition (Java SE) 6 provides comprehensive monitoring and
+ management support for the Java platform. </li>
+ <li><a href="http://java.sun.com/products/JavaManagement/community/jmx_blogs.html"
+ >List of JMX-related Blogs</a>: This page provides links to the
+ different web logs written by members of the Sun team working on the
+ JMX API.</li>
+ <li><a
+ href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
+ title="The JSSE Reference Guide"
+ >Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>:
+ comprehensive documentation about the Java<sup>TM</sup> Secure Socket
+ Extension (JSSE)
+ </li>
+ <li><a href="http://java.sun.com/javase/6/docs/"
+ >Java SE 6 Documentation Index</a>: This document covers the
+ Java<sup>TM</sup> Platform, Standard Edition 6 JDK.</li>
+ </ol>
+ <p>
+ <hr>
+ <p>
+ </body>
+</html>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/keystore b/staging/linux-x86/sample/jmx/jmx-scandir/keystore
new file mode 100644
index 0000000..05f5356
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/keystore
Binary files differ
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/logging.properties b/staging/linux-x86/sample/jmx/jmx-scandir/logging.properties
new file mode 100644
index 0000000..1714bee
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/logging.properties
@@ -0,0 +1,17 @@
+handlers= java.util.logging.ConsoleHandler
+
+.level=INFO
+
+
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+javax.management.level=INFO
+com.sun.jmx.level=INFO
+com.sun.jmx.examples.level=FINE
+
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/manifest.mf b/staging/linux-x86/sample/jmx/jmx-scandir/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml
new file mode 100644
index 0000000..42da880
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/file-targets.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="jmx-scandir/file">
+
+ <import file="../build.xml"/>
+
+ <target name="compile-selected" depends="-init">
+ <fail unless="includes">Must set property 'includes'</fail>
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" includes="${includes}">
+ <classpath path="${cp}"/>
+ </javac>
+ </target>
+
+</project>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml
new file mode 100644
index 0000000..2b85b77
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/jdk.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project name="jdk" basedir=".">
+
+ <target name="-jdk-preinit">
+ <condition property=".exe" value=".exe">
+ <os family="windows"/>
+ </condition>
+ <property name=".exe" value=""/>
+ <property name="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}"/>
+ <property name="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}"/>
+ <property name="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}"/>
+ <property name="nbjdk.appletviewer" value="${nbjdk.home}/bin/appletviewer${.exe}"/>
+ <property name="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar"/>
+ </target>
+
+ <target name="-jdk-presetdef-basic" depends="-jdk-preinit" unless="nbjdk.presetdef.basic.done">
+ <macrodef name="javac-presetdef">
+ <attribute name="javacval"/>
+ <sequential>
+ <presetdef name="javac">
+ <javac fork="yes" executable="@{javacval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javac-presetdef javacval="${nbjdk.javac}"/>
+ <macrodef name="java-presetdef">
+ <attribute name="javaval"/>
+ <sequential>
+ <presetdef name="java">
+ <java fork="yes" jvm="@{javaval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <java-presetdef javaval="${nbjdk.java}"/>
+ <macrodef name="javadoc-presetdef">
+ <attribute name="javadocval"/>
+ <sequential>
+ <presetdef name="javadoc">
+ <javadoc executable="@{javadocval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
+ <property name="nbjdk.presetdef.basic.done" value="true"/>
+ </target>
+
+ <target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" unless="nbjdk.presetdef.nbjpdastart.done">
+ <macrodef name="nbjpdastart-presetdef">
+ <attribute name="bootcpval"/>
+ <sequential>
+ <presetdef name="nbjpdastart">
+ <nbjpdastart>
+ <bootclasspath>
+ <path path="@{bootcpval}"/>
+ </bootclasspath>
+ </nbjpdastart>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
+ <property name="nbjdk.presetdef.nbjpdastart.done" value="true"/>
+ </target>
+
+ <target name="-jdk-init" depends="-jdk-preinit,-jdk-presetdef-basic"/>
+
+</project>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml
new file mode 100644
index 0000000..facdb4e
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/netbeans-targets.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="jmx-scandir/NB">
+
+ <import file="../build.xml"/>
+
+ <target name="debug" depends="compile,-jdk-presetdef-nbjpdastart">
+ <nbjpdastart addressproperty="jpda.address" name="jmx-scandir" transport="dt_socket">
+ <classpath path="${run.cp}"/>
+ </nbjpdastart>
+ <java classname="${main.client.class}" failonerror="true" fork="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=none"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ <arg line="${client.args}" />
+ </java>
+ </target>
+
+ <target name="debug-fix" depends="-init">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ <include name="${class}.java"/>
+ </javac>
+ <nbjpdareload>
+ <fileset dir="${classes.dir}">
+ <include name="${class}.class"/>
+ </fileset>
+ </nbjpdareload>
+ </target>
+
+ <target name="show-info" depends="-init">
+ <nbbrowse file="${main.dir}/index.html"/>
+ </target>
+
+ <target name="show-javadoc" depends="javadoc">
+ <nbbrowse file="${javadoc.dir}/index.html"/>
+ </target>
+
+ <target name="profile" depends="compile">
+ <nbprofiledirect>
+ <classpath path="${run.cp}"/>
+ </nbprofiledirect>
+ <property environment="env"/>
+ <java classname="${main.client.class}" fork="true" failonerror="true" dir="${profiler.session.working.dir}" jvm="${profiler.info.jvm}">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <arg line="localhost 4545" />
+ <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}"/>
+ <env key="Path" path="${profiler.info.agentpath}:${env.Path}"/>
+ </java>
+ </target>
+
+</project>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/project.xml b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/project.xml
new file mode 100644
index 0000000..a988de6
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/nbproject/project.xml
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>jmx-scandir</name>
+ <properties>
+ <property-file>user.build.properties</property-file>
+ <property-file>build.properties</property-file>
+ <property name="nbjdk.bootclasspath">${nbjdk.home}/jre/lib/rt.jar</property>
+ </properties>
+ <folders>
+ <source-folder>
+ <label>JDK Demo</label>
+ <location>${main.dir}</location>
+ </source-folder>
+ <source-folder>
+ <label>Sources</label>
+ <type>java</type>
+ <location>${src.dir}</location>
+ </source-folder>
+ <source-folder>
+ <label>test</label>
+ <type>java</type>
+ <location>test</location>
+ </source-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>jar</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>jar</target>
+ </action>
+ <action name="run">
+ <target>run</target>
+ </action>
+ <action name="ReadMe">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>show-info</target>
+ </action>
+ <action name="javadoc">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>show-javadoc</target>
+ </action>
+ <action name="debug">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ </action>
+ <action name="compile.single">
+ <script>nbproject/file-targets.xml</script>
+ <target>compile-selected</target>
+ <context>
+ <property>includes</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path</format>
+ <arity>
+ <separated-files>,</separated-files>
+ </arity>
+ </context>
+ </action>
+ <action name="run.single">
+ <target>run</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.single">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.fix">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug-fix</target>
+ <context>
+ <property>class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path-noext</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="test">
+ <target>test</target>
+ </action>
+ </ide-actions>
+ <export>
+ <type>folder</type>
+ <location>${classes.dir}</location>
+ <build-target>jar</build-target>
+ </export>
+ <export>
+ <type>jar</type>
+ <location>${jar}</location>
+ <build-target>jar</build-target>
+ </export>
+ <export>
+ <type>folder</type>
+ <location>${build.test.classes.dir}</location>
+ <build-target>jar</build-target>
+ </export>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>Sources</label>
+ <location>${src.dir}</location>
+ </source-folder>
+ <source-folder style="packages">
+ <label>test</label>
+ <location>test</location>
+ </source-folder>
+ <source-file>
+ <location>${main.dir}/index.html</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="ReadMe"/>
+ <ide-action name="build"/>
+ <ide-action name="clean"/>
+ <ide-action name="rebuild"/>
+ <ide-action name="javadoc"/>
+ <ide-action name="debug"/>
+ <!-- ide-action name="test"/ -->
+ <separator/>
+ <action>
+ <label>Run Agent</label>
+ <target>run-agent</target>
+ </action>
+ <action>
+ <label>Run Client</label>
+ <target>run-client</target>
+ </action>
+ </context-menu>
+ </view>
+ <subprojects/>
+ </general-data>
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
+ <compilation-unit>
+ <package-root>${src.dir}</package-root>
+ <classpath mode="compile">${cp}</classpath>
+ <classpath mode="execute">${run.cp}</classpath>
+ <classpath mode="boot">${nbjdk.bootclasspath}</classpath>
+ <built-to>${classes.dir}</built-to>
+ <built-to>${jar}</built-to>
+ <javadoc-built-to>${javadoc.dir}</javadoc-built-to>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ <compilation-unit>
+ <package-root>test</package-root>
+ <unit-tests/>
+ <built-to>${build.test.classes.dir}</built-to>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java
new file mode 100644
index 0000000..0ff58a2
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScanner.java
@@ -0,0 +1,591 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManager.getNextSeqNumber;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import static com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action.*;
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action;
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.management.AttributeChangeNotification;
+import javax.management.InstanceNotFoundException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+
+/**
+ * A <code>DirectoryScanner</code> is an MBean that
+ * scans a file system starting at a given root directory,
+ * and then looks for files that match a given criteria.
+ * <p>
+ * When such a file is found, the <code>DirectoryScanner</code> takes
+ * the action for which it was configured: emit a notification,
+ * <i>and or</i> log a {@link
+ * com.sun.jmx.examples.scandir.config.ResultRecord} for this file,
+ * <i>and or</i> delete that file.
+ * </p>
+ * <p>
+ * The code that would actually delete the file is commented out - so that
+ * nothing valuable is lost if this example is run by mistake on the wrong
+ * set of directories.<br>
+ * Logged results are logged by sending them to the {@link ResultLogManager}.
+ * </p>
+ * <p>
+ * <code>DirectoryScannerMXBeans</code> are created, initialized, and
+ * registered by the {@link ScanManagerMXBean}.
+ * The {@link ScanManagerMXBean} will also schedule and run them in
+ * background by calling their {@link #scan} method.
+ * </p>
+ * <p>Client code is not expected to create or register directly any such
+ * MBean. Instead, clients are expected to modify the configuration, using
+ * the {@link ScanDirConfigMXBean}, and then apply it, using the {@link
+ * ScanManagerMXBean}. Instances of <code>DirectoryScannerMXBeans</code>
+ * will then be created and registered (or unregistered and garbage collected)
+ * as a side effect of applying that configuration.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class DirectoryScanner implements
+ DirectoryScannerMXBean, NotificationEmitter {
+
+ /**
+ * The type for <i>com.sun.jmx.examples.scandir.filematch</i> notifications.
+ * Notifications of this type will be emitted whenever a file that
+ * matches this {@code DirectoryScanner} criteria is found, but only if
+ * this {@code DirectoryScanner} was configured to {@link
+ * Action#NOTIFY notify} for matching files.
+ **/
+ public static final String FILE_MATCHES_NOTIFICATION =
+ "com.sun.jmx.examples.scandir.filematch";
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(DirectoryScanner.class.getName());
+
+ // Attribute : State
+ //
+ private volatile ScanState state = STOPPED;
+
+ // The DirectoryScanner delegates the implementation of
+ // the NotificationEmitter interface to a wrapped instance
+ // of NotificationBroadcasterSupport.
+ //
+ private final NotificationBroadcasterSupport broadcaster;
+
+ // The root directory at which this DirectoryScanner will start
+ // scanning. Constructed from config.getRootDirectory().
+ //
+ private final File rootFile;
+
+ // This DirectoryScanner config - this is a constant which is
+ // provided at construction time by the {@link ScanManager}.
+ //
+ private final DirectoryScannerConfig config;
+
+ // The set of actions for which this DirectoryScanner is configured.
+ // Constructed from config.getActions()
+ //
+ final Set<Action> actions;
+
+ // The ResultLogManager that this DirectoryScanner will use to log
+ // info. This is a hard reference to another MBean, provided
+ // at construction time by the ScanManager.
+ // The ScanManager makes sure that the life cycle of these two MBeans
+ // is consistent.
+ //
+ final ResultLogManager logManager;
+
+ /**
+ * Constructs a new {@code DirectoryScanner}.
+ * <p>This constructor is
+ * package protected, and this MBean cannot be created by a remote
+ * client, because it needs a reference to the {@link ResultLogManager},
+ * which cannot be provided from remote.
+ * </p>
+ * <p>This is a conscious design choice: {@code DirectoryScanner} MBeans
+ * are expected to be completely managed (created, registered, unregistered)
+ * by the {@link ScanManager} which does provide this reference.
+ * </p>
+ *
+ * @param config This {@code DirectoryScanner} configuration.
+ * @param logManager The info log manager with which to log the info
+ * records.
+ * @throws IllegalArgumentException if one of the parameter is null, or if
+ * the provided {@code config} doesn't have its {@code name} set,
+ * or if the {@link DirectoryScannerConfig#getRootDirectory
+ * root directory} provided in the {@code config} is not acceptable
+ * (not provided or not found or not readable, etc...).
+ **/
+ public DirectoryScanner(DirectoryScannerConfig config,
+ ResultLogManager logManager)
+ throws IllegalArgumentException {
+ if (logManager == null)
+ throw new IllegalArgumentException("log=null");
+ if (config == null)
+ throw new IllegalArgumentException("config=null");
+ if (config.getName() == null)
+ throw new IllegalArgumentException("config.name=null");
+
+ broadcaster = new NotificationBroadcasterSupport();
+
+ // Clone the config: ensure data encapsulation.
+ //
+ this.config = XmlConfigUtils.xmlClone(config);
+
+ // Checks that the provided root directory is valid.
+ // Throws IllegalArgumentException if it isn't.
+ //
+ rootFile = validateRoot(config.getRootDirectory());
+
+ // Initialize the Set<Action> for which this DirectoryScanner
+ // is configured.
+ //
+ if (config.getActions() == null)
+ actions = Collections.emptySet();
+ else
+ actions = EnumSet.copyOf(Arrays.asList(config.getActions()));
+ this.logManager = logManager;
+ }
+
+ // see DirectoryScannerMXBean
+ public void stop() {
+ // switch state to stop and send AttributeValueChangeNotification
+ setStateAndNotify(STOPPED);
+ }
+
+ // see DirectoryScannerMXBean
+ public String getRootDirectory() {
+ return rootFile.getAbsolutePath();
+ }
+
+
+ // see DirectoryScannerMXBean
+ public ScanState getState() {
+ return state;
+ }
+
+ // see DirectoryScannerMXBean
+ public DirectoryScannerConfig getConfiguration() {
+ return config;
+ }
+
+ // see DirectoryScannerMXBean
+ public String getCurrentScanInfo() {
+ final ScanTask currentOrLastTask = currentTask;
+ if (currentOrLastTask == null) return "Never Run";
+ return currentOrLastTask.getScanInfo();
+ }
+
+ // This variable points to the current (or latest) scan.
+ //
+ private volatile ScanTask currentTask = null;
+
+ // see DirectoryScannerMXBean
+ public void scan() {
+ final ScanTask task;
+
+ synchronized (this) {
+ final LinkedList<File> list;
+ switch (state) {
+ case RUNNING:
+ case SCHEDULED:
+ throw new IllegalStateException(state.toString());
+ case STOPPED:
+ case COMPLETED:
+ // only accept to scan if state is STOPPED or COMPLETED.
+ list = new LinkedList<File>();
+ list.add(rootFile);
+ break;
+ default:
+ throw new IllegalStateException(String.valueOf(state));
+ }
+
+ // Create a new ScanTask object for our root directory file.
+ //
+ currentTask = task = new ScanTask(list,this);
+
+ // transient state... will be switched to RUNNING when
+ // task.execute() is called. This code could in fact be modified
+ // to use java.util.concurent.Future and, to push the task to
+ // an executor. We would then need to wait for the task to
+ // complete before returning. However, this wouldn't buy us
+ // anything - since this method should wait for the task to
+ // finish anyway: so why would we do it?
+ // As it stands, we simply call task.execute() in the current
+ // thread - brave and fearless readers may want to attempt the
+ // modification ;-)
+ //
+ setStateAndNotify(SCHEDULED);
+ }
+ task.execute();
+ }
+
+ // This method is invoked to carry out the configured actions on a
+ // matching file.
+ // Do not call this method from within synchronized() { } as this
+ // method may send notifications!
+ //
+ void actOn(File file) {
+
+ // Which action were actually taken
+ //
+ final Set<Action> taken = new HashSet<Action>();
+ boolean logresult = false;
+
+ // Check out which actions are configured and carry them out.
+ //
+ for (Action action : actions) {
+ switch (action) {
+ case DELETE:
+ if (deleteFile(file)) {
+ // Delete succeeded: add DELETE to the set of
+ // actions carried out.
+ taken.add(DELETE);
+ }
+ break;
+ case NOTIFY:
+ if (notifyMatch(file)) {
+ // Notify succeeded: add NOTIFY to the set of
+ // actions carried out.
+ taken.add(NOTIFY);
+ }
+ break;
+ case LOGRESULT:
+ // LOGRESULT was configured - log actions carried out.
+ // => we must execute this action as the last action.
+ // simply set logresult=true for now. We will do
+ // the logging later
+ logresult = true;
+ break;
+ default:
+ LOG.fine("Failed to execute action: " +action +
+ " - action not supported");
+ break;
+ }
+ }
+
+ // Now is time for logging:
+ if (logresult) {
+ taken.add(LOGRESULT);
+ if (!logResult(file,taken.toArray(new Action[taken.size()])))
+ taken.remove(LOGRESULT); // just for the last trace below...
+ }
+
+ LOG.finest("File processed: "+taken+" - "+file.getAbsolutePath());
+ }
+
+ // Deletes a matching file.
+ private boolean deleteFile(File file) {
+ try {
+ // file.delete() is commented so that we don't do anything
+ // bad if the example is mistakenly run on the wrong set of
+ // directories.
+ //
+ /* file.delete(); */
+ System.out.println("DELETE not implemented for safety reasons.");
+ return true;
+ } catch (Exception x) {
+ LOG.fine("Failed to delete: "+file.getAbsolutePath());
+ }
+ return false;
+ }
+
+ // Notifies of a matching file.
+ private boolean notifyMatch(File file) {
+ try {
+ final Notification n =
+ new Notification(FILE_MATCHES_NOTIFICATION,this,
+ getNextSeqNumber(),
+ file.getAbsolutePath());
+
+ // This method *is not* called from any synchronized block, so
+ // we can happily call broadcaster.sendNotification() here.
+ // Note that verifying whether a method is called from within
+ // a synchronized block demends a thoroughful code reading,
+ // examining each of the 'parent' methods in turn.
+ //
+ broadcaster.sendNotification(n);
+ return true;
+ } catch (Exception x) {
+ LOG.fine("Failed to notify: "+file.getAbsolutePath());
+ }
+ return false;
+ }
+
+ // Logs a result with the ResultLogManager
+ private boolean logResult(File file,Action[] actions) {
+ try {
+ logManager.log(new ResultRecord(config, actions,file));
+ return true;
+ } catch (Exception x) {
+ LOG.fine("Failed to log: "+file.getAbsolutePath());
+ }
+ return false;
+ }
+
+
+ // Contextual object used to store info about current
+ // (or last) scan.
+ //
+ private static class ScanTask {
+
+ // List of Files that remain to scan.
+ // When files are discovered they are added to the list.
+ // When they are being handled, they are removed from the list.
+ // When the list is empty, the scanning is finished.
+ //
+ private final LinkedList<File> list;
+ private final DirectoryScanner scan;
+
+ // Some statistics...
+ //
+ private volatile long scanned=0;
+ private volatile long matching=0;
+
+ private volatile String info="Not started";
+
+ ScanTask(LinkedList<File> list, DirectoryScanner scan) {
+ this.list = list; this.scan = scan;
+ }
+
+ public void execute() {
+ scan(list);
+ }
+
+ private void scan(LinkedList<File> list) {
+ scan.scan(this,list);
+ }
+
+ public String getScanInfo() {
+ return info+" - ["+scanned+" scanned, "+matching+" matching]";
+ }
+ }
+
+ // The actual scan logic. Switches state to RUNNING,
+ // and scan the list of given dirs.
+ // The list is a live object which is updated by this method.
+ // This would allow us to implement methods like "pause" and "resume",
+ // since all the info needed to resume would be in the list.
+ //
+ private void scan(ScanTask task, LinkedList<File> list) {
+ setStateAndNotify(RUNNING);
+ task.info = "In Progress";
+ try {
+
+ // The FileFilter will tell us which files match and which don't.
+ //
+ final FileFilter filter = config.buildFileFilter();
+
+ // We have two condition to end the loop: either the list is
+ // empty, meaning there's nothing more to scan, or the state of
+ // the DirectoryScanner was asynchronously switched to STOPPED by
+ // another thread, e.g. because someone called "stop" on the
+ // ScanManagerMXBean
+ //
+ while (!list.isEmpty() && state == RUNNING) {
+
+ // Get and remove the first element in the list.
+ //
+ final File current = list.poll();
+
+ // Increment number of file scanned.
+ task.scanned++;
+
+ // If 'current' is a file, it's already been matched by our
+ // file filter (see below): act on it.
+ // Note that for the first iteration of this loop, there will
+ // be one single file in the list: the root directory for this
+ // scanner.
+ //
+ if (current.isFile()) {
+ task.matching++;
+ actOn(current);
+ }
+
+ // If 'current' is a directory, then
+ // find files and directories that match the file filter
+ // in this directory
+ //
+ if (current.isDirectory()) {
+
+ // Gets matching files and directories
+ final File[] content = current.listFiles(filter);
+ if (content == null) continue;
+
+ // Adds all matching file to the list.
+ list.addAll(0,Arrays.asList(content));
+ }
+ }
+
+ // The loop terminated. If the list is empty, then we have
+ // completed our task. If not, then somebody must have called
+ // stop() on this directory scanner.
+ //
+ if (list.isEmpty()) {
+ task.info = "Successfully Completed";
+ setStateAndNotify(COMPLETED);
+ }
+ } catch (Exception x) {
+ // We got an exception: stop the scan
+ //
+ task.info = "Failed: "+x;
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,"scan task failed: "+x,x);
+ else if (LOG.isLoggable(Level.FINE))
+ LOG.log(Level.FINE,"scan task failed: "+x);
+ setStateAndNotify(STOPPED);
+ } catch (Error e) {
+ // We got an Error:
+ // Should not happen unless we ran out of memory or
+ // whatever - don't even try to notify, but
+ // stop the scan anyway!
+ //
+ state=STOPPED;
+ task.info = "Error: "+e;
+
+ // rethrow error.
+ //
+ throw e;
+ }
+ }
+
+ /**
+ * MBeanNotification support - delegates to broadcaster.
+ */
+ public void addNotificationListener(NotificationListener listener,
+ NotificationFilter filter, Object handback)
+ throws IllegalArgumentException {
+ broadcaster.addNotificationListener(listener, filter, handback);
+ }
+
+ // Switch this object state to the desired value an send
+ // a notification. Don't call this method from within a
+ // synchronized block!
+ //
+ private final void setStateAndNotify(ScanState desired) {
+ final ScanState old = state;
+ if (old == desired) return;
+ state = desired;
+ final AttributeChangeNotification n =
+ new AttributeChangeNotification(this,
+ getNextSeqNumber(),System.currentTimeMillis(),
+ "state change","State",ScanState.class.getName(),
+ String.valueOf(old),String.valueOf(desired));
+ broadcaster.sendNotification(n);
+ }
+
+
+ /**
+ * The {@link DirectoryScannerMXBean} may send two types of
+ * notifications: filematch, and state attribute changed.
+ **/
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return new MBeanNotificationInfo[] {
+ new MBeanNotificationInfo(
+ new String[] {FILE_MATCHES_NOTIFICATION},
+ Notification.class.getName(),
+ "Emitted when a file that matches the scan criteria is found"
+ ),
+ new MBeanNotificationInfo(
+ new String[] {AttributeChangeNotification.ATTRIBUTE_CHANGE},
+ AttributeChangeNotification.class.getName(),
+ "Emitted when the State attribute changes"
+ )
+ };
+ }
+
+ /**
+ * MBeanNotification support - delegates to broadcaster.
+ */
+ public void removeNotificationListener(NotificationListener listener)
+ throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener);
+ }
+
+ /**
+ * MBeanNotification support - delegates to broadcaster.
+ */
+ public void removeNotificationListener(NotificationListener listener,
+ NotificationFilter filter, Object handback)
+ throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener, filter, handback);
+ }
+
+ // Validates the given root directory, returns a File object for
+ // that directory.
+ // Throws IllegalArgumentException if the given root is not
+ // acceptable.
+ //
+ private static File validateRoot(String root) {
+ if (root == null)
+ throw new IllegalArgumentException("no root specified");
+ if (root.length() == 0)
+ throw new IllegalArgumentException("specified root \"\" is invalid");
+ final File f = new File(root);
+ if (!f.canRead())
+ throw new IllegalArgumentException("can't read "+root);
+ if (!f.isDirectory())
+ throw new IllegalArgumentException("no such directory: "+root);
+ return f;
+ }
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java
new file mode 100644
index 0000000..2ca3548
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import java.io.IOException;
+import javax.management.InstanceNotFoundException;
+
+/**
+ * A <code>DirectoryScannerMXBean</code> is an MBean that
+ * scans a file system starting at a given root directory,
+ * and then looks for files that match a given criteria.
+ * <p>
+ * When such a file is found, the <code>DirectoryScannerMXBean</code> takes
+ * the actions for which it was configured: see {@link #scan scan()}.
+ * <p>
+ * <code>DirectoryScannerMXBeans</code> are created, initialized, and
+ * registered by the {@link ScanManagerMXBean}.
+ * The {@link ScanManagerMXBean} will also schedule and run them in
+ * background by calling their {@link #scan} method.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public interface DirectoryScannerMXBean {
+ /**
+ * Get The {@link DirectoryScanner} state.
+ * @return the current state of the <code>DirectoryScanner</code>.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanState getState()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Stops the current scan if {@link ScanState#RUNNING running}.
+ * After this method completes the state of the application will
+ * be {@link ScanState#STOPPED STOPPED}.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void stop()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Scans the file system starting at the specified {@link #getRootDirectory
+ * root directory}.
+ * <p>If a file that matches this <code>DirectoryScannerMXBean</code>
+ * {@link #getConfiguration} criteria is found,
+ * the <code>DirectoryScannerMXBean</code> takes the {@link
+ * DirectoryScannerConfig#getActions() actions} for which
+ * it was {@link #getConfiguration configured}: emit a notification,
+ * <i>and or</i> log a {@link
+ * com.sun.jmx.examples.scandir.config.ResultRecord} for this file,
+ * <i>and or</i> delete that file.
+ * </p>
+ * <p>
+ * The code that would actually delete the file is commented out - so that
+ * nothing valuable is lost if this example is run by mistake on the wrong
+ * set of directories.
+ * </p>
+ * <p>This method returns only when the directory scan is completed, or
+ * if it was {@link #stop stopped} by another thread.
+ * </p>
+ * @throws IllegalStateException if already {@link ScanState#RUNNING}
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void scan()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the root directory at which this <code>DirectoryScannerMXBean</code>
+ * will start scanning the file system.
+ * <p>
+ * This is a shortcut to {@link #getConfiguration
+ * getConfiguration()}.{@link
+ * DirectoryScannerConfig#getRootDirectory
+ * getRootDirectory()}.
+ * </p>
+ * @return This <code>DirectoryScannerMXBean</code> root directory.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getRootDirectory()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * The configuration data from which this {@link DirectoryScanner} was
+ * created.
+ * <p>
+ * You cannot change this configuration here. You can however
+ * {@link ScanDirConfigMXBean#setConfiguration modify} the
+ * {@link ScanDirConfigMXBean} configuration, and ask the
+ * {@link ScanManagerMXBean} to {@link ScanManagerMXBean#applyConfiguration
+ * apply} it. This will get all <code>DirectoryScannerMXBean</code>
+ * replaced by new MBeans created from the modified configuration.
+ * </p>
+ *
+ * @return This <code>DirectoryScannerMXBean</code> configuration data.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public DirectoryScannerConfig getConfiguration()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * A short string describing what's happening in current/latest scan.
+ * @return a short info string.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getCurrentScanInfo()
+ throws IOException, InstanceNotFoundException;
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java
new file mode 100644
index 0000000..a0a4bb9
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManager.java
@@ -0,0 +1,534 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManager.getNextSeqNumber;
+import com.sun.jmx.examples.scandir.config.ResultLogConfig;
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.logging.Logger;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.ObjectName;
+import javax.xml.bind.JAXBException;
+
+/**
+ * The <code>ResultLogManager</code> is in charge of managing result logs.
+ * {@link DirectoryScanner DirectoryScanners} can be configured to log a
+ * {@link ResultRecord} whenever they take action upon a file that
+ * matches their set of matching criteria.
+ * The <code>ResultLogManagerMXBean</code> is responsible for storing these
+ * results in its result logs.
+ * <p>The <code>ResultLogManagerMXBean</code> can be configured to log
+ * these records to a flat file, or into a log held in memory, or both.
+ * Both logs (file and memory) can be configured with a maximum capacity.
+ * <br>When the maximum capacity of the memory log is reached - its first
+ * entry (i.e. its eldest entry) is removed to make place for the latest.
+ * <br>When the maximum capacity of the file log is reached, the file is
+ * renamed by appending a tilde '~' to its name and a new result log is created.
+ *
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ResultLogManager extends NotificationBroadcasterSupport
+ implements ResultLogManagerMXBean, MBeanRegistration {
+
+ /**
+ * The default singleton name of the {@link ResultLogManagerMXBean}.
+ **/
+ public static final ObjectName RESULT_LOG_MANAGER_NAME =
+ ScanManager.makeSingletonName(ResultLogManagerMXBean.class);
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ResultLogManager.class.getName());
+
+ // The memory log
+ //
+ private final List<ResultRecord> memoryLog;
+
+ // Whether the memory log capacity was reached. In that case every
+ // new entry triggers the deletion of the eldest one.
+ //
+ private volatile boolean memCapacityReached = false;
+
+ // The maximum number of record that the memory log can
+ // contain.
+ //
+ private volatile int memCapacity;
+
+ // The maximum number of record that the ResultLogManager can
+ // log in the log file before creating a new file.
+ //
+ private volatile long fileCapacity;
+
+ // The current log file.
+ //
+ private volatile File logFile;
+
+ // The OutputStream of the current log file.
+ //
+ private volatile OutputStream logStream = null;
+
+ // number of record that this object has logged in the log file
+ // since the log file was created. Creating a new file or clearing
+ // the log file reset this value to '0'
+ //
+ private volatile long logCount = 0;
+
+ // The ResultLogManager config - modified whenever
+ // ScanManager.applyConfiguration is called.
+ //
+ private volatile ResultLogConfig config;
+
+ /**
+ * Create a new ResultLogManagerMXBean. This constructor is package
+ * protected: only the {@link ScanManager} can create a
+ * <code>ResultLogManager</code>.
+ **/
+ ResultLogManager() {
+ // Instantiate the memory log - override the add() method so that
+ // it removes the head of the list when the maximum capacity is
+ // reached. Note that add() is the only method we will be calling,
+ // otherwise we would have to override all the other flavors
+ // of adding methods. Note also that this implies that the memoryLog
+ // will *always* remain encapsulated in this object and is *never*
+ // handed over (otherwise we wouldn't be able to ensure that
+ // add() is the only method ever called to add a record).
+ //
+ memoryLog =
+ Collections.synchronizedList(new LinkedList<ResultRecord>() {
+ public synchronized boolean add(ResultRecord e) {
+ final int max = getMemoryLogCapacity();
+ while (max > 0 && size() >= max) {
+ memCapacityReached = true;
+ removeFirst();
+ }
+ return super.add(e);
+ }
+ });
+
+ // default memory capacity
+ memCapacity = 2048;
+
+ // default file capacity: 0 means infinite ;-)
+ fileCapacity = 0;
+
+ // by default logging to file is disabled.
+ logFile = null;
+
+ // Until the ScanManager apply a new configuration, we're going to
+ // work with a default ResultLogConfig object.
+ config = new ResultLogConfig();
+ config.setMemoryMaxRecords(memCapacity);
+ config.setLogFileName(getLogFileName(false));
+ config.setLogFileMaxRecords(fileCapacity);
+ }
+
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * registered in the MBean server.
+ * <p>If the name of the MBean is not
+ * specified, the MBean can provide a name for its registration. If
+ * any exception is raised, the MBean will not be registered in the
+ * MBean server.</p>
+ * <p>The {@code ResultLogManager} uses this method to supply its own
+ * default singleton ObjectName (if <var>name</var> parameter is null).
+ * @param server The MBean server in which the MBean will be registered.
+ * @param name The object name of the MBean. This name is null if the
+ * name parameter to one of the createMBean or registerMBean methods in
+ * the MBeanServer interface is null. In that case, this method must
+ * return a non-null ObjectName for the new MBean.
+ * @return The name under which the MBean is to be registered. This value
+ * must not be null. If the name parameter is not null, it will usually
+ * but not necessarily be the returned value.
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public ObjectName preRegister(MBeanServer server, ObjectName name)
+ throws Exception {
+ if (name == null)
+ name = RESULT_LOG_MANAGER_NAME;
+ objectName = name;
+ mbeanServer = server;
+ return name;
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having
+ * been registered in the MBean server or after the registration has
+ * failed.
+ * <p>This implementation does nothing.</p>
+ * @param registrationDone Indicates whether or not the MBean has been
+ * successfully registered in the MBean server. The value false means
+ * that the registration has failed.
+ */
+ public void postRegister(Boolean registrationDone) {
+ // Don't need to do anything here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * unregistered by the MBean server.
+ * <p>This implementation does nothing.</p>
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public void preDeregister() throws Exception {
+ // Don't need to do anything here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having been
+ * unregistered in the MBean server.
+ * <p>Closes the log file stream, if it is still open.</p>
+ */
+ public void postDeregister() {
+ try {
+ if (logStream != null) {
+ synchronized(this) {
+ logStream.flush();
+ logStream.close();
+ logFile = null;
+ logStream = null;
+ }
+ }
+ } catch (Exception x) {
+ LOG.finest("Failed to close log properly: "+x);
+ }
+ }
+
+ /**
+ * Create a new empty log file from the given basename, renaming
+ * previously existing file by appending '~' to its name.
+ **/
+ private File createNewLogFile(String basename) throws IOException {
+ return XmlConfigUtils.createNewXmlFile(basename);
+ }
+
+ /**
+ * Check whether a new log file should be created.
+ * If a new file needs to be created, creates it, renaming
+ * previously existing file by appending '~' to its name.
+ * Also reset the log count and file capacity.
+ * Sends a notification indicating that the log file was changed.
+ * Returns the new log stream;
+ * Creation of a new file can be forced by passing force=true.
+ **/
+ private OutputStream checkLogFile(String basename, long maxRecords,
+ boolean force)
+ throws IOException {
+ final OutputStream newStream;
+ synchronized(this) {
+ if ((force==false) && (logCount < maxRecords))
+ return logStream;
+ final OutputStream oldStream = logStream;
+
+ // First close the stream. On some platforms you cannot rename
+ // a file that has open streams...
+ //
+ if (oldStream != null) {
+ oldStream.flush();
+ oldStream.close();
+ }
+ final File newFile = (basename==null)?null:createNewLogFile(basename);
+
+ newStream = (newFile==null)?null:new FileOutputStream(newFile,true);
+ logStream = newStream;
+ logFile = newFile;
+ fileCapacity = maxRecords;
+ logCount = 0;
+ }
+ sendNotification(new Notification(LOG_FILE_CHANGED,objectName,
+ getNextSeqNumber(),
+ basename));
+ return newStream;
+ }
+
+ // see ResultLogManagerMXBean
+ public void log(ResultRecord record)
+ throws IOException {
+ if (memCapacity > 0) logToMemory(record);
+ if (logFile != null) logToFile(record);
+ }
+
+ // see ResultLogManagerMXBean
+ public ResultRecord[] getMemoryLog() {
+ return memoryLog.toArray(new ResultRecord[0]);
+ }
+
+ // see ResultLogManagerMXBean
+ public int getMemoryLogCapacity() {
+ return memCapacity;
+ }
+
+ // see ResultLogManagerMXBean
+ public void setMemoryLogCapacity(int maxRecords) {
+ synchronized(this) {
+ memCapacity = maxRecords;
+ if (memoryLog.size() < memCapacity)
+ memCapacityReached = false;
+ config.setMemoryMaxRecords(maxRecords);
+ }
+ }
+
+ // see ResultLogManagerMXBean
+ public void setLogFileCapacity(long maxRecords)
+ throws IOException {
+ synchronized (this) {
+ fileCapacity = maxRecords;
+ config.setLogFileMaxRecords(maxRecords);
+ }
+ checkLogFile(getLogFileName(),fileCapacity,false);
+ }
+
+ // see ResultLogManagerMXBean
+ public long getLogFileCapacity() {
+ return fileCapacity;
+ }
+
+ // see ResultLogManagerMXBean
+ public long getLoggedCount() {
+ return logCount;
+ }
+
+ // see ResultLogManagerMXBean
+ public void newLogFile(String logname, long maxRecord)
+ throws IOException {
+ checkLogFile(logname,maxRecord,true);
+ config.setLogFileName(getLogFileName(false));
+ config.setLogFileMaxRecords(getLogFileCapacity());
+ }
+
+ // see ResultLogManagerMXBean
+ public String getLogFileName() {
+ return getLogFileName(true);
+ }
+
+ // see ResultLogManagerMXBean
+ public void clearLogs() throws IOException {
+ clearMemoryLog();
+ clearLogFile();
+ }
+
+ // Clear the memory log, sends a notification indicating that
+ // the memory log was cleared.
+ //
+ private void clearMemoryLog()throws IOException {
+ synchronized(this) {
+ memoryLog.clear();
+ memCapacityReached = false;
+ }
+ sendNotification(new Notification(MEMORY_LOG_CLEARED,
+ objectName,
+ getNextSeqNumber(),"memory log cleared"));
+ }
+
+ // Clears the log file.
+ //
+ private void clearLogFile() throws IOException {
+ // simply force the creation of a new log file.
+ checkLogFile(getLogFileName(),fileCapacity,true);
+ }
+
+ // Log a record to the memory log. Send a notification if the
+ // maximum capacity of the memory log is reached.
+ //
+ private void logToMemory(ResultRecord record) {
+
+ final boolean before = memCapacityReached;
+ final boolean after;
+ synchronized(this) {
+ memoryLog.add(record);
+ after = memCapacityReached;
+ }
+ if (before==false && after==true)
+ sendNotification(new Notification(MEMORY_LOG_MAX_CAPACITY,
+ objectName,
+ getNextSeqNumber(),"memory log capacity reached"));
+ }
+
+
+ // Log a record to the memory log. Send a notification if the
+ // maximum capacity of the memory log is reached.
+ //
+ private void logToFile(ResultRecord record) throws IOException {
+ final String basename;
+ final long maxRecords;
+ synchronized (this) {
+ if (logFile == null) return;
+ basename = getLogFileName(false);
+ maxRecords = fileCapacity;
+ }
+
+ // Get the stream into which we should log.
+ final OutputStream stream =
+ checkLogFile(basename,maxRecords,false);
+
+ // logging to file now disabled - too bad.
+ if (stream == null) return;
+
+ synchronized (this) {
+ try {
+ XmlConfigUtils.write(record,stream,true);
+ stream.flush();
+ // don't increment logCount if we were not logging in logStream.
+ if (stream == logStream) logCount++;
+ } catch (JAXBException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException("bad record",x);
+ LOG.finest("Failed to log record: "+x);
+ throw iae;
+ }
+ }
+ }
+
+ /**
+ * The notification type which indicates that the log file was switched:
+ * <i>com.sun.jmx.examples.scandir.log.file.switched</i>.
+ * The message contains the name of the new file (or null if log to file
+ * is now disabled).
+ **/
+ public final static String LOG_FILE_CHANGED =
+ "com.sun.jmx.examples.scandir.log.file.switched";
+
+ /**
+ * The notification type which indicates that the memory log capacity has
+ * been reached:
+ * <i>com.sun.jmx.examples.scandir.log.memory.full</i>.
+ **/
+ public final static String MEMORY_LOG_MAX_CAPACITY =
+ "com.sun.jmx.examples.scandir.log.memory.full";
+
+ /**
+ * The notification type which indicates that the memory log was
+ * cleared:
+ * <i>com.sun.jmx.examples.scandir.log.memory.cleared</i>.
+ **/
+ public final static String MEMORY_LOG_CLEARED =
+ "com.sun.jmx.examples.scandir.log.memory.cleared";
+
+ /**
+ * This MBean emits three kind of notifications:
+ * <pre>
+ * <i>com.sun.jmx.examples.scandir.log.file.switched</i>
+ * <i>com.sun.jmx.examples.scandir.log.memory.full</i>
+ * <i>com.sun.jmx.examples.scandir.log.memory.cleared</i>
+ * </pre>
+ **/
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return new MBeanNotificationInfo[] {
+ new MBeanNotificationInfo(new String[] {
+ LOG_FILE_CHANGED},
+ Notification.class.getName(),
+ "Emitted when the log file is switched")
+ ,
+ new MBeanNotificationInfo(new String[] {
+ MEMORY_LOG_MAX_CAPACITY},
+ Notification.class.getName(),
+ "Emitted when the memory log capacity is reached")
+ ,
+ new MBeanNotificationInfo(new String[] {
+ MEMORY_LOG_CLEARED},
+ Notification.class.getName(),
+ "Emitted when the memory log is cleared")
+ };
+ }
+
+ // Return the name of the log file, or null if logging to file is
+ // disabled.
+ private String getLogFileName(boolean absolute) {
+ synchronized (this) {
+ if (logFile == null) return null;
+ if (absolute) return logFile.getAbsolutePath();
+ return logFile.getPath();
+ }
+ }
+
+ // This method is be called by the ScanManagerMXBean when a configuration
+ // is applied.
+ //
+ void setConfig(ResultLogConfig logConfigBean) throws IOException {
+ if (logConfigBean == null)
+ throw new IllegalArgumentException("logConfigBean is null");
+ synchronized (this) {
+ config = logConfigBean;
+ setMemoryLogCapacity(config.getMemoryMaxRecords());
+ }
+ final String filename = config.getLogFileName();
+ final String logname = getLogFileName(false);
+ if ((filename != null && !filename.equals(logname))
+ || (filename == null && logname != null)) {
+ newLogFile(config.getLogFileName(),
+ config.getLogFileMaxRecords());
+ } else {
+ setLogFileCapacity(config.getLogFileMaxRecords());
+ }
+ }
+
+ // This method is called by the ScanManagerMXBean when
+ // applyCurrentResultLogConfig() is called.
+ //
+ ResultLogConfig getConfig() {
+ return config;
+ }
+
+
+ // Set by preRegister().
+ private MBeanServer mbeanServer;
+ private ObjectName objectName;
+
+
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java
new file mode 100644
index 0000000..eb1f0f6
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import java.io.IOException;
+import javax.management.InstanceNotFoundException;
+
+/**
+ * The <code>ResultLogManagerMXBean</code> is in charge of managing result logs.
+ * {@link DirectoryScanner DirectoryScanners} can be configured to log a
+ * {@link ResultRecord} whenever they take action upon a file that
+ * matches their set of matching criteria.
+ * The <code>ResultLogManagerMXBean</code> is responsible for storing these
+ * results in its result logs.
+ * <p>The <code>ResultLogManagerMXBean</code>
+ * will let you interactively clear these result logs, change their
+ * capacity, and decide where (memory or file or both) the
+ * {@link ResultRecord ResultRecords} should be stored.
+ * <p>The memory log is useful in so far that its content can be interactively
+ * returned by the <code>ResultLogManagerMXBean</code>.
+ * The file log doesn't have this facility.
+ * <p>The result logs are intended to be used by e.g. an offline program that
+ * would take some actions on the files that were matched by the scanners
+ * criteria:
+ * <p>The <i>scandir</i> application could be configured to only produce logs
+ * (i.e. takes no action but logging the matching files), and the real
+ * action (e.g. mail the result log to the engineer which maintains the lab,
+ * or parse the log and prepare and send a single mail to the matching
+ * files owners, containing the list of file he/she should consider deleting)
+ * could be performed by such another program/module.
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public interface ResultLogManagerMXBean {
+
+ /**
+ * Creates a new log file in which to store results.
+ * <p>When this method is called, the {@link ResultLogManager} will stop
+ * logging in its current log file and use the new specified file instead.
+ * If that file already exists, it will be renamed by appending a '~' to
+ * its name, and a new empty file with the name specified by
+ * <var>basename</var> will be created.
+ * </p>
+ * <p>Calling this method has no side effect on the {@link
+ * com.sun.jmx.examples.scandir.config.ScanManagerConfig#getInitialResultLogConfig
+ * InitialResultLogConfig} held in the {@link ScanDirConfigMXBean}
+ * configuration. To apply these new values to the
+ * {@link ScanDirConfigMXBean}
+ * configuration, you must call {@link
+ * ScanManagerMXBean#applyCurrentResultLogConfig
+ * ScanManagerMXBean.applyCurrentResultLogConfig}.
+ *<p>
+ * @param basename The name of the new log file. This will be the
+ * new name returned by {@link #getLogFileName}.
+ * @param maxRecord maximum number of records to log in the specified file
+ * before creating a new file. <var>maxRecord</var> will be the
+ * new value returned by {@link #getLogFileCapacity}.
+ * When that maximum number of
+ * records is reached the {@link ResultLogManager} will rename
+ * the file by appending a '~' to its name, and a new empty
+ * log file will be created.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void newLogFile(String basename, long maxRecord)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Logs a result record to the active result logs (memory,file,both,or none)
+ * depending on how this MBean is currently configured.
+ * @see #getLogFileName()
+ * @see #getMemoryLogCapacity()
+ * @param record The result record to log.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void log(ResultRecord record)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the name of the current result log file.
+ * <p><code>null</code> means that no log file is configured: logging
+ * to file is disabled.
+ * </p>
+ * @return The name of the current result log file, or <code>null</code>
+ * if logging to file is disabled.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getLogFileName()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the whole content of the memory log. This cannot exceed
+ * {@link #getMemoryLogCapacity} records.
+ *
+ * @return the whole content of the memory log.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ResultRecord[] getMemoryLog()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the maximum number of records that can be logged in the
+ * memory log.
+ * <p>
+ * A non positive value - <code>0</code> or negative - means that
+ * logging in memory is disabled.
+ * </p>
+ * <p>The memory log is a FIFO: when its maximum capacity is reached, its
+ * head element is removed to make place for a new element at its tail.
+ * </p>
+ * @return The maximum number of records that can be logged in the
+ * memory log. A value {@code <= 0} means that logging in memory is
+ * disabled.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public int getMemoryLogCapacity()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Sets the maximum number of records that can be logged in the
+ * memory log.
+ * <p>The memory log is a FIFO: when its maximum capacity is reached, its
+ * head element is removed to make place for a new element at its tail.
+ * </p>
+ * @param size The maximum number of result records that can be logged in the memory log. <p>
+ * A non positive value - <code>0</code> or negative - means that
+ * logging in memory is disabled. It will also have the side
+ * effect of clearing the memory log.
+ * </p>
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void setMemoryLogCapacity(int size)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Sets the maximum number of records that can be logged in the result log
+ * file.
+ * <p>When that maximum number of
+ * records is reached the {@link ResultLogManager} will rename
+ * the result log file by appending a '~' to its name, and a new empty
+ * log file will be created.
+ * </p>
+ * <p>If logging to file is disabled calling this method
+ * is irrelevant.
+ * </p>
+ * @param maxRecord maximum number of records to log in the result log file.
+ * @see #getLogFileName()
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void setLogFileCapacity(long maxRecord)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the maximum number of records that can be logged in the result log
+ * file.
+ * <p>When that maximum number of
+ * records is reached the {@link ResultLogManager} will rename
+ * the result log file by appending a '~' to its name, and a new empty
+ * log file will be created.
+ * </p>
+ * @see #getLogFileName()
+ * @return The maximum number of records that can be logged in the result
+ * log file.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public long getLogFileCapacity()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets The number of records that have been logged in the
+ * current result log file. This will always be less than
+ * {@link #getLogFileCapacity()}.
+ * @return The number of records in the
+ * current result log file.
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public long getLoggedCount()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Clears the memory log and result log file.
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void clearLogs()
+ throws IOException, InstanceNotFoundException;
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java
new file mode 100644
index 0000000..f4bf1b6
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirAgent.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
+import javax.management.JMException;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationListener;
+
+/**
+ * <p>
+ * The <code>ScanDirAgent</code> is the Agent class for the <i>scandir</i>
+ * application.
+ * This class contains the {@link #main} method to start a standalone
+ * <i>scandir</i> application.
+ * </p>
+ * <p>
+ * The {@link #main main()} method simply registers a {@link
+ * ScanManagerMXBean} in the platform MBeanServer - see {@link #init init},
+ * and then waits for someone to call {@link ScanManagerMXBean#close close}
+ * on that MBean.
+ * </p>
+ * <p>
+ * When the {@link ScanManagerMXBean} state is switched to {@link
+ * ScanManagerMXBean.ScanState#CLOSED CLOSED}, {@link #cleanup cleanup} is
+ * called, the {@link ScanManagerMXBean} is unregistered, and the application
+ * terminates (i.e. the main thread completes).
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+public class ScanDirAgent {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ScanDirAgent.class.getName());
+
+ // Proxy to the ScanManagerMXBean - created by init();
+ //
+ private volatile ScanManagerMXBean proxy = null;
+
+ // A queue to put received Notifications.
+ //
+ private final BlockingQueue<Notification> queue;
+
+ // A listener that will put notifications into the queue.
+ //
+ private final NotificationListener listener;
+
+ /**
+ * Creates a new instance of ScanDirAgent
+ * You will need to call {@link #init()} later on in order to initialize
+ * the application.
+ * @see #main
+ **/
+ public ScanDirAgent() {
+ // Initialize the notification queue
+ queue = new LinkedBlockingQueue<Notification>();
+
+ // Creates the listener.
+ listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ // Just put the received notification in the queue.
+ // It will be consumed later on by 'waitForClose()'
+ //
+ LOG.finer("Queuing received notification "+notification);
+ queue.put(notification);
+ } catch (InterruptedException ex) {
+ // OK
+ }
+ }
+ };
+ }
+
+ /**
+ * Initialize the application by registering a ScanManagerMXBean in
+ * the platform MBeanServer
+ * @throws java.io.IOException Registration failed for communication-related reasons.
+ * @throws javax.management.JMException Registration failed for JMX-related reasons.
+ */
+ public void init() throws IOException, JMException {
+
+ // Registers the ScanManagerMXBean singleton in the
+ // platform MBeanServer
+ //
+ proxy = ScanManager.register();
+
+ // Registers a NotificationListener with the ScanManagerMXBean in
+ // order to receive state changed notifications.
+ //
+ ((NotificationEmitter)proxy).addNotificationListener(listener,null,null);
+ }
+
+ /**
+ * Cleanup after close: unregister the ScanManagerMXBean singleton.
+ * @throws java.io.IOException Cleanup failed for communication-related reasons.
+ * @throws javax.management.JMException Cleanup failed for JMX-related reasons.
+ */
+ public void cleanup() throws IOException, JMException {
+ try {
+ ((NotificationEmitter)proxy).
+ removeNotificationListener(listener,null,null);
+ } finally {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ }
+ }
+
+ /**
+ * Wait for someone to call 'close()' on the ScanManagerMXBean singleton.
+ * Every time its state changes, the ScanManagerMXBean emits a notification.
+ * We don't rely on the notification content (if we were using a remote
+ * connection, we could miss some notifications) - we simply use the
+ * state change notifications to react more quickly to state changes.
+ * We do so simply by polling the {@link BlockingQueue} in which our
+ * listener is pushing notifications, and checking the ScanManagerMXBean
+ * state every time that a notification is received.
+ * <p>
+ * We can do so because we know that once the ScanManagerMXBean state is
+ * switched to 'CLOSED', it will remain 'CLOSED' whatsoever. <br>
+ * Therefore we don't need to concern ourselves with the possibility of
+ * missing the window in which the ScanManagerMXBean state's will be
+ * CLOSED, because that particular window stays opened forever.
+ * <p>
+ * Had we wanted to wait for 'RUNNING', we would have needed to apply
+ * a different strategy - e.g. by taking into account the actual content
+ * of the state changed notifications we received.
+ * @throws java.io.IOException wait failed - a communication problem occurred.
+ * @throws javax.management.JMException wait failed - the MBeanServer threw an exception.
+ */
+ public void waitForClose() throws IOException, JMException {
+
+ // Wait until state is closed
+ while(proxy.getState() != ScanState.CLOSED ) {
+ try {
+ // Wake up at least every 30 seconds - if we missed a
+ // notification - we will at least get a chance to
+ // call getState(). 30 seconds is obviously quite
+ // arbitrary - if this were a real daemon - id'be tempted
+ // to wait 30 minutes - knowing that any incoming
+ // notification will wake me up anyway.
+ // Note: we simply use the state change notifications to
+ // react more quickly to state changes: see javadoc above.
+ //
+ queue.poll(30,TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ // OK
+ }
+ }
+ }
+
+ /**
+ * The agent's main: {@link #init registers} a {@link ScanManagerMXBean},
+ * {@link #waitForClose waits} until its state is {@link
+ * ScanManagerMXBean.ScanState#CLOSED CLOSED}, {@link #cleanup cleanup}
+ * and exits.
+ * @param args the command line arguments - ignored
+ * @throws java.io.IOException A communication problem occurred.
+ * @throws javax.management.JMException A JMX problem occurred.
+ */
+ public static void main(String[] args)
+ throws IOException, JMException {
+ System.out.println("Initializing ScanManager...");
+ final ScanDirAgent agent = new ScanDirAgent();
+ agent.init();
+ try {
+ System.out.println("Waiting for ScanManager to close...");
+ agent.waitForClose();
+ } finally {
+ System.out.println("Cleaning up...");
+ agent.cleanup();
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java
new file mode 100644
index 0000000..442a607
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirClient.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.rmi.ssl.SslRMIClientSocketFactory;
+
+/**
+ * The ScanDirClient class is a very simple programmatic client example
+ * which is able to connect to a secured JMX <i>scandir</i> application.
+ * <p>The program initialize the connection environment map with the
+ * appropriate properties and credentials, and then connects to the
+ * secure JMX <i>scandir</i> daemon.</p>
+ * <p>It gets the application's current configuration and prints it on
+ * its <code>System.out</code>.</p>
+ * <p>The {@link #main main} method takes two arguments: the host on which
+ * the server is running (localhost), and the port number
+ * that was configured to start the server RMI Connector (4545).
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+public class ScanDirClient {
+
+ // This class has only a main.
+ private ScanDirClient() { }
+
+ /**
+ * The usage string for the ScanDirClient.
+ */
+ public static final String USAGE = ScanDirClient.class.getSimpleName() +
+ " <server-host> <rmi-port-number>";
+
+ /**
+ * Connects to a secured JMX <i>scandir</i> application.
+ * @param args The {@code main} method takes two parameters:
+ * <ul>
+ * <li>args[0] must be the server's host</li>
+ * <li>args[1] must be the rmi port number at which the
+ * JMX <i>scandir</i> daemon is listening for connections
+ * - that is, the port number of its JMX RMI Connector which
+ * was configured in {@code management.properties}
+ * </li>
+ * <ul>
+ **/
+ public static void main(String[] args) {
+ try {
+ // Check args
+ //
+ if (args==null || args.length!=2) {
+ System.err.println("Bad number of arguments: usage is: \n\t" +
+ USAGE);
+ System.exit(1);
+ }
+ try {
+ InetAddress.getByName(args[0]);
+ } catch (UnknownHostException x) {
+ System.err.println("No such host: " + args[0]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ } catch (Exception x) {
+ System.err.println("Bad address: " + args[0]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ }
+ try {
+ if (Integer.parseInt(args[1]) <= 0) {
+ System.err.println("Bad port value: " + args[1]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ }
+ } catch (Exception x) {
+ System.err.println("Bad argument: " + args[1]+
+ "\n usage is: \n\t" + USAGE);
+ System.exit(2);
+ }
+
+ // Create an environment map to hold connection properties
+ // like credentials etc... We will later pass this map
+ // to the JMX Connector.
+ //
+ System.out.println("\nInitialize the environment map");
+ final Map<String,Object> env = new HashMap<String,Object>();
+
+ // Provide the credentials required by the server
+ // to successfully perform user authentication
+ //
+ final String[] credentials = new String[] { "guest" , "guestpasswd" };
+ env.put("jmx.remote.credentials", credentials);
+
+ // Provide the SSL/TLS-based RMI Client Socket Factory required
+ // by the JNDI/RMI Registry Service Provider to communicate with
+ // the SSL/TLS-protected RMI Registry
+ //
+ env.put("com.sun.jndi.rmi.factory.socket",
+ new SslRMIClientSocketFactory());
+
+ // Create the RMI connector client and
+ // connect it to the RMI connector server
+ // args[0] is the server's host - localhost
+ // args[1] is the secure server port - 4545
+ //
+ System.out.println("\nCreate the RMI connector client and " +
+ "connect it to the RMI connector server");
+ final JMXServiceURL url = new JMXServiceURL(
+ "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1] +
+ "/jmxrmi");
+
+ System.out.println("Connecting to: "+url);
+ final JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
+
+ // Get an MBeanServerConnection
+ //
+ System.out.println("\nGet the MBeanServerConnection");
+ final MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
+
+ // Create a proxy for the ScanManager MXBean
+ //
+ final ScanManagerMXBean proxy =
+ ScanManager.newSingletonProxy(mbsc);
+
+ // Get the ScanDirConfig MXBean from the scan manager
+ //
+ System.out.println(
+ "\nGet ScanDirConfigMXBean from ScanManagerMXBean");
+ final ScanDirConfigMXBean configMBean =
+ proxy.getConfigurationMBean();
+
+ // Print the scan dir configuration
+ //
+ System.out.println(
+ "\nGet 'Configuration' attribute on ScanDirConfigMXBean");
+ System.out.println("\nConfiguration:\n" +
+ configMBean.getConfiguration());
+
+ // Try to invoke the "close" method on the ScanManager MXBean.
+ //
+ // Should get a SecurityException as the user "guest" doesn't
+ // have readwrite access.
+ //
+ System.out.println("\nInvoke 'close' on ScanManagerMXBean");
+ try {
+ proxy.close();
+ } catch (SecurityException e) {
+ System.out.println("\nGot expected security exception: " + e);
+ }
+
+ // Close MBeanServer connection
+ //
+ System.out.println("\nClose the connection to the server");
+ jmxc.close();
+ System.out.println("\nBye! Bye!");
+ } catch (Exception e) {
+ System.out.println("\nGot unexpected exception: " + e);
+ e.printStackTrace();
+ System.exit(3);
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java
new file mode 100644
index 0000000..7ecd8a1
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfig.java
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManager.getNextSeqNumber;
+import static com.sun.jmx.examples.scandir.ScanDirConfigMXBean.SaveState.*;
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.FileMatch;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.management.*;
+import javax.xml.bind.JAXBException;
+
+/**
+ * <p>The <code>ScanDirConfig</code> MBean is in charge of the
+ * <i>scandir</i> application configuration.
+ * </p>
+ * <p>The <code>ScanDirConfig</code> MBean is able to
+ * load and save the <i>scandir</i> application configuration to and from an
+ * XML file.
+ * </p>
+ * <p>
+ * It will let you also interactively modify that configuration, which you
+ * can later save to the file, by calling {@link #save}, or discard, by
+ * reloading the file without saving - see {@link #load}.
+ * </p>
+ * <p>
+ * There can be as many <code>ScanDirConfigMXBean</code> registered
+ * in the MBeanServer as you like, but only one of them will be identified as
+ * the current configuration of the {@link ScanManagerMXBean}.
+ * You can switch to another configuration by calling {@link
+ * ScanManagerMXBean#setConfigurationMBean
+ * ScanManagerMXBean.setConfigurationMBean}.
+ * </p>
+ * <p>
+ * Once the current configuration has been loaded (by calling {@link #load})
+ * or modified (by calling one of {@link #addDirectoryScanner
+ * addDirectoryScanner}, {@link #removeDirectoryScanner removeDirectoryScanner}
+ * or {@link #setConfiguration setConfiguration}) it can be pushed
+ * to the {@link ScanManagerMXBean} by calling {@link
+ * ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration(true)} -
+ * <code>true</code> means that we apply the configuration from memory,
+ * without first reloading the file.
+ * </p>
+ * <p>
+ * The <code>ScanDirConfig</code> uses the XML annotated Java Beans defined
+ * in the {@link com.sun.jmx.examples.scandir.config} package.
+ * </p>
+ * <p>
+ * <u>Note:</u> The <code>ScanDirConfig</code> should probably use
+ * {@code java.nio.channels.FileLock} and lock its configuration file so that
+ * two <code>ScanDirConfig</code> object do not share the same file, but it
+ * doesn't. Feel free to improve the application in that way.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanDirConfig extends NotificationBroadcasterSupport
+ implements ScanDirConfigMXBean, MBeanRegistration {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ScanDirConfig.class.getName());
+
+ // We will emit a notification when the save state of this object
+ // chenges. We use directly the base notification class, with a
+ // notification type that indicates the new state at which the
+ // object has arrived.
+ //
+ // All these notification types will have the same prefix, which is
+ // 'com.sun.jmx.examples.scandir.config'.
+ //
+ private final static String NOTIFICATION_PREFIX =
+ ScanManagerConfig.class.getPackage().getName();
+
+ /**
+ * The <i>com.sun.jmx.examples.scandir.config.saved</i> notification
+ * indicates that the configuration data was saved.
+ **/
+ public final static String NOTIFICATION_SAVED =
+ NOTIFICATION_PREFIX+".saved";
+ /**
+ * The <i>com.sun.jmx.examples.scandir.config.loaded</i> notification
+ * indicates that the configuration data was loaded.
+ **/
+ public final static String NOTIFICATION_LOADED =
+ NOTIFICATION_PREFIX+".loaded";
+
+ /**
+ * The <i>com.sun.jmx.examples.scandir.config.modified</i> notification
+ * indicates that the configuration data was modified.
+ **/
+ public final static String NOTIFICATION_MODIFIED =
+ NOTIFICATION_PREFIX+".modified";
+
+ // The array of MBeanNotificationInfo that will be exposed in the
+ // ScanDirConfigMXBean MBeanInfo.
+ // We will pass this array to the NotificationBroadcasterSupport
+ // constructor.
+ //
+ private static MBeanNotificationInfo[] NOTIFICATION_INFO = {
+ new MBeanNotificationInfo(
+ new String[] {NOTIFICATION_SAVED},
+ Notification.class.getName(),
+ "Emitted when the configuration is saved"),
+ new MBeanNotificationInfo(
+ new String[] {NOTIFICATION_LOADED},
+ Notification.class.getName(),
+ "Emitted when the configuration is loaded"),
+ new MBeanNotificationInfo(
+ new String[] {NOTIFICATION_MODIFIED},
+ Notification.class.getName(),
+ "Emitted when the configuration is modified"),
+ };
+
+ // The ScanDirConfigMXBean configuration data.
+ private volatile ScanManagerConfig config;
+
+ // The name of the configuration file
+ private String filename = null;
+
+ // The name of this configuration. This is usually both equal to
+ // config.getName() and objectName.getKeyProperty(name).
+ private volatile String configname = null;
+
+ // This object save state. CREATED is the initial state.
+ //
+ private volatile SaveState status = CREATED;
+
+ /**
+ * Creates a new {@link ScanDirConfigMXBean}.
+ * <p>{@code ScanDirConfigMXBean} can be created by the {@link
+ * ScanManagerMXBean}, or directly by a remote client, using
+ * {@code createMBean} or {@code registerMBean}.
+ * </p>
+ * <p>{@code ScanDirConfigMXBean} created by the {@link
+ * ScanManagerMXBean} will be unregistered by the
+ * {@code ScanManagerMXBean}. {@code ScanDirConfigMXBean} created
+ * directly by a remote client will not be unregistered by the
+ * {@code ScanManagerMXBean} - this will remain to the responsibility of
+ * the code/client that created them.
+ * </p>
+ * <p>This object is created empty, you should call load() if you want it
+ * to load its data from the configuration file.
+ * </p>
+ * @param filename The configuration file used by this MBean.
+ * Can be null (in which case load() and save() will fail).
+ * Can point to a file that does not exists yet (in which case
+ * load() will fail if called before save(), and save() will
+ * attempt to create that file). Can point to an existing file,
+ * in which case load() will load that file and save() will save
+ * to that file.
+ *
+ **/
+ public ScanDirConfig(String filename) {
+ this(filename,null);
+ }
+
+ /**
+ * Create a new ScanDirConfig MBean with an initial configuration.
+ * @param filename The name of the configuration file.
+ * @param initialConfig an initial configuration.
+ **/
+ public ScanDirConfig(String filename, ScanManagerConfig initialConfig) {
+ super(NOTIFICATION_INFO);
+ this.filename = filename;
+ this.config = initialConfig;
+ }
+
+
+ // see ScanDirConfigMXBean
+ public void load() throws IOException {
+ if (filename == null)
+ throw new UnsupportedOperationException("load");
+
+ synchronized(this) {
+ config = new XmlConfigUtils(filename).readFromFile();
+ if (configname != null) config = config.copy(configname);
+ else configname = config.getName();
+
+ status=LOADED;
+ }
+ sendNotification(NOTIFICATION_LOADED);
+ }
+
+ // see ScanDirConfigMXBean
+ public void save() throws IOException {
+ if (filename == null)
+ throw new UnsupportedOperationException("load");
+ synchronized (this) {
+ new XmlConfigUtils(filename).writeToFile(config);
+ status = SAVED;
+ }
+ sendNotification(NOTIFICATION_SAVED);
+ }
+
+ // see ScanDirConfigMXBean
+ public ScanManagerConfig getConfiguration() {
+ synchronized (this) {
+ return XmlConfigUtils.xmlClone(config);
+ }
+ }
+
+
+ // sends a notification indicating the new save state.
+ private void sendNotification(String type) {
+ final Object source = (objectName==null)?this:objectName;
+ final Notification n = new Notification(type,source,
+ getNextSeqNumber(),
+ "The configuration is "+
+ type.substring(type.lastIndexOf('.')+1));
+ sendNotification(n);
+ }
+
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * registered in the MBean server. If the name of the MBean is not
+ * specified, the MBean can provide a name for its registration. If
+ * any exception is raised, the MBean will not be registered in the
+ * MBean server.
+ * @param server The MBean server in which the MBean will be registered.
+ * @param name The object name of the MBean. This name is null if the
+ * name parameter to one of the createMBean or registerMBean methods in
+ * the MBeanServer interface is null. In that case, this method will
+ * try to guess its MBean name by examining its configuration data.
+ * If its configuration data is null (nothing was provided in the
+ * constructor) or doesn't contain a name, this method returns {@code null},
+ * and registration will fail.
+ * <p>
+ * Otherwise, if {@code name} wasn't {@code null} or if a default name could
+ * be constructed, the name of the configuration will be set to
+ * the value of the ObjectName's {@code name=} key, and the configuration
+ * data will always be renamed to reflect this change.
+ * </p>
+ *
+ * @return The name under which the MBean is to be registered.
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public ObjectName preRegister(MBeanServer server, ObjectName name)
+ throws Exception {
+ if (name == null) {
+ if (config == null) return null;
+ if (config.getName() == null) return null;
+ name = ScanManager.
+ makeMBeanName(ScanDirConfigMXBean.class,config.getName());
+ }
+ objectName = name;
+ mbeanServer = server;
+ synchronized (this) {
+ configname = name.getKeyProperty("name");
+ if (config == null) config = new ScanManagerConfig(configname);
+ else config = config.copy(configname);
+ }
+ return name;
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having
+ * been registered in the MBean server or after the registration has
+ * failed.
+ * <p>This implementation does nothing</p>
+ * @param registrationDone Indicates whether or not the MBean has been
+ * successfully registered in the MBean server. The value false means
+ * that the registration has failed.
+ */
+ public void postRegister(Boolean registrationDone) {
+ // Nothing to do here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * unregistered by the MBean server.
+ * <p>This implementation does nothing</p>
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public void preDeregister() throws Exception {
+ // Nothing to do here.
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having been
+ * unregistered in the MBean server.
+ * <p>This implementation does nothing</p>
+ */
+ public void postDeregister() {
+ // Nothing to do here.
+ }
+
+ // see ScanDirConfigMXBean
+ public String getConfigFilename() {
+ return filename;
+ }
+
+ // see ScanDirConfigMXBean
+ public void setConfiguration(ScanManagerConfig config) {
+ synchronized (this) {
+ if (config == null) {
+ this.config = null;
+ return;
+ }
+
+ if (configname == null)
+ configname = config.getName();
+
+ this.config = config.copy(configname);
+ status = MODIFIED;
+ }
+ sendNotification(NOTIFICATION_MODIFIED);
+ }
+
+ // see ScanDirConfigMXBean
+ public DirectoryScannerConfig
+ addDirectoryScanner(String name, String dir, String filePattern,
+ long sizeExceedsMaxBytes, long sinceLastModified) {
+ final DirectoryScannerConfig scanner =
+ new DirectoryScannerConfig(name);
+ scanner.setRootDirectory(dir);
+ if (filePattern!=null||sizeExceedsMaxBytes>0||sinceLastModified>0) {
+ final FileMatch filter = new FileMatch();
+ filter.setFilePattern(filePattern);
+ filter.setSizeExceedsMaxBytes(sizeExceedsMaxBytes);
+ if (sinceLastModified > 0)
+ filter.setLastModifiedBefore(new Date(new Date().getTime()
+ -sinceLastModified));
+ scanner.addIncludeFiles(filter);
+ }
+ synchronized (this) {
+ config.putScan(scanner);
+ status = MODIFIED;
+ }
+ LOG.fine("config: "+config);
+ sendNotification(NOTIFICATION_MODIFIED);
+ return scanner;
+ }
+
+ // see ScanDirConfigMXBean
+ public DirectoryScannerConfig removeDirectoryScanner(String name)
+ throws IOException, InstanceNotFoundException {
+ final DirectoryScannerConfig scanner;
+ synchronized (this) {
+ scanner = config.removeScan(name);
+ if (scanner == null)
+ throw new IllegalArgumentException(name+": scanner not found");
+ status = MODIFIED;
+ }
+ sendNotification(NOTIFICATION_MODIFIED);
+ return scanner;
+ }
+
+ // see ScanDirConfigMXBean
+ public SaveState getSaveState() {
+ return status;
+ }
+
+ // These methods are used by ScanManager to guess a configuration name from
+ // a configuration filename.
+ //
+ static String DEFAULT = "DEFAULT";
+
+ private static String getBasename(String name) {
+ final int dot = name.indexOf('.');
+ if (dot<0) return name;
+ if (dot==0) return getBasename(name.substring(1));
+ return name.substring(0,dot);
+ }
+
+ static String guessConfigName(String configFileName,String defaultFile) {
+ try {
+ if (configFileName == null) return DEFAULT;
+ final File f = new File(configFileName);
+ if (f.canRead()) {
+ final String confname = XmlConfigUtils.read(f).getName();
+ if (confname != null && confname.length()>0) return confname;
+ }
+ final File f2 = new File(defaultFile);
+ if (f.equals(f2)) return DEFAULT;
+ final String guess = getBasename(f.getName());
+ if (guess == null) return DEFAULT;
+ if (guess.length()==0) return DEFAULT;
+ return guess;
+ } catch (Exception x) {
+ return DEFAULT;
+ }
+ }
+
+ // Set by preRegister()
+ private volatile MBeanServer mbeanServer;
+ private volatile ObjectName objectName;
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java
new file mode 100644
index 0000000..eb4f375
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.java
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.IOException;
+import javax.management.InstanceNotFoundException;
+
+/**
+ * <p>The <code>ScanDirConfigMXBean</code> is in charge of the
+ * <i>scandir</i> application configuration.
+ * </p>
+ * <p>The <code>ScanDirConfigMXBean</code> is an MBean which is able to
+ * load and save the <i>scandir</i> application configuration to and from an
+ * XML file.
+ * </p>
+ * <p>
+ * It will let you also interactively modify that configuration, which you
+ * can later save to the file, by calling {@link #save}, or discard, by
+ * reloading the file without saving - see {@link #load}.
+ * </p>
+ * <p>
+ * There can be as many <code>ScanDirConfigMXBean</code> registered
+ * in the MBeanServer as you like, but only one of them will be identified as
+ * the current configuration of the {@link ScanManagerMXBean}.
+ * You can switch to another configuration by calling {@link
+ * ScanManagerMXBean#setConfigurationMBean
+ * ScanManagerMXBean.setConfigurationMBean}.
+ * </p>
+ * <p>
+ * Once the current configuration has been loaded (by calling {@link #load})
+ * or modified (by calling one of {@link #addDirectoryScanner
+ * addDirectoryScanner}, {@link #removeDirectoryScanner removeDirectoryScanner}
+ * or {@link #setConfiguration setConfiguration}) it can be pushed
+ * to the {@link ScanManagerMXBean} by calling {@link
+ * ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration(true)} -
+ * <code>true</code> means that we apply the configuration from memory,
+ * without first reloading the file.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public interface ScanDirConfigMXBean {
+ /**
+ * This state tells whether the configuration reflected by the
+ * {@link ScanDirConfigMXBean} was loaded in memory, saved to the
+ * configuration file, or modified since last saved.
+ * Note that this state doesn't tell whether the configuration was
+ * applied by the {@link ScanManagerMXBean}.
+ **/
+ public enum SaveState {
+ /**
+ * Initial state: the {@link ScanDirConfigMXBean} is created, but
+ * neither {@link #load} or {@link #save} was yet called.
+ **/
+ CREATED,
+
+ /**
+ * The configuration reflected by the {@link ScanDirConfigMXBean} has
+ * been loaded, but not modified yet.
+ **/
+ LOADED,
+
+ /**
+ * The configuration was modified. The modifications are held in memory.
+ * Call {@link #save} to save them to the file, or {@link #load} to
+ * reload the file and discard them.
+ **/
+ MODIFIED,
+
+ /**
+ * The configuration was saved.
+ **/
+ SAVED
+ };
+
+ /**
+ * Loads the configuration from the {@link
+ * #getConfigFilename configuration file}.
+ * <p>Any unsaved modification will be lost. The {@link #getSaveState state}
+ * is switched to {@link SaveState#LOADED LOADED}.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @see #getSaveState()
+ * @throws IOException The configuration couldn't be loaded from the file,
+ * e.g. because the file doesn't exist or isn't
+ * readable.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void load()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Saves the configuration to the {@link
+ * #getConfigFilename configuration file}.
+ *
+ * <p>If the configuration file doesn't exists, this method will
+ * attempt to create it. Otherwise, the existing file will
+ * be renamed by appending a '~' to its name, and a new file
+ * will be created, in which the configuration will be saved.
+ * The {@link #getSaveState state}
+ * is switched to {@link SaveState#SAVED SAVED}.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean}.
+ * </p>
+ * @see #getSaveState()
+ *
+ * @throws IOException The configuration couldn't be saved to the file,
+ * e.g. because the file couldn't be created.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void save()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the name of the configuration file.
+ * <p>If the configuration file doesn't exists, {@link #load} will fail
+ * and {@link #save} will attempt to create the file.
+ * </p>
+ *
+ * @return The configuration file name for this MBean.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public String getConfigFilename()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the current configuration data.
+ * <p>
+ * This method returns the configuration data which is currently held
+ * in memory.
+ * </p>
+ * <p>Call {@link #load} to reload the data from the configuration
+ * file, and {@link #save} to save the data to the configuration
+ * file.
+ * </p>
+ * @see #getSaveState()
+ * @return The current configuration data in memory.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanManagerConfig getConfiguration()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Sets the current configuration data.
+ * <p>
+ * This method replaces the configuration data in memory.
+ * The {@link #getSaveState state} is switched to {@link
+ * SaveState#MODIFIED MODIFIED}.
+ * </p>
+ * <p>Calling {@link #load} will reload the data from the configuration
+ * file, and all modifications will be lost.
+ * Calling {@link #save} will save the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @param config The new configuration data.
+ * @see #getSaveState()
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void setConfiguration(ScanManagerConfig config)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Adds a new directory scanner to the current configuration data.
+ * <p>
+ * This method updates the configuration data in memory, adding
+ * a {@link DirectoryScannerConfig} to the {@link
+ * ScanManagerConfig#getScanList directory scanner list}.
+ * The {@link #getSaveState state} is switched to {@link
+ * SaveState#MODIFIED MODIFIED}.
+ * </p>
+ * <p>Calling {@link #load} will reload the data from the configuration
+ * file, and all modifications will be lost.
+ * Calling {@link #save} will save the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @param name A name for the new directory scanner. This is the value
+ * that will be later used in the {@link DirectoryScannerMXBean}
+ * ObjectName for the <code>name=</code> key.
+ * @param dir The root directory at which this scanner will start scanning.
+ * @param filePattern A {@link java.util.regex.Pattern regular expression}
+ * to match against a selected file name.
+ * @param sizeExceedsMaxBytes Only file whose size exceeds that limit will
+ * be selected. <code.0</code> or a
+ * negative value means no limit.
+ * @param sinceLastModified Select files which haven't been modified for
+ * that number of milliseconds - i.e.
+ * {@code sinceLastModified=3600000} will exclude files which
+ * have been modified in the last hour.
+ * The date of last modification is ignored if <code>0</code> or a
+ * negative value is provided.
+ * @see #getSaveState()
+ * @return The added <code>DirectoryScannerConfig</code>.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public DirectoryScannerConfig
+ addDirectoryScanner(String name, String dir, String filePattern,
+ long sizeExceedsMaxBytes, long sinceLastModified)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Removes a directory scanner from the current configuration data.
+ * <p>
+ * This method updates the configuration data in memory, removing
+ * a {@link DirectoryScannerConfig} from the {@link
+ * ScanManagerConfig#getScanList directory scanner list}.
+ * The {@link #getSaveState state} is switched to {@link
+ * SaveState#MODIFIED MODIFIED}.
+ * </p>
+ * <p>Calling {@link #load} will reload the data from the configuration
+ * file, and all modifications will be lost.
+ * Calling {@link #save} will save the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * This action has no effect on the {@link ScanManagerMXBean} until
+ * {@link ScanManagerMXBean#getConfigurationMBean ScanManagerMXBean}
+ * points to this MBean and {@link ScanManagerMXBean#applyConfiguration
+ * ScanManagerMXBean.applyConfiguration} is called.
+ * </p>
+ * @param name The name of the new directory scanner. This is the value
+ * that is used in the {@link DirectoryScannerMXBean}
+ * ObjectName for the <code>name=</code> key.
+ * @return The removed <code>DirectoryScannerConfig</code>.
+ * @throws IllegalArgumentException if there's no directory scanner by
+ * that name in the current configuration data.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public DirectoryScannerConfig
+ removeDirectoryScanner(String name)
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the save state of the current configuration data.
+ * <p>
+ * {@link SaveState#CREATED CREATED} means that the configuration data was just
+ * created. It has not been loaded from the configuration file.
+ * Calling {@link #load} will load the data from the configuration file.
+ * Calling {@link #save} will write the empty data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * {@link SaveState#LOADED LOADED} means that the configuration data
+ * was loaded from the configuration file.
+ * </p>
+ * <p>
+ * {@link SaveState#MODIFIED MODIFIED} means that the configuration data
+ * was modified since it was last loaded or saved.
+ * Calling {@link #load} will reload the data from the configuration file,
+ * and all modifications will be lost.
+ * Calling {@link #save} will write the modified data to the configuration
+ * file.
+ * </p>
+ * <p>
+ * {@link SaveState#SAVED SAVED} means that the configuration data
+ * was saved to the configuration file.
+ * </p>
+ * <p>
+ * This state doesn't indicate whether this MBean configuration data
+ * was {@link ScanManagerMXBean#applyConfiguration applied} by the
+ * {@link ScanManagerMXBean}.
+ * </p>
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ * @return The save state of the {@code ScanDirConfigMXBean}.
+ */
+ public SaveState getSaveState()
+ throws IOException, InstanceNotFoundException;
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java
new file mode 100644
index 0000000..e34b12a
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManager.java
@@ -0,0 +1,1160 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.File;
+
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.management.AttributeChangeNotification;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMException;
+import javax.management.JMX;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+/**
+ * <p>
+ * The <code>ScanManager</code> is responsible for applying a configuration,
+ * starting and scheduling directory scans, and reporting application state.
+ * </p>
+ * <p>
+ * The ScanManager MBean is a singleton MBean which controls
+ * scan session. The ScanManager name is defined by
+ * {@link #SCAN_MANAGER_NAME ScanManager.SCAN_MANAGER_NAME}.
+ * </p>
+ * <p>
+ * The <code>ScanManager</code> MBean is the entry point of the <i>scandir</i>
+ * application management interface. It is from this MBean that all other MBeans
+ * will be created and registered.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanManager implements ScanManagerMXBean,
+ NotificationEmitter, MBeanRegistration {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(ScanManager.class.getName());
+
+ /**
+ * The name of the ScanManager singleton MBean.
+ **/
+ public final static ObjectName SCAN_MANAGER_NAME =
+ makeSingletonName(ScanManagerMXBean.class);
+
+ /**
+ * Sequence number used for sending notifications. We use this
+ * sequence number throughout the application.
+ **/
+ private static long seqNumber=0;
+
+ /**
+ * The NotificationBroadcasterSupport object used to handle
+ * listener registration.
+ **/
+ private final NotificationBroadcasterSupport broadcaster;
+
+ /**
+ * The MBeanServer in which this MBean is registered. We obtain
+ * this reference by implementing the {@link MBeanRegistration}
+ * interface.
+ **/
+ private volatile MBeanServer mbeanServer;
+
+ /**
+ * A queue of pending notifications we are about to send.
+ * We're using a BlockingQueue in order to avoid sending
+ * notifications from within a synchronized block.
+ **/
+ private final BlockingQueue<Notification> pendingNotifs;
+
+ /**
+ * The state of the scan session.
+ **/
+ private volatile ScanState state = STOPPED;
+
+ /**
+ * The list of DirectoryScannerMBean that are run by a scan session.
+ **/
+ private final Map<ObjectName,DirectoryScannerMXBean> scanmap;
+
+ /**
+ * The list of ScanDirConfigMXBean that were created by this MBean.
+ **/
+ private final Map<ObjectName, ScanDirConfigMXBean> configmap;
+
+ // The ResultLogManager for this application.
+ private final ResultLogManager log;
+
+ /**
+ * We use a semaphore to ensure proper sequencing of exclusive
+ * action. The logic we have implemented is to fail - rather
+ * than block, if an exclusive action is already in progress.
+ **/
+ private final Semaphore sequencer = new Semaphore(1);
+
+ // A proxy to the current ScanDirConfigMXBean which holds the current
+ // configuration data.
+ //
+ private volatile ScanDirConfigMXBean config = null;
+
+ // Avoid to write parameters twices when creating a new ConcurrentHashMap.
+ //
+ private static <K, V> Map<K, V> newConcurrentHashMap() {
+ return new ConcurrentHashMap<K, V>();
+ }
+
+ // Avoid to write parameters twices when creating a new HashMap.
+ //
+ private static <K, V> Map<K, V> newHashMap() {
+ return new HashMap<K, V>();
+ }
+
+ /**
+ * Creates a default singleton ObjectName for a given class.
+ * @param clazz The interface class of the MBean for which we want to obtain
+ * a default singleton name, or its implementation class.
+ * Give one or the other depending on what you wish to see in
+ * the value of the key {@code type=}.
+ * @return A default singleton name for a singleton MBean class.
+ * @throws IllegalArgumentException if the name can't be created
+ * for some unfathomable reason (e.g. an unexpected
+ * exception was raised).
+ **/
+ public final static ObjectName makeSingletonName(Class clazz) {
+ try {
+ final Package p = clazz.getPackage();
+ final String packageName = (p==null)?null:p.getName();
+ final String className = clazz.getSimpleName();
+ final String domain;
+ if (packageName == null || packageName.length()==0) {
+ // We use a reference to ScanDirAgent.class to ease
+ // to keep track of possible class renaming.
+ domain = ScanDirAgent.class.getSimpleName();
+ } else {
+ domain = packageName;
+ }
+ final ObjectName name = new ObjectName(domain,"type",className);
+ return name;
+ } catch (Exception x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException(String.valueOf(clazz),x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Creates a default ObjectName with keys <code>type=</code> and
+ * <code>name=</code> for an instance of a given MBean interface class.
+ * @param clazz The interface class of the MBean for which we want to obtain
+ * a default name, or its implementation class.
+ * Give one or the other depending on what you wish to see in
+ * the value of the key {@code type=}.
+ * @param name The value of the <code>name=</code> key.
+ * @return A default name for an instance of the given MBean interface class.
+ * @throws IllegalArgumentException if the name can't be created.
+ * (e.g. an unexpected exception was raised).
+ **/
+ public static final ObjectName makeMBeanName(Class clazz, String name) {
+ try {
+ return ObjectName.
+ getInstance(makeSingletonName(clazz)
+ .toString()+",name="+name);
+ } catch (MalformedObjectNameException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException(String.valueOf(name),x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Return the ObjectName for a DirectoryScannerMXBean of that name.
+ * This is {@code makeMBeanName(DirectoryScannerMXBean.class,name)}.
+ * @param name The value of the <code>name=</code> key.
+ * @return the ObjectName for a DirectoryScannerMXBean of that name.
+ */
+ public static final ObjectName makeDirectoryScannerName(String name) {
+ return makeMBeanName(DirectoryScannerMXBean.class,name);
+ }
+
+ /**
+ * Return the ObjectName for a {@code ScanDirConfigMXBean} of that name.
+ * This is {@code makeMBeanName(ScanDirConfigMXBean.class,name)}.
+ * @param name The value of the <code>name=</code> key.
+ * @return the ObjectName for a {@code ScanDirConfigMXBean} of that name.
+ */
+ public static final ObjectName makeScanDirConfigName(String name) {
+ return makeMBeanName(ScanDirConfigMXBean.class,name);
+ }
+
+ /**
+ * Create and register a new singleton instance of the ScanManager
+ * MBean in the given {@link MBeanServerConnection}.
+ * @param mbs The MBeanServer in which the new singleton instance
+ * should be created.
+ * @throws JMException The MBeanServer connection raised an exception
+ * while trying to instantiate and register the singleton MBean
+ * instance.
+ * @throws IOException There was a connection problem while trying to
+ * communicate with the underlying MBeanServer.
+ * @return A proxy for the registered MBean.
+ **/
+ public static ScanManagerMXBean register(MBeanServerConnection mbs)
+ throws IOException, JMException {
+ final ObjectInstance moi =
+ mbs.createMBean(ScanManager.class.getName(),SCAN_MANAGER_NAME);
+ final ScanManagerMXBean proxy =
+ JMX.newMXBeanProxy(mbs,moi.getObjectName(),
+ ScanManagerMXBean.class,true);
+ return proxy;
+ }
+
+ /**
+ * Creates a new {@code ScanManagerMXBean} proxy over the given
+ * {@code MBeanServerConnection}. Does not check whether a
+ * {@code ScanManagerMXBean}
+ * is actually registered in that {@code MBeanServerConnection}.
+ * @return a new {@code ScanManagerMXBean} proxy.
+ * @param mbs The {@code MBeanServerConnection} which holds the
+ * {@code ScanManagerMXBean} to proxy.
+ */
+ public static ScanManagerMXBean
+ newSingletonProxy(MBeanServerConnection mbs) {
+ final ScanManagerMXBean proxy =
+ JMX.newMXBeanProxy(mbs,SCAN_MANAGER_NAME,
+ ScanManagerMXBean.class,true);
+ return proxy;
+ }
+
+ /**
+ * Creates a new {@code ScanManagerMXBean} proxy over the platform
+ * {@code MBeanServer}. This is equivalent to
+ * {@code newSingletonProxy(ManagementFactory.getPlatformMBeanServer())}.
+ * @return a new {@code ScanManagerMXBean} proxy.
+ **/
+ public static ScanManagerMXBean newSingletonProxy() {
+ return newSingletonProxy(ManagementFactory.getPlatformMBeanServer());
+ }
+
+ /**
+ * Create and register a new singleton instance of the ScanManager
+ * MBean in the given {@link MBeanServerConnection}.
+ * @throws JMException The MBeanServer connection raised an exception
+ * while trying to instantiate and register the singleton MBean
+ * instance.
+ * @throws IOException There was a connection problem while trying to
+ * communicate with the underlying MBeanServer.
+ * @return A proxy for the registered MBean.
+ **/
+ public static ScanManagerMXBean register()
+ throws IOException, JMException {
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ return register(mbs);
+ }
+
+ /**
+ * Create a new ScanManager MBean
+ **/
+ public ScanManager() {
+ broadcaster = new NotificationBroadcasterSupport();
+ pendingNotifs = new LinkedBlockingQueue<Notification>(100);
+ scanmap = newConcurrentHashMap();
+ configmap = newConcurrentHashMap();
+ log = new ResultLogManager();
+ }
+
+
+ // Creates a new DirectoryScannerMXBean, from the given configuration data.
+ DirectoryScannerMXBean createDirectoryScanner(DirectoryScannerConfig config) {
+ return new DirectoryScanner(config,log);
+ }
+
+ // Applies a configuration.
+ // throws IllegalStateException if lock can't be acquired.
+ // Unregisters all existing directory scanners, the create and registers
+ // new directory scanners according to the given config.
+ // Then pushes the log config to the result log manager.
+ //
+ private void applyConfiguration(ScanManagerConfig bean)
+ throws IOException, JMException {
+ if (bean == null) return;
+ if (!sequencer.tryAcquire()) {
+ throw new IllegalStateException("Can't acquire lock");
+ }
+ try {
+ unregisterScanners();
+ final DirectoryScannerConfig[] scans = bean.getScanList();
+ if (scans == null) return;
+ for (DirectoryScannerConfig scan : scans) {
+ addDirectoryScanner(scan);
+ }
+ log.setConfig(bean.getInitialResultLogConfig());
+ } finally {
+ sequencer.release();
+ }
+ }
+
+ // See ScanManagerMXBean
+ public void applyConfiguration(boolean fromMemory)
+ throws IOException, JMException {
+ if (fromMemory == false) config.load();
+ applyConfiguration(config.getConfiguration());
+ }
+
+ // See ScanManagerMXBean
+ public void applyCurrentResultLogConfig(boolean toMemory)
+ throws IOException, JMException {
+ final ScanManagerConfig bean = config.getConfiguration();
+ bean.setInitialResultLogConfig(log.getConfig());
+ config.setConfiguration(bean);
+ if (toMemory==false) config.save();
+ }
+
+ // See ScanManagerMXBean
+ public void setConfigurationMBean(ScanDirConfigMXBean config) {
+ this.config = config;
+ }
+
+ // See ScanManagerMXBean
+ public ScanDirConfigMXBean getConfigurationMBean() {
+ return config;
+ }
+
+ // Creates and registers a new directory scanner.
+ // Called by applyConfiguration.
+ // throws IllegalStateException if state is not STOPPED or COMPLETED
+ // (you cannot change the config while scanning is scheduled or running).
+ //
+ private DirectoryScannerMXBean addDirectoryScanner(
+ DirectoryScannerConfig bean)
+ throws JMException {
+ try {
+ final DirectoryScannerMXBean scanner;
+ final ObjectName scanName;
+ synchronized (this) {
+ if (state != STOPPED && state != COMPLETED)
+ throw new IllegalStateException(state.toString());
+ scanner = createDirectoryScanner(bean);
+ scanName = makeDirectoryScannerName(bean.getName());
+ }
+ LOG.fine("server: "+mbeanServer);
+ LOG.fine("scanner: "+scanner);
+ LOG.fine("scanName: "+scanName);
+ final ObjectInstance moi =
+ mbeanServer.registerMBean(scanner,scanName);
+ final ObjectName moiName = moi.getObjectName();
+ final DirectoryScannerMXBean proxy =
+ JMX.newMXBeanProxy(mbeanServer,moiName,
+ DirectoryScannerMXBean.class,true);
+ scanmap.put(moiName,proxy);
+ return proxy;
+ } catch (RuntimeException x) {
+ final String msg = "Operation failed: "+x;
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,msg,x);
+ else LOG.fine(msg);
+ throw x;
+ } catch (JMException x) {
+ final String msg = "Operation failed: "+x;
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,msg,x);
+ else LOG.fine(msg);
+ throw x;
+ }
+ }
+
+ // See ScanManagerMXBean
+ public ScanDirConfigMXBean createOtherConfigurationMBean(String name,
+ String filename)
+ throws JMException {
+ final ScanDirConfig profile = new ScanDirConfig(filename);
+ final ObjectName profName = makeScanDirConfigName(name);
+ final ObjectInstance moi = mbeanServer.registerMBean(profile,profName);
+ final ScanDirConfigMXBean proxy =
+ JMX.newMXBeanProxy(mbeanServer,profName,
+ ScanDirConfigMXBean.class,true);
+ configmap.put(moi.getObjectName(),proxy);
+ return proxy;
+ }
+
+
+ // See ScanManagerMXBean
+ public Map<String,DirectoryScannerMXBean> getDirectoryScanners() {
+ final Map<String,DirectoryScannerMXBean> proxyMap = newHashMap();
+ for (Entry<ObjectName,DirectoryScannerMXBean> item : scanmap.entrySet()){
+ proxyMap.put(item.getKey().getKeyProperty("name"),item.getValue());
+ }
+ return proxyMap;
+ }
+
+ // ---------------------------------------------------------------
+ // State Management
+ // ---------------------------------------------------------------
+
+ /**
+ * For each operation, this map stores a list of states from
+ * which the corresponding operation can be legally called.
+ * For instance, it is legal to call "stop" regardless of the
+ * application state. However, "schedule" can be called only if
+ * the application state is STOPPED, etc...
+ **/
+ private final static Map<String,EnumSet<ScanState>> allowedStates;
+ static {
+ allowedStates = newHashMap();
+ // You can always call stop
+ allowedStates.put("stop",EnumSet.allOf(ScanState.class));
+
+ // You can only call closed when stopped
+ allowedStates.put("close",EnumSet.of(STOPPED,COMPLETED,CLOSED));
+
+ // You can call schedule only when the current task is
+ // completed or stopped.
+ allowedStates.put("schedule",EnumSet.of(STOPPED,COMPLETED));
+
+ // switch reserved for background task: goes from SCHEDULED to
+ // RUNNING when it enters the run() method.
+ allowedStates.put("scan-running",EnumSet.of(SCHEDULED));
+
+ // switch reserved for background task: goes from RUNNING to
+ // SCHEDULED when it has completed but needs to reschedule
+ // itself for specified interval.
+ allowedStates.put("scan-scheduled",EnumSet.of(RUNNING));
+
+ // switch reserved for background task:
+ // goes from RUNNING to COMPLETED upon successful completion
+ allowedStates.put("scan-done",EnumSet.of(RUNNING));
+ }
+
+ // Get this object's state. No need to synchronize because
+ // state is volatile.
+ // See ScanManagerMXBean
+ public ScanState getState() {
+ return state;
+ }
+
+ /**
+ * Enqueue a state changed notification for the given states.
+ **/
+ private void queueStateChangedNotification(
+ long sequence,
+ long time,
+ ScanState old,
+ ScanState current) {
+ final AttributeChangeNotification n =
+ new AttributeChangeNotification(SCAN_MANAGER_NAME,sequence,time,
+ "ScanManager State changed to "+current,"State",
+ ScanState.class.getName(),old.toString(),current.toString());
+ // Queue the notification. We have created an unlimited queue, so
+ // this method should always succeed.
+ try {
+ if (!pendingNotifs.offer(n,2,TimeUnit.SECONDS)) {
+ LOG.fine("Can't queue Notification: "+n);
+ }
+ } catch (InterruptedException x) {
+ LOG.fine("Can't queue Notification: "+x);
+ }
+ }
+
+ /**
+ * Send all notifications present in the queue.
+ **/
+ private void sendQueuedNotifications() {
+ Notification n;
+ while ((n = pendingNotifs.poll()) != null) {
+ broadcaster.sendNotification(n);
+ }
+ }
+
+ /**
+ * Checks that the current state is allowed for the given operation,
+ * and if so, switch its value to the new desired state.
+ * This operation also enqueue the appropriate state changed
+ * notification.
+ **/
+ private ScanState switchState(ScanState desired,String forOperation) {
+ return switchState(desired,allowedStates.get(forOperation));
+ }
+
+ /**
+ * Checks that the current state is one of the allowed states,
+ * and if so, switch its value to the new desired state.
+ * This operation also enqueue the appropriate state changed
+ * notification.
+ **/
+ private ScanState switchState(ScanState desired,EnumSet<ScanState> allowed) {
+ final ScanState old;
+ final long timestamp;
+ final long sequence;
+ synchronized(this) {
+ old = state;
+ if (!allowed.contains(state))
+ throw new IllegalStateException(state.toString());
+ state = desired;
+ timestamp = System.currentTimeMillis();
+ sequence = getNextSeqNumber();
+ }
+ LOG.fine("switched state: "+old+" -> "+desired);
+ if (old != desired)
+ queueStateChangedNotification(sequence,timestamp,old,desired);
+ return old;
+ }
+
+
+ // ---------------------------------------------------------------
+ // schedule() creates a new SessionTask that will be executed later
+ // (possibly right away if delay=0) by a Timer thread.
+ // ---------------------------------------------------------------
+
+ // The timer used by this object. Lazzy evaluation. Cleaned in
+ // postDeregister()
+ //
+ private Timer timer = null;
+
+ // See ScanManagerMXBean
+ public void schedule(long delay, long interval) {
+ if (!sequencer.tryAcquire()) {
+ throw new IllegalStateException("Can't acquire lock");
+ }
+ try {
+ LOG.fine("scheduling new task: state="+state);
+ final ScanState old = switchState(SCHEDULED,"schedule");
+ final boolean scheduled =
+ scheduleSession(new SessionTask(interval),delay);
+ if (scheduled)
+ LOG.fine("new task scheduled: state="+state);
+ } finally {
+ sequencer.release();
+ }
+ sendQueuedNotifications();
+ }
+
+ // Schedule a SessionTask. The session task may reschedule
+ // a new identical task when it eventually ends.
+ // We use this logic so that the 'interval' time is measured
+ // starting at the end of the task that finishes, rather than
+ // at its beginning. Therefore if a repeated task takes x ms,
+ // it will be repeated every x+interval ms.
+ //
+ private synchronized boolean scheduleSession(SessionTask task, long delay) {
+ if (state == STOPPED) return false;
+ if (timer == null) timer = new Timer("ScanManager");
+ tasklist.add(task);
+ timer.schedule(task,delay);
+ return true;
+ }
+
+ // ---------------------------------------------------------------
+ // start() is equivalent to schedule(0,0)
+ // ---------------------------------------------------------------
+
+ // See ScanManagerMXBean
+ public void start() throws IOException, InstanceNotFoundException {
+ schedule(0,0);
+ }
+
+ // ---------------------------------------------------------------
+ // Methods used to implement stop() - stop() is asynchronous,
+ // and needs to notify any running background task that it needs
+ // to stop. It also needs to prevent scheduled task from being
+ // run.
+ // ---------------------------------------------------------------
+
+ // See ScanManagerMXBean
+ public void stop() {
+ if (!sequencer.tryAcquire())
+ throw new IllegalStateException("Can't acquire lock");
+ int errcount = 0;
+ final StringBuilder b = new StringBuilder();
+
+ try {
+ switchState(STOPPED,"stop");
+
+ errcount += cancelSessionTasks(b);
+ errcount += stopDirectoryScanners(b);
+ } finally {
+ sequencer.release();
+ }
+
+ sendQueuedNotifications();
+ if (errcount > 0) {
+ b.insert(0,"stop partially failed with "+errcount+" error(s):");
+ throw new RuntimeException(b.toString());
+ }
+ }
+
+ // See ScanManagerMXBean
+ public void close() {
+ switchState(CLOSED,"close");
+ sendQueuedNotifications();
+ }
+
+ // Appends exception to a StringBuilder message.
+ //
+ private void append(StringBuilder b,String prefix,Throwable t) {
+ final String first = (prefix==null)?"\n":"\n"+prefix;
+ b.append(first).append(String.valueOf(t));
+ Throwable cause = t;
+ while ((cause = cause.getCause())!=null) {
+ b.append(first).append("Caused by:").append(first);
+ b.append('\t').append(String.valueOf(cause));
+ }
+ }
+
+ // Cancels all scheduled session tasks
+ //
+ private int cancelSessionTasks(StringBuilder b) {
+ int errcount = 0;
+ // Stops scheduled tasks if any...
+ //
+ for (SessionTask task : tasklist) {
+ try {
+ task.cancel();
+ tasklist.remove(task);
+ } catch (Exception ex) {
+ errcount++;
+ append(b,"\t",ex);
+ }
+ }
+ return errcount;
+ }
+
+ // Stops all DirectoryScanners configured for this object.
+ //
+ private int stopDirectoryScanners(StringBuilder b) {
+ int errcount = 0;
+ // Stops directory scanners if any...
+ //
+ for (DirectoryScannerMXBean s : scanmap.values()) {
+ try {
+ s.stop();
+ } catch (Exception ex) {
+ errcount++;
+ append(b,"\t",ex);
+ }
+ }
+ return errcount;
+ }
+
+
+ // ---------------------------------------------------------------
+ // We start scanning in background in a Timer thread.
+ // The methods below implement that logic.
+ // ---------------------------------------------------------------
+
+ private void scanAllDirectories()
+ throws IOException, InstanceNotFoundException {
+
+ int errcount = 0;
+ final StringBuilder b = new StringBuilder();
+ for (ObjectName key : scanmap.keySet()) {
+ final DirectoryScannerMXBean s = scanmap.get(key);
+ try {
+ if (state == STOPPED) return;
+ s.scan();
+ } catch (Exception ex) {
+ LOG.log(Level.FINE,key + " failed to scan: "+ex,ex);
+ errcount++;
+ append(b,"\t",ex);
+ }
+ }
+ if (errcount > 0) {
+ b.insert(0,"scan partially performed with "+errcount+" error(s):");
+ throw new RuntimeException(b.toString());
+ }
+ }
+
+ // List of scheduled session task. Needed by stop() to cancel
+ // scheduled sessions. There's usually at most 1 session in
+ // this list (unless there's a bug somewhere ;-))
+ //
+ private final ConcurrentLinkedQueue<SessionTask> tasklist =
+ new ConcurrentLinkedQueue<SessionTask>();
+
+ // Used to give a unique id to session task - useful for
+ // debugging.
+ //
+ private volatile static long taskcount = 0;
+
+ /**
+ * A session task will be scheduled to run in background in a
+ * timer thread. There can be at most one session task running
+ * at a given time (this is ensured by using a timer - which is
+ * a single threaded object).
+ *
+ * If the session needs to be repeated, it will reschedule an
+ * identical session when it finishes to run. This ensure that
+ * two session runs are separated by the given interval time.
+ *
+ **/
+ private class SessionTask extends TimerTask {
+
+ /**
+ * Delay after which the next iteration of this task will
+ * start. This delay is measured starting at the end of
+ * the previous iteration.
+ **/
+ final long delayBeforeNext;
+
+ /**
+ * A unique id for this task.
+ **/
+ final long taskid;
+
+ /**
+ * Whether it's been cancelled by stop()
+ **/
+ volatile boolean cancelled=false;
+
+ /**
+ * create a new SessionTask.
+ **/
+ SessionTask(long scheduleNext) {
+ delayBeforeNext = scheduleNext;
+ taskid = taskcount++;
+ }
+
+ /**
+ * When run() begins, the state is switched to RUNNING.
+ * When run() ends then:
+ * If the task is repeated, the state will be switched
+ * to SCHEDULED (because a new task was scheduled).
+ * Otherwise the state will be switched to either
+ * STOPPED (if it was stopped before it could complete)
+ * or COMPLETED (if it completed gracefully)
+ * This method is used to switch to the desired state and
+ * send the appropriate notifications.
+ * When entering the method, we check whether the state is
+ * STOPPED. If so, we return false - and the SessionTask will
+ * stop. Otherwise, we switch the state to the desired value.
+ **/
+ private boolean notifyStateChange(ScanState newState,String condition) {
+ synchronized (ScanManager.this) {
+ if (state == STOPPED || state == CLOSED) return false;
+ switchState(newState,condition);
+ }
+ sendQueuedNotifications();
+ return true;
+ }
+
+ // Cancels this task.
+ public boolean cancel() {
+ cancelled=true;
+ return super.cancel();
+ }
+
+ /**
+ * Invoke all directories scanners in sequence. At each
+ * step, checks to see whether the task should stop.
+ **/
+ private boolean execute() {
+ final String tag = "Scheduled session["+taskid+"]";
+ try {
+ if (cancelled) {
+ LOG.finer(tag+" cancelled: done");
+ return false;
+ }
+ if (!notifyStateChange(RUNNING,"scan-running")) {
+ LOG.finer(tag+" stopped: done");
+ return false;
+ }
+ scanAllDirectories();
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST)) {
+ LOG.log(Level.FINEST,
+ tag+" failed to scan: "+x,x);
+ } else if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine(tag+" failed to scan: "+x);
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Schedule an identical task for next iteration.
+ **/
+ private boolean scheduleNext() {
+ final String tag = "Scheduled session["+taskid+"]";
+
+ // We need now to reschedule a new task for after 'delayBeforeNext' ms.
+ try {
+ LOG.finer(tag+": scheduling next session for "+ delayBeforeNext + "ms");
+ if (cancelled || !notifyStateChange(SCHEDULED,"scan-scheduled")) {
+ LOG.finer(tag+" stopped: do not reschedule");
+ return false;
+ }
+ final SessionTask nextTask = new SessionTask(delayBeforeNext);
+ if (!scheduleSession(nextTask,delayBeforeNext)) return false;
+ LOG.finer(tag+": next session successfully scheduled");
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST)) {
+ LOG.log(Level.FINEST,tag+
+ " failed to schedule next session: "+x,x);
+ } else if (LOG.isLoggable(Level.FINE)) {
+ LOG.fine(tag+" failed to schedule next session: "+x);
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * The run method:
+ * executes scanning logic, the schedule next iteration if needed.
+ **/
+ public void run() {
+ final String tag = "Scheduled session["+taskid+"]";
+ LOG.entering(SessionTask.class.getName(),"run");
+ LOG.finer(tag+" starting...");
+ try {
+ if (execute()==false) return;
+
+ LOG.finer(tag+" terminating - state is "+state+
+ ((delayBeforeNext >0)?(" next session is due in "+delayBeforeNext+" ms."):
+ " no additional session scheduled"));
+
+ // if delayBeforeNext <= 0 we are done, either because the session was
+ // stopped or because it successfully completed.
+ if (delayBeforeNext <= 0) {
+ if (!notifyStateChange(COMPLETED,"scan-done"))
+ LOG.finer(tag+" stopped: done");
+ else
+ LOG.finer(tag+" completed: done");
+ return;
+ }
+
+ // we need to reschedule a new session for 'delayBeforeNext' ms.
+ scheduleNext();
+
+ } finally {
+ tasklist.remove(this);
+ LOG.finer(tag+" finished...");
+ LOG.exiting(SessionTask.class.getName(),"run");
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // ---------------------------------------------------------------
+
+ // ---------------------------------------------------------------
+ // MBean Notification support
+ // The methods below are imported from {@link NotificationEmitter}
+ // ---------------------------------------------------------------
+
+ /**
+ * Delegates the implementation of this method to the wrapped
+ * {@code NotificationBroadcasterSupport} object.
+ **/
+ public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException {
+ broadcaster.addNotificationListener(listener, filter, handback);
+ }
+
+
+ /**
+ * We emit an {@code AttributeChangeNotification} when the {@code State}
+ * attribute changes.
+ **/
+ public MBeanNotificationInfo[] getNotificationInfo() {
+ return new MBeanNotificationInfo[] {
+ new MBeanNotificationInfo(new String[] {
+ AttributeChangeNotification.ATTRIBUTE_CHANGE},
+ AttributeChangeNotification.class.getName(),
+ "Emitted when the State attribute changes")
+ };
+ }
+
+ /**
+ * Delegates the implementation of this method to the wrapped
+ * {@code NotificationBroadcasterSupport} object.
+ **/
+ public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener);
+ }
+
+ /**
+ * Delegates the implementation of this method to the wrapped
+ * {@code NotificationBroadcasterSupport} object.
+ **/
+ public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException {
+ broadcaster.removeNotificationListener(listener, filter, handback);
+ }
+
+ /**
+ * Returns and increment the sequence number used for
+ * notifications. We use the same sequence number throughout the
+ * application - this is why this method is only package protected.
+ * @return A unique sequence number for the next notification.
+ */
+ static synchronized long getNextSeqNumber() {
+ return seqNumber++;
+ }
+
+ // ---------------------------------------------------------------
+ // End of MBean Notification support
+ // ---------------------------------------------------------------
+
+ // ---------------------------------------------------------------
+ // MBeanRegistration support
+ // The methods below are imported from {@link MBeanRegistration}
+ // ---------------------------------------------------------------
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * registered in the MBean server. If the name of the MBean is not
+ * specified, the MBean can provide a name for its registration. If
+ * any exception is raised, the MBean will not be registered in the
+ * MBean server.
+ * <p>In this implementation, we check that the provided name is
+ * either {@code null} or equals to {@link #SCAN_MANAGER_NAME}. If it
+ * isn't then we throw an IllegalArgumentException, otherwise we return
+ * {@link #SCAN_MANAGER_NAME}.</p>
+ * <p>This ensures that there will be a single instance of ScanManager
+ * registered in a given MBeanServer, and that it will always be
+ * registered with the singleton's {@link #SCAN_MANAGER_NAME}.</p>
+ * <p>We do not need to check whether an MBean by that name is
+ * already registered because the MBeanServer will perform
+ * this check just after having called preRegister().</p>
+ * @param server The MBean server in which the MBean will be registered.
+ * @param name The object name of the MBean. This name is null if the
+ * name parameter to one of the createMBean or registerMBean methods in
+ * the MBeanServer interface is null. In that case, this method must
+ * return a non-null ObjectName for the new MBean.
+ * @return The name under which the MBean is to be registered. This value
+ * must not be null. If the name parameter is not null, it will usually
+ * but not necessarily be the returned value.
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
+ if (name != null) {
+ if (!SCAN_MANAGER_NAME.equals(name))
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+ mbeanServer = server;
+ return SCAN_MANAGER_NAME;
+ }
+
+ // Returns the default configuration filename
+ static String getDefaultConfigurationFileName() {
+ // This is a file calles 'jmx-scandir.xml' located
+ // in the user directory.
+ final String user = System.getProperty("user.home");
+ final String defconf = user+File.separator+"jmx-scandir.xml";
+ return defconf;
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having
+ * been registered in the MBean server or after the registration has
+ * failed.
+ * <p>
+ * If registration was not successful, the method returns immediately.
+ * <p>
+ * If registration is successful, register the {@link ResultLogManager}
+ * and default {@link ScanDirConfigMXBean}. If registering these
+ * MBean fails, the {@code ScanManager} state will be switched to
+ * {@link #close CLOSED}, and postRegister ends there.
+ * </p>
+ * <p>Otherwise the {@code ScanManager} will ask the
+ * {@link ScanDirConfigMXBean} to load its configuration.
+ * If it succeeds, the configuration will be {@link
+ * #applyConfiguration applied}. Otherwise, the method simply returns,
+ * assuming that the user will later create/update a configuration and
+ * apply it.
+ * @param registrationDone Indicates whether or not the MBean has been
+ * successfully registered in the MBean server. The value false means
+ * that the registration has failed.
+ */
+ public void postRegister(Boolean registrationDone) {
+ if (!registrationDone) return;
+ Exception test=null;
+ try {
+ mbeanServer.registerMBean(log,
+ ResultLogManager.RESULT_LOG_MANAGER_NAME);
+ final String defconf = getDefaultConfigurationFileName();
+ final String conf = System.getProperty("scandir.config.file",defconf);
+ final String confname = ScanDirConfig.guessConfigName(conf,defconf);
+ final ObjectName defaultProfileName =
+ makeMBeanName(ScanDirConfigMXBean.class,confname);
+ if (!mbeanServer.isRegistered(defaultProfileName))
+ mbeanServer.registerMBean(new ScanDirConfig(conf),
+ defaultProfileName);
+ config = JMX.newMXBeanProxy(mbeanServer,defaultProfileName,
+ ScanDirConfigMXBean.class,true);
+ configmap.put(defaultProfileName,config);
+ } catch (Exception x) {
+ LOG.config("Failed to populate MBeanServer: "+x);
+ close();
+ return;
+ }
+ try {
+ config.load();
+ } catch (Exception x) {
+ LOG.finest("No config to load: "+x);
+ test = x;
+ }
+ if (test == null) {
+ try {
+ applyConfiguration(config.getConfiguration());
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,"Failed to apply config: "+x,x);
+ LOG.config("Failed to apply config: "+x);
+ }
+ }
+ }
+
+ // Unregisters all created DirectoryScanners
+ private void unregisterScanners() throws JMException {
+ unregisterMBeans(scanmap);
+ }
+
+ // Unregisters all created ScanDirConfigs
+ private void unregisterConfigs() throws JMException {
+ unregisterMBeans(configmap);
+ }
+
+ // Unregisters all MBeans named by the given map
+ private void unregisterMBeans(Map<ObjectName,?> map) throws JMException {
+ for (ObjectName key : map.keySet()) {
+ if (mbeanServer.isRegistered(key))
+ mbeanServer.unregisterMBean(key);
+ map.remove(key);
+ }
+ }
+
+ // Unregisters the ResultLogManager.
+ private void unregisterResultLogManager() throws JMException {
+ final ObjectName name = ResultLogManager.RESULT_LOG_MANAGER_NAME;
+ if (mbeanServer.isRegistered(name)) {
+ mbeanServer.unregisterMBean(name);
+ }
+ }
+
+ /**
+ * Allows the MBean to perform any operations it needs before being
+ * unregistered by the MBean server.
+ * This implementation also unregisters all the MXBeans
+ * that were created by this object.
+ * @throws IllegalStateException if the lock can't be acquire, or if
+ * the MBean's state doesn't allow the MBean to be unregistered
+ * (e.g. because it's scheduled or running).
+ * @throws Exception This exception will be caught by the MBean server and
+ * re-thrown as an MBeanRegistrationException.
+ */
+ public void preDeregister() throws Exception {
+ try {
+ close();
+ if (!sequencer.tryAcquire())
+ throw new IllegalStateException("can't acquire lock");
+ try {
+ unregisterScanners();
+ unregisterConfigs();
+ unregisterResultLogManager();
+ } finally {
+ sequencer.release();
+ }
+ } catch (Exception x) {
+ LOG.log(Level.FINEST,"Failed to unregister: "+x,x);
+ throw x;
+ }
+ }
+
+ /**
+ * Allows the MBean to perform any operations needed after having been
+ * unregistered in the MBean server.
+ * Cancels the internal timer - if any.
+ */
+ public synchronized void postDeregister() {
+ if (timer != null) {
+ try {
+ timer.cancel();
+ } catch (Exception x) {
+ if (LOG.isLoggable(Level.FINEST))
+ LOG.log(Level.FINEST,"Failed to cancel timer",x);
+ else if (LOG.isLoggable(Level.FINE))
+ LOG.fine("Failed to cancel timer: "+x);
+ } finally {
+ timer = null;
+ }
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // End of MBeanRegistration support
+ // ---------------------------------------------------------------
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java
new file mode 100644
index 0000000..1f6d4ff
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/ScanManagerMXBean.java
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.io.IOException;
+import java.util.Map;
+import javax.management.InstanceNotFoundException;
+import javax.management.JMException;
+
+/**
+ * The <code>ScanManagerMXBean</code> is responsible for applying a
+ * configuration, starting and scheduling directory scans, and reporting
+ * application state.
+ * <p>
+ * The <code>ScanManagerMXBean</code> is a singleton MBean: there can be
+ * at most one instance of such an MBean registered in a given MBeanServer.
+ * The name of that MBean is a constant defined in
+ * {@link ScanManager#SCAN_MANAGER_NAME ScanManager.SCAN_MANAGER_NAME}.
+ * </p>
+ * <p>
+ * The <code>ScanManagerMXBean</code> is the entry point of the <i>scandir</i>
+ * application management interface. It is from this MBean that all other
+ * MBeans will be created and registered.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+public interface ScanManagerMXBean {
+ /**
+ * This state tells whether directory scans are running, scheduled,
+ * successfully completed, or stopped.
+ * <p>
+ * The {@link #CLOSED} state means
+ * that the {@link ScanManagerMXBean} was closed and is no longer usable.
+ * This state is used when the {@link ScanManagerMXBean} needs to be
+ * unregistered.
+ * </p>
+ **/
+ public enum ScanState {
+ /**
+ * Scanning of directories is in process.
+ **/
+ RUNNING,
+
+ /**
+ * Scanning of directories is not in process, but is scheduled
+ * for a later date.
+ **/
+ SCHEDULED,
+
+ /**
+ * Scanning is successfully completed.
+ **/
+ COMPLETED,
+
+ /**
+ * Scanning is stopped. No scanning is scheduled.
+ **/
+ STOPPED,
+
+ /**
+ * close() was called.
+ **/
+ CLOSED
+
+ }
+
+ /**
+ * Returns the current state of the application.
+ * @return the current state of the application.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanState getState()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Schedule a scan session for a later date.
+ * <p>
+ * A scan session is a background task that will sequentially call {@link
+ * DirectoryScannerMXBean#scan scan()} on every {@link
+ * DirectoryScannerMXBean} configured for this MBean.
+ * </p>
+ * @see #getDirectoryScanners
+ * @param delay The first scan session will be started after
+ * the given delay. 0 means start now.
+ * @param interval Scan session will be rescheduled periodically
+ * at the specified interval. The interval starts at the
+ * the end of the scan session: if a scan session takes
+ * on average x milliseconds to complete, then a scan session will
+ * be started on average every x+interval milliseconds.
+ * if (interval == 0) then scan session will not be
+ * rescheduled, and will run only once.
+ * @throws IllegalStateException if a scan session is already
+ * running or scheduled, or the MBean is closed.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void schedule(long delay, long interval)
+ throws IOException, InstanceNotFoundException;
+
+
+ /**
+ * Stops current running or scheduled scan sessions if any.
+ * <p>
+ * A scan session is a background task that will sequentially call {@link
+ * DirectoryScannerMXBean#scan scan()} on every {@link
+ * DirectoryScannerMXBean} configured for this MBean.
+ * </p>
+ * <p>
+ * Scan sessions are started/scheduled by calls to {@link #start start} or
+ * {@link #schedule schedule}.
+ * </p>
+ * After this method completes the state of the application will
+ * be {@link ScanState#STOPPED}.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void stop()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Switches the state to CLOSED.
+ * When closed, this MBean cannot be used any more.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void close()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Starts a scan session immediately.
+ * This is equivalent to {@link #schedule(long,long) schedule(0,0)}.
+ * @throws IllegalStateException if a scan session is already
+ * running or scheduled, or the MBean is closed.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public void start()
+ throws IOException, InstanceNotFoundException;
+
+ /**
+ * Gets the list of directory scanners configured for this MBean.
+ * @return A {@code Map<String,DirectoryScannerMXBean>} where the
+ * key in the map is the value of the <code>name=</code> key
+ * of the {@link DirectoryScannerMXBean} ObjectName.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ **/
+ public Map<String,DirectoryScannerMXBean> getDirectoryScanners()
+ throws IOException, JMException;
+
+ /**
+ * Apply the configuration handled by the {@link
+ * #getConfigurationMBean configuration MBean}.
+ * <p>
+ * When the configuration is applied, all the {@link DirectoryScannerMXBean}
+ * created by this MBean will be unregistered, and new {@link
+ * DirectoryScannerMXBean} will be created and registered from the
+ * new {@link ScanDirConfigMXBean#getConfiguration configuration data}.
+ * </p>
+ * <p>
+ * The initial result log configuration held by the {@link
+ * #getConfigurationMBean configuration MBean} will also be pushed to the
+ * {@link ResultLogManagerMXBean}. If you don't want to lose your current
+ * {@link ResultLogManagerMXBean} configuration, you should therefore call
+ * {@link #applyCurrentResultLogConfig
+ * applyCurrentResultLogConfig} before calling
+ * {@link #applyConfiguration applyConfiguration}
+ * </p>
+ * @param fromMemory if {@code true}, the configuration will be applied
+ * from memory. if {@code false}, the {@code ScanManagerMXBean} will
+ * ask the {@link
+ * #getConfigurationMBean configuration MBean} to {@link
+ * ScanDirConfigMXBean#load reload its configuration} before applying
+ * it.
+ * @throws IllegalStateException if a scan session is
+ * running or scheduled, or the MBean is closed.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ **/
+ public void applyConfiguration(boolean fromMemory)
+ throws IOException, JMException;
+ /**
+ * Replaces the {@link
+ * #getConfigurationMBean configuration MBean}'s {@link
+ * com.sun.jmx.examples.scandir.config.ScanManagerConfig#getInitialResultLogConfig
+ * initial result log configuration} with the current {@link
+ * ResultLogManagerMXBean}
+ * configuration. This prevents the <code>ResultLogManagerMXBean</code>
+ * current configuration from being reset when {@link #applyConfiguration
+ * applyConfiguration} is called.
+ * @param toMemory if {@code true} only replaces the initial result log
+ * configuration held in memory.
+ * if {@code false}, the {@link
+ * #getConfigurationMBean configuration MBean} will be asked to commit
+ * the whole configuration to the configuration file.
+ *
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ **/
+ public void applyCurrentResultLogConfig(boolean toMemory)
+ throws IOException, JMException;
+
+ /**
+ * Instruct the {@code ScanManagerMXBean} to use another {@link
+ * ScanDirConfigMXBean configuration MBean}.
+ * <p>This method doesn't {@link #applyConfiguration apply} the new
+ * configuration. If you want to apply the new configuration, you should
+ * additionally call {@link #applyConfiguration
+ * applyConfiguration(true|false)}. Note that you cannot apply a
+ * configuration as long as a scan session is scheduled or running.
+ * In that case you will need to wait for that session to complete
+ * or call {@link #stop} to stop it.
+ * </p>
+ * @param config A proxy to the {@link ScanDirConfigMXBean} that holds
+ * the new configuration for the application.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ */
+ public void setConfigurationMBean(ScanDirConfigMXBean config)
+ throws IOException, InstanceNotFoundException;
+ /**
+ * Gets the current configuration MBean.
+ * @return A proxy to the current configuration MBean.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws InstanceNotFoundException The underlying MBean is not
+ * registered in the MBeanServer.
+ **/
+ public ScanDirConfigMXBean getConfigurationMBean()
+ throws IOException, InstanceNotFoundException;
+ /**
+ * This method creates a new alternate {@link ScanDirConfigMXBean}.
+ *
+ * <p>You will need to call {@link #setConfigurationMBean
+ * setConfigurationMBean} if you
+ * want this new {@link ScanDirConfigMXBean} to become the
+ * current configuration MBean.
+ * </p>
+ * <p>
+ * This new {@link ScanDirConfigMXBean} will be unregistered automatically
+ * by the {@code ScanManagerMXBean} when the {@code ScanManagerMXBean}
+ * is unregistered.
+ * </p>
+ * @param name The short name for the new {@link ScanDirConfigMXBean}.
+ * This name will be used in the ObjectName <code>name=</code> key
+ * of the new {@link ScanDirConfigMXBean}.
+ * @param filename The path of the file from which the new {@link
+ * ScanDirConfigMXBean} can {@link ScanDirConfigMXBean#load load} or
+ * {@link ScanDirConfigMXBean#save save} its configuration data.
+ * Note that even if the file exists and contain a valid
+ * configuration, you will still need to call {@link
+ * ScanDirConfigMXBean#load load} to make the {@link
+ * ScanDirConfigMXBean} load its configuration data.
+ * @throws IOException A connection problem occurred when accessing
+ * the underlying resource.
+ * @throws JMException The MBeanServer failed to call the underlying MBean.
+ * @return A proxy to the created {@link ScanDirConfigMXBean}.
+ */
+ public ScanDirConfigMXBean createOtherConfigurationMBean(String name,
+ String filename)
+ throws JMException, IOException;
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java
new file mode 100644
index 0000000..b3f8e9f
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/DirectoryScannerConfig.java
@@ -0,0 +1,392 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Logger;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * The <code>DirectoryScannerConfig</code> Java Bean is used to model
+ * the configuration of a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean}.
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="DirectoryScanner",
+ namespace=XmlConfigUtils.NAMESPACE)
+public class DirectoryScannerConfig {
+
+ //
+ // A logger for this class.
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(DirectoryScannerConfig.class.getName());
+
+ /**
+ * This enumeration is used to model the actions that a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean
+ * DirectoryScannerMXBean} should take when a file matches its set
+ * of matching criteria.
+ **/
+ public enum Action {
+ /**
+ * Indicates that the {@code DirectoryScannerMXBean} should
+ * emit a {@code Notification} when a matching file is found.
+ */
+ NOTIFY,
+ /**
+ * Indicates that the {@code DirectoryScannerMXBean} should
+ * delete the matching files.
+ */
+ DELETE,
+ /**
+ * Indicates that the {@code DirectoryScannerMXBean} should
+ * log the actions that were taken on the matching files.
+ */
+ LOGRESULT };
+
+ // A short name for the Directory Scanner
+ // This name is used for the value of the {@code name=} key in the
+ // {@code DirectoryScannerMXBean} ObjectName.
+ private String name;
+
+ // The root directory of the Directory Scanner
+ private String rootDirectory;
+
+ // List of filters identifying files that should be selected.
+ // A file is selected if at least one filter matches.
+ //
+ private final List<FileMatch> includeFiles =
+ new ArrayList<FileMatch>();
+
+ // List of filters identifying files that should be excluded.
+ // A file is excluded if at least one filter matches.
+ //
+ private final List<FileMatch> excludeFiles =
+ new ArrayList<FileMatch>();
+
+
+ // The actions that this Directory Scanner should carry out when a
+ // file is selected. Default is NOTIFY and LOGRESULT.
+ //
+ private Action[] actions = { Action.NOTIFY, Action.LOGRESULT };
+
+ /**
+ * Creates a new instance of {@code DirectoryScannerConfig}.
+ * We keep this empty constructor to make XML binding easier.
+ * You shouldn't use this constructor directly:
+ * use {@link #DirectoryScannerConfig(String)
+ * DirectoryScannerConfig(String name)} instead.
+ * @deprecated <p>Tagged deprecated so that a compiler warning is issued.
+ * Use {@link #DirectoryScannerConfig(String)
+ * DirectoryScannerConfig(String name)} instead.
+ * </p>
+ **/
+ public DirectoryScannerConfig() {
+ this(null);
+ }
+
+ /**
+ * Creates a new instance of {@code DirectoryScannerConfig}.
+ * @param name A short name for the Directory Scanner. This name is used for
+ * the value of the {@code name=} key in the
+ * {@code DirectoryScannerMXBean} ObjectName.
+ **/
+ public DirectoryScannerConfig(String name) {
+ this.name = name;
+ rootDirectory = null;
+ }
+
+ /**
+ * Gets the root directory configured for that Directory Scanner.
+ * @return the root directory at which the directory scanner should start
+ * scanning.
+ **/
+ @XmlElement(name="RootDirectory",namespace=XmlConfigUtils.NAMESPACE)
+ public String getRootDirectory() {
+ return rootDirectory;
+ }
+
+ /**
+ * Configures a root directory for that Directory Scanner.
+ * @param root The root directory at which the directory scanner should
+ * start scanning.
+ **/
+ public void setRootDirectory(String root) {
+ rootDirectory=root;
+ }
+
+
+ /**
+ * Gets the short name of this directory scanner.
+ *
+ * <p>
+ * This name is used for the value of the {@code name=} key in the
+ * {@code DirectoryScannerMXBean} ObjectName.
+ * </p>
+ *
+ * @return the short name of this directory scanner.
+ **/
+ @XmlAttribute(name="name",required=true)
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Setter for property {@link #getName() name}.
+ * Once set its value cannot change.
+ * @param name New value of property name.
+ * @throws IllegalArgumentException if {@code name} is already set to a
+ * different non null value.
+ */
+ public void setName(String name) {
+ if (this.name == null)
+ this.name = name;
+ else if (name == null)
+ throw new IllegalArgumentException("name=null");
+ else if (!name.equals(this.name))
+ throw new IllegalArgumentException("name="+name);
+ }
+
+ /**
+ * Getter for property includeFiles.
+ * This is an array of filters identifying files that should be selected.
+ * A file is selected if at least one filter matches.
+ * @return Value of property includeFiles.
+ */
+ @XmlElementWrapper(name="IncludeFiles",
+ namespace=XmlConfigUtils.NAMESPACE)
+ @XmlElementRef
+ public FileMatch[] getIncludeFiles() {
+ synchronized(includeFiles) {
+ return includeFiles.toArray(new FileMatch[0]);
+ }
+ }
+
+ /**
+ * Adds a filter to the includeFiles property.
+ * A file is selected if at least one filter matches.
+ * @param include A filter identifying files that should be selected.
+ */
+ public void addIncludeFiles(FileMatch include) {
+ if (include == null)
+ throw new IllegalArgumentException("null");
+ synchronized (includeFiles) {
+ includeFiles.add(include);
+ }
+ }
+
+ /**
+ * Setter for property includeFiles.
+ * @param includeFiles New value of property includeFiles.
+ * This is an array of filters identifying files
+ * that should be selected. A file is selected if at least
+ * one filter matches.
+ */
+ public void setIncludeFiles(FileMatch[] includeFiles) {
+ synchronized (this.includeFiles) {
+ this.includeFiles.clear();
+ if (includeFiles == null) return;
+ this.includeFiles.addAll(Arrays.asList(includeFiles));
+ }
+ }
+
+ /**
+ * Getter for property excludeFiles.
+ * This is an array of filters identifying files that should be excluded.
+ * A file is excluded if at least one filter matches.
+ * @return Value of property excludeFiles.
+ */
+ @XmlElementWrapper(name="ExcludeFiles",
+ namespace=XmlConfigUtils.NAMESPACE)
+ @XmlElementRef
+ public FileMatch[] getExcludeFiles() {
+ synchronized(excludeFiles) {
+ return excludeFiles.toArray(new FileMatch[0]);
+ }
+ }
+
+ /**
+ * Setter for property excludeFiles.
+ * @param excludeFiles New value of property excludeFiles.
+ * This is an array of filters identifying files
+ * that should be excluded. A file is excluded if at least
+ * one filter matches.
+ */
+ public void setExcludeFiles(FileMatch[] excludeFiles) {
+ synchronized (this.excludeFiles) {
+ this.excludeFiles.clear();
+ if (excludeFiles == null) return;
+ this.excludeFiles.addAll(Arrays.asList(excludeFiles));
+ }
+ }
+
+ /**
+ * Adds a filter to the excludeFiles property.
+ * A file is excluded if at least one filter matches.
+ * @param exclude A filter identifying files that should be excluded.
+ */
+ public void addExcludeFiles(FileMatch exclude) {
+ if (exclude == null)
+ throw new IllegalArgumentException("null");
+ synchronized (excludeFiles) {
+ this.excludeFiles.add(exclude);
+ }
+ }
+
+ /**
+ * Gets the list of actions that this Directory Scanner should carry
+ * out when a file is selected. Default is NOTIFY and LOGRESULT.
+
+ * @return The list of actions that this Directory Scanner should carry
+ * out when a file is selected.
+ */
+ @XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
+ @XmlList
+ public Action[] getActions() {
+ return (actions == null)?null:actions.clone();
+ }
+
+ /**
+ * Sets the list of actions that this Directory Scanner should carry
+ * out when a file is selected. Default is NOTIFY and LOGRESULT.
+
+ * @param actions The list of actions that this Directory Scanner should
+ * carry out when a file is selected.
+ */
+ public void setActions(Action[] actions) {
+ this.actions = (actions == null)?null:actions.clone();
+ }
+
+ /**
+ * Builds a {@code FileFilter} from the {@link #getIncludeFiles
+ * includeFiles} and {@link #getExcludeFiles excludeFiles} lists.
+ * A file will be accepted if it is selected by at least one of
+ * the filters in {@link #getIncludeFiles includeFiles}, and is
+ * not excluded by any of the filters in {@link
+ * #getExcludeFiles excludeFiles}. If there's no filter in
+ * {@link #getIncludeFiles includeFiles}, then a file is accepted
+ * simply if it is not excluded by any of the filters in {@link
+ * #getExcludeFiles excludeFiles}.
+ *
+ * @return A new {@code FileFilter} created from the current snapshot
+ * of the {@link #getIncludeFiles
+ * includeFiles} and {@link #getExcludeFiles excludeFiles} lists.
+ * Later modification of these lists will not affect the
+ * returned {@code FileFilter}.
+ **/
+ public FileFilter buildFileFilter() {
+ final FileFilter[] ins = getIncludeFiles();
+ final FileFilter[] outs = getExcludeFiles();
+ final FileFilter filter = new FileFilter() {
+ public boolean accept(File f) {
+ boolean result = false;
+ // If no include filter, all files are included.
+ if (ins != null) {
+ for (FileFilter in: ins) {
+ // if one filter accepts it, file is included
+ if (!in.accept(f)) continue;
+
+ // file is accepted, include it
+ result=true;
+ break;
+ }
+ } else result= true;
+ if (result == false) return false;
+
+ // The file is in the include list. Let's see if it's not
+ // in the exclude list...
+ //
+ if (outs != null) {
+ for (FileFilter out: outs) {
+ // if one filter accepts it, file is excluded
+ if (!out.accept(f)) continue;
+
+ // file is accepted, exclude it.
+ result=false;
+ break;
+ }
+ }
+ return result;
+ }
+ };
+ return filter;
+ }
+
+ // Used for equality - see equals().
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ name,rootDirectory,actions,excludeFiles,includeFiles
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof DirectoryScannerConfig)) return false;
+ final DirectoryScannerConfig other = (DirectoryScannerConfig)o;
+ final Object[] thisconfig = toArray();
+ final Object[] otherconfig = other.toArray();
+ return Arrays.deepEquals(thisconfig,otherconfig);
+ }
+
+ @Override
+ public int hashCode() {
+ final String key = name;
+ if (key == null) return 0;
+ else return key.hashCode();
+ }
+
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java
new file mode 100644
index 0000000..31f44ce
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/FileMatch.java
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.logging.Logger;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * The <code>FileMatch</code> Java Bean is used to model
+ * the configuration of a {@link FileFilter} which
+ * matches {@link File files} against a set of criteria.
+ * <p>
+ * The <code>FileMatch</code> class also implements
+ * {@link FileFilter} - applying an {@code AND} on all
+ * its conditions. {@code OR} conditions can be obtained
+ * by supplying several instances of <code>FileMatch</code>
+ * to the encapsulating {@link DirectoryScannerConfig}, which
+ * respectively applies an {@code OR} on all its
+ * {@code <FileFilter>} elements.
+ * </p>
+ *
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="FileFilter",
+ namespace=XmlConfigUtils.NAMESPACE)
+public class FileMatch implements FileFilter {
+
+ //
+ // A logger for this class.
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(FileMatch.class.getName());
+
+ /**
+ * A regular expression against which directory names should be matched.
+ */
+ private String directoryPattern;
+
+ /**
+ * A regular expression against which file names should be matched.
+ */
+ private String filePattern;
+
+ /**
+ * File whose size in bytes exceeds this limit will be selected.
+ */
+ private long sizeExceedsMaxBytes;
+
+ /**
+ * A file which will be selected only if it was last modified after
+ * this date
+ */
+ private Date lastModifiedAfter;
+
+ /**
+ * A file which will be selected only if it was last modified before
+ * this date
+ */
+ private Date lastModifiedBefore;
+
+ /**
+ * Creates a new instance of FileMatch
+ */
+ public FileMatch() {
+ }
+
+ /**
+ * Getter for property directoryPattern. This is a regular expression
+ * against which directory names should be matched.
+ * Applies only to directory, and tells whether a directory should be
+ * included or excluded from the search.
+ * <p>If File.isDirectory() && directoryPattern!=null &&
+ * File.getName().matches(directoryPattern),
+ * then File matches this filter.<br>
+ * If File.isDirectory() && directoryPattern!=null &&
+ * File.getName().matches(directoryPattern)==false,
+ * then File doesn't match this filter.<br>
+ * </p>
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ * @return Value of property directoryPattern.
+ */
+ @XmlElement(name="DirectoryPattern",namespace=XmlConfigUtils.NAMESPACE)
+ public String getDirectoryPattern() {
+ return this.directoryPattern;
+ }
+
+ /**
+ * Setter for property directoryPattern.
+ * @param directoryPattern New value of property directoryPattern.
+ * This is a regular expression
+ * against which directory names should be {@link #getDirectoryPattern
+ * matched}.
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ */
+ public void setDirectoryPattern(String directoryPattern) {
+ this.directoryPattern = directoryPattern;
+ }
+
+ /**
+ * Getter for property filePattern. This is a regular expression
+ * against which file names should be matched.
+ * Applies only to files.
+ * <p>
+ * If File.isDirectory()==false && filePattern!=null &&
+ * File.getName().matches(filePattern)==false,
+ * then File doesn't match this filter.
+ * </p>
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ * @return Value of property filePatern.
+ */
+ @XmlElement(name="FilePattern",namespace=XmlConfigUtils.NAMESPACE)
+ public String getFilePattern() {
+ return this.filePattern;
+ }
+
+ /**
+ * Setter for property filePattern.
+ * @param filePattern New value of property filePattern.
+ * This is a regular expression
+ * against which file names should be {@link #getFilePattern matched}.
+ * @see java.util.regex.Pattern
+ * @see java.lang.String#matches(java.lang.String)
+ */
+ public void setFilePattern(String filePattern) {
+ this.filePattern = filePattern;
+ }
+
+ /**
+ * Getter for property sizeExceedsMaxBytes.
+ * Ignored if 0 or negative. Otherwise, files whose size in bytes does
+ * not exceed this limit will be excluded by this filter.
+ *
+ * @return Value of property sizeExceedsMaxBytes.
+ */
+ @XmlElement(name="SizeExceedsMaxBytes",namespace=XmlConfigUtils.NAMESPACE)
+ public long getSizeExceedsMaxBytes() {
+ return this.sizeExceedsMaxBytes;
+ }
+
+ /**
+ * Setter for property sizeExceedsMaxBytes.
+ * @param sizeLimitInBytes New value of property sizeExceedsMaxBytes.
+ * Ignored if 0 or negative. Otherwise, files whose size in bytes does
+ * not exceed this limit will be excluded by this filter.
+ *
+ */
+ public void setSizeExceedsMaxBytes(long sizeLimitInBytes) {
+ this.sizeExceedsMaxBytes = sizeLimitInBytes;
+ }
+
+ /**
+ * Getter for property {@code lastModifiedAfter}.
+ * A file will be selected only if it was last modified after
+ * {@code lastModifiedAfter}.
+ * <br>This condition is ignored if {@code lastModifiedAfter} is
+ * {@code null}.
+ * @return Value of property {@code lastModifiedAfter}.
+ */
+ @XmlElement(name="LastModifiedAfter",namespace=XmlConfigUtils.NAMESPACE)
+ public Date getLastModifiedAfter() {
+ return (lastModifiedAfter==null)?null:(Date)lastModifiedAfter.clone();
+ }
+
+ /**
+ * Setter for property {@code lastModifiedAfter}.
+ * @param lastModifiedAfter A file will be selected only if it was
+ * last modified after {@code lastModifiedAfter}.
+ * <br>This condition is ignored if {@code lastModifiedAfter} is
+ * {@code null}.
+ */
+ public void setLastModifiedAfter(Date lastModifiedAfter) {
+ this.lastModifiedAfter =
+ (lastModifiedAfter==null)?null:(Date)lastModifiedAfter.clone();
+ }
+
+ /**
+ * Getter for property {@code lastModifiedBefore}.
+ * A file will be selected only if it was last modified before
+ * {@code lastModifiedBefore}.
+ * <br>This condition is ignored if {@code lastModifiedBefore} is
+ * {@code null}.
+ * @return Value of property {@code lastModifiedBefore}.
+ */
+ @XmlElement(name="LastModifiedBefore",namespace=XmlConfigUtils.NAMESPACE)
+ public Date getLastModifiedBefore() {
+ return (lastModifiedBefore==null)?null:(Date)lastModifiedBefore.clone();
+ }
+
+ /**
+ * Setter for property {@code lastModifiedBefore}.
+ * @param lastModifiedBefore A file will be selected only if it was
+ * last modified before {@code lastModifiedBefore}.
+ * <br>This condition is ignored if {@code lastModifiedBefore} is
+ * {@code null}.
+ */
+ public void setLastModifiedBefore(Date lastModifiedBefore) {
+ this.lastModifiedBefore =
+ (lastModifiedBefore==null)?null:(Date)lastModifiedBefore.clone();
+ }
+
+ // Accepts or rejects a file with regards to the values of the fields
+ // configured in this bean. The accept() method is the implementation
+ // of FileFilter.accept(File);
+ //
+ /**
+ * A file is accepted when all the criteria that have been set
+ * are matched.
+ * @param f The file to match against the configured criteria.
+ * @return {@code true} if the file matches all criteria,
+ * {@code false} otherwise.
+ */
+ public boolean accept(File f) {
+
+ // Directories are accepted if they match against the directory pattern.
+ //
+ if (f.isDirectory()) {
+ if (directoryPattern != null
+ && !f.getName().matches(directoryPattern))
+ return false;
+ else return true;
+ }
+
+ // If we reach here, the f is not a directory.
+ //
+ // Files are accepted if they match all other conditions.
+
+ // Check whether f matches filePattern
+ if (filePattern != null
+ && !f.getName().matches(filePattern))
+ return false;
+
+ // Check whether f exceeeds size limit
+ if (sizeExceedsMaxBytes > 0 && f.length() <= sizeExceedsMaxBytes)
+ return false;
+
+ // Check whether f was last modified after lastModifiedAfter
+ if (lastModifiedAfter != null &&
+ lastModifiedAfter.after(new Date(f.lastModified())))
+ return false;
+
+ // Check whether f was last modified before lastModifiedBefore
+ if (lastModifiedBefore != null &&
+ lastModifiedBefore.before(new Date(f.lastModified())))
+ return false;
+
+ // All conditions were met: accept file.
+ return true;
+ }
+
+ // used by equals()
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ directoryPattern, filePattern, lastModifiedAfter,
+ lastModifiedBefore, sizeExceedsMaxBytes
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof FileMatch)) return false;
+ final FileMatch other = (FileMatch)o;
+ final Object[] thisconfig = toArray();
+ final Object[] otherconfig = other.toArray();
+ return Arrays.deepEquals(thisconfig,otherconfig);
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.deepHashCode(toArray());
+ }
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java
new file mode 100644
index 0000000..5f3d668
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultLogConfig.java
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.util.Arrays;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * The <code>ResultLogConfig</code> Java Bean is used to model
+ * the initial configuration of the {@link
+ * com.sun.jmx.examples.scandir.ResultLogManagerMXBean}.
+ *
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="ResultLogConfig",
+ namespace=XmlConfigUtils.NAMESPACE)
+public class ResultLogConfig {
+
+ //
+ // A logger for this class.
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(ResultLogConfig.class.getName());
+
+ /**
+ * The path to the result log file. {@code null} means that logging to
+ * file is disabled.
+ */
+ private String logFileName;
+
+ /**
+ * Maximum number of record that will be logged in the log file before
+ * switching to a new log file.
+ */
+ private long logFileMaxRecords;
+
+ /**
+ * The maximum number of records that can be contained in the memory log.
+ * When this number is reached, the memory log drops its eldest record
+ * to make way for the new one.
+ */
+ private int memoryMaxRecords;
+
+ /**
+ * Creates a new instance of ResultLogConfig
+ */
+ public ResultLogConfig() {
+ }
+
+ /**
+ * Gets the path to the result log file. {@code null} means that logging to
+ * file is disabled.
+ * @return the path to the result log file.
+ */
+ @XmlElement(name="LogFileName",namespace=XmlConfigUtils.NAMESPACE)
+ public String getLogFileName() {
+ return this.logFileName;
+ }
+
+ /**
+ * Sets the path to the result log file. {@code null} means that
+ * logging to file is disabled.
+ * @param logFileName the path to the result log file.
+ */
+ public void setLogFileName(String logFileName) {
+ this.logFileName = logFileName;
+ }
+
+ /**
+ * Gets the maximum number of record that will be logged in the log file
+ * before switching to a new log file.
+ * A 0 or negative value means no limit.
+ * @return the maximum number of record that will be logged in the log file.
+ */
+ @XmlElement(name="LogFileMaxRecords",namespace=XmlConfigUtils.NAMESPACE)
+ public long getLogFileMaxRecords() {
+ return this.logFileMaxRecords;
+ }
+
+ /**
+ * Sets the maximum number of record that will be logged in the log file
+ * before switching to a new log file.
+ * A 0 or negative value means no limit.
+ * @param logFileMaxRecords the maximum number of record that will be
+ * logged in the log file.
+ */
+ public void setLogFileMaxRecords(long logFileMaxRecords) {
+ this.logFileMaxRecords = logFileMaxRecords;
+ }
+
+ /**
+ * Gets the maximum number of records that can be contained in the memory
+ * log.
+ * When this number is reached, the memory log drops its eldest record
+ * to make way for the new one.
+ * @return the maximum number of records that can be contained in the
+ * memory log.
+ */
+ @XmlElement(name="MemoryMaxRecords",namespace=XmlConfigUtils.NAMESPACE)
+ public int getMemoryMaxRecords() {
+ return this.memoryMaxRecords;
+ }
+
+ /**
+ * Sets the maximum number of records that can be contained in the memory
+ * log.
+ * When this number is reached, the memory log drops its eldest record
+ * to make way for the new one.
+ * @param memoryMaxRecords the maximum number of records that can be
+ * contained in the memory log.
+ */
+ public void setMemoryMaxRecords(int memoryMaxRecords) {
+ this.memoryMaxRecords = memoryMaxRecords;
+ }
+
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ memoryMaxRecords,logFileMaxRecords,logFileName
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof ResultLogConfig)) return false;
+ final ResultLogConfig other = (ResultLogConfig)o;
+ return Arrays.deepEquals(toArray(),other.toArray());
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.deepHashCode(toArray());
+ }
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java
new file mode 100644
index 0000000..5e3188a
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ResultRecord.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.util.Date;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlRootElement;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig.Action;
+import java.io.File;
+import java.util.Arrays;
+
+/**
+ * The <code>ResultRecord</code> Java Bean is used to write the
+ * results of a directory scan to a result log.
+ *
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+@XmlRootElement(name="ResultRecord",namespace=XmlConfigUtils.NAMESPACE)
+public class ResultRecord {
+
+ /**
+ * The name of the file for which this result record is built.
+ */
+ private String filename;
+
+ /**
+ * The Date at which this result was obtained.
+ */
+ private Date date;
+
+ /**
+ * The short name of the directory scanner which performed the operation.
+ * @see DirectoryScannerConfig#getName()
+ */
+ private String directoryScanner;
+
+ /**
+ * The list of actions that were successfully carried out.
+ */
+ private Action[] actions;
+
+ /**
+ * Creates a new empty instance of ResultRecord.
+ */
+ public ResultRecord() {
+ }
+
+ /**
+ * Creates a new instance of ResultRecord.
+ * @param scan The DirectoryScannerConfig for which this result was
+ * obtained.
+ * @param actions The list of actions that were successfully carried out.
+ * @param f The file for which these actions were successfully carried out.
+ */
+ public ResultRecord(DirectoryScannerConfig scan, Action[] actions,
+ File f) {
+ directoryScanner = scan.getName();
+ this.actions = actions;
+ date = new Date();
+ filename = f.getAbsolutePath();
+ }
+
+ /**
+ * Gets the name of the file for which this result record is built.
+ * @return The name of the file for which this result record is built.
+ */
+ @XmlElement(name="Filename",namespace=XmlConfigUtils.NAMESPACE)
+ public String getFilename() {
+ return this.filename;
+ }
+
+ /**
+ * Sets the name of the file for which this result record is being built.
+ * @param filename the name of the file for which this result record is
+ * being built.
+ */
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ /**
+ * Gets the Date at which this result was obtained.
+ * @return the Date at which this result was obtained.
+ */
+ @XmlElement(name="Date",namespace=XmlConfigUtils.NAMESPACE)
+ public Date getDate() {
+ synchronized(this) {
+ return (date==null)?null:(new Date(date.getTime()));
+ }
+ }
+
+ /**
+ * Sets the Date at which this result was obtained.
+ * @param date the Date at which this result was obtained.
+ */
+ public void setDate(Date date) {
+ synchronized (this) {
+ this.date = (date==null)?null:(new Date(date.getTime()));
+ }
+ }
+
+ /**
+ * Gets the short name of the directory scanner which performed the
+ * operation.
+ * @see DirectoryScannerConfig#getName()
+ * @return the short name of the directory scanner which performed the
+ * operation.
+ */
+ @XmlElement(name="DirectoryScanner",namespace=XmlConfigUtils.NAMESPACE)
+ public String getDirectoryScanner() {
+ return this.directoryScanner;
+ }
+
+ /**
+ * Sets the short name of the directory scanner which performed the
+ * operation.
+ * @see DirectoryScannerConfig#getName()
+ * @param directoryScanner the short name of the directory scanner which
+ * performed the operation.
+ */
+ public void setDirectoryScanner(String directoryScanner) {
+ this.directoryScanner = directoryScanner;
+ }
+
+ /**
+ * Gets the list of actions that were successfully carried out.
+ * @return the list of actions that were successfully carried out.
+ */
+ @XmlElement(name="Actions",namespace=XmlConfigUtils.NAMESPACE)
+ @XmlList
+ public Action[] getActions() {
+ return (actions == null)?null:actions.clone();
+ }
+
+ /**
+ * Sets the list of actions that were successfully carried out.
+ * @param actions the list of actions that were successfully carried out.
+ */
+ public void setActions(Action[] actions) {
+ this.actions = (actions == null)?null:actions.clone();
+ }
+
+ // Used for equality
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ filename, date, directoryScanner, actions
+ };
+ return thisconfig;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof ResultRecord)) return false;
+ return Arrays.deepEquals(toArray(),((ResultRecord)o).toArray());
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.deepHashCode(toArray());
+ }
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java
new file mode 100644
index 0000000..e1afcce
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/ScanManagerConfig.java
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+
+/**
+ * The <code>ScanManagerConfig</code> Java Bean is used to model
+ * the configuration of the {@link
+ * com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean}.
+ *
+ * The {@link
+ * com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean} will
+ * use this configuration to initialize the {@link
+ * com.sun.jmx.examples.scandir.ResultLogManagerMXBean ResultLogManagerMXBean}
+ * and create the {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean DirectoryScannerMXBeans}
+ * <p>
+ * This class is annotated for XML binding.
+ * </p>
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ **/
+@XmlRootElement(name="ScanManager",
+ namespace="jmx:com.sun.jmx.examples.scandir.config")
+public class ScanManagerConfig {
+
+ // A logger for this class
+ //
+ // private static final Logger LOG =
+ // Logger.getLogger(ScanManagerConfig.class.getName());
+
+ /**
+ * A set of DirectoryScannerConfig objects indexed by their names.
+ **/
+ private final Map<String, DirectoryScannerConfig> directoryScanners;
+
+ /**
+ * The initial Result Log configuration.
+ */
+ private ResultLogConfig initialResultLogConfig;
+
+ /**
+ * Holds value of property name. The name of the configuration
+ * usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ **/
+ private String name;
+
+ /**
+ * Creates a new instance of ScanManagerConfig.
+ * <p>You should not use this constructor directly, but use
+ * {@link #ScanManagerConfig(String)} instead.
+ * </p>
+ * <p>This constructor is tagged deprecated so that the compiler
+ * will generate a warning if it is used by mistake.
+ * </p>
+ * @deprecated Use {@link #ScanManagerConfig(String)} instead. This
+ * constructor is used through reflection by the XML
+ * binding framework.
+ */
+ public ScanManagerConfig() {
+ this(null,true);
+ }
+
+ /**
+ * Creates a new instance of ScanManagerConfig.
+ * @param name The name of the configuration which usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ **/
+ public ScanManagerConfig(String name) {
+ this(name,false);
+ }
+
+ // Our private constructor...
+ private ScanManagerConfig(String name, boolean allowsNull) {
+ if (name == null && allowsNull==false)
+ throw new IllegalArgumentException("name=null");
+ this.name = name;
+ directoryScanners = new LinkedHashMap<String,DirectoryScannerConfig>();
+ this.initialResultLogConfig = new ResultLogConfig();
+ this.initialResultLogConfig.setMemoryMaxRecords(1024);
+ }
+
+ // Creates an array for deep equality.
+ private Object[] toArray() {
+ final Object[] thisconfig = {
+ name,directoryScanners,initialResultLogConfig
+ };
+ return thisconfig;
+ }
+
+ // equals
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof ScanManagerConfig)) return false;
+ final ScanManagerConfig other = (ScanManagerConfig)o;
+ if (this.directoryScanners.size() != other.directoryScanners.size())
+ return false;
+ return Arrays.deepEquals(toArray(),other.toArray());
+ }
+
+ @Override
+ public int hashCode() {
+ final String key = name;
+ if (key == null) return 0;
+ else return key.hashCode();
+ }
+
+ /**
+ * Gets the name of this configuration. The name of the configuration
+ * usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ * @return The name of this configuration.
+ */
+ @XmlAttribute(name="name",required=true)
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Sets the name of this configuration. The name of the configuration
+ * usually corresponds to
+ * the value of the {@code name=} key of the {@code ObjectName}
+ * of the {@link
+ * com.sun.jmx.examples.scandir.ScanDirConfigMXBean
+ * ScanDirConfigMXBean} which owns this configuration.
+ * <p>Once set this value cannot change.</p>
+ * @param name The name of this configuration.
+ */
+ public void setName(String name) {
+ if (this.name == null)
+ this.name = name;
+ else if (name == null)
+ throw new IllegalArgumentException("name=null");
+ else if (!name.equals(this.name))
+ throw new IllegalArgumentException("name="+name);
+ }
+
+ /**
+ * Gets the list of Directory Scanner configured by this
+ * configuration. From each element in this list, the
+ * {@link com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean}
+ * will create, initialize, and register a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean}.
+ * @return The list of Directory Scanner configured by this configuration.
+ */
+ @XmlElementWrapper(name="DirectoryScannerList",
+ namespace=XmlConfigUtils.NAMESPACE)
+ @XmlElementRef
+ public DirectoryScannerConfig[] getScanList() {
+ return directoryScanners.values().toArray(new DirectoryScannerConfig[0]);
+ }
+
+ /**
+ * Sets the list of Directory Scanner configured by this
+ * configuration. From each element in this list, the
+ * {@link com.sun.jmx.examples.scandir.ScanManagerMXBean ScanManagerMXBean}
+ * will create, initialize, and register a {@link
+ * com.sun.jmx.examples.scandir.DirectoryScannerMXBean}.
+ * @param scans The list of Directory Scanner configured by this configuration.
+ */
+ public void setScanList(DirectoryScannerConfig[] scans) {
+ directoryScanners.clear();
+ for (DirectoryScannerConfig scan : scans)
+ directoryScanners.put(scan.getName(),scan);
+ }
+
+ /**
+ * Get a directory scanner by its name.
+ *
+ * @param name The name of the directory scanner. This is the
+ * value returned by {@link
+ * DirectoryScannerConfig#getName()}.
+ * @return The named {@code DirectoryScannerConfig}
+ */
+ public DirectoryScannerConfig getScan(String name) {
+ return directoryScanners.get(name);
+ }
+
+ /**
+ * Adds a directory scanner to the list.
+ * <p>If a directory scanner
+ * configuration by that name already exists in the list, it will
+ * be replaced by the given <var>scan</var>.
+ * </p>
+ * @param scan The {@code DirectoryScannerConfig} to add to the list.
+ * @return The replaced {@code DirectoryScannerConfig}, or {@code null}
+ * if there was no {@code DirectoryScannerConfig} by that name
+ * in the list.
+ */
+ public DirectoryScannerConfig putScan(DirectoryScannerConfig scan) {
+ return this.directoryScanners.put(scan.getName(),scan);
+ }
+
+ // XML value of this object.
+ public String toString() {
+ return XmlConfigUtils.toString(this);
+ }
+
+ /**
+ * Removes the named directory scanner from the list.
+ *
+ * @param name The name of the directory scanner. This is the
+ * value returned by {@link
+ * DirectoryScannerConfig#getName()}.
+ * @return The removed {@code DirectoryScannerConfig}, or {@code null}
+ * if there was no directory scanner by that name in the list.
+ */
+ public DirectoryScannerConfig removeScan(String name) {
+ return this.directoryScanners.remove(name);
+ }
+
+ /**
+ * Gets the initial Result Log Configuration.
+ * @return The initial Result Log Configuration.
+ */
+ @XmlElement(name="InitialResultLogConfig",namespace=XmlConfigUtils.NAMESPACE)
+ public ResultLogConfig getInitialResultLogConfig() {
+ return this.initialResultLogConfig;
+ }
+
+ /**
+ * Sets the initial Result Log Configuration.
+ * @param initialLogConfig The initial Result Log Configuration.
+ */
+ public void setInitialResultLogConfig(ResultLogConfig initialLogConfig) {
+ this.initialResultLogConfig = initialLogConfig;
+ }
+
+ /**
+ * Creates a copy of this object, with the specified name.
+ * @param newname the name of the copy.
+ * @return A copy of this object.
+ **/
+ public ScanManagerConfig copy(String newname) {
+ return copy(newname,this);
+ }
+
+ // Copy by XML cloning, then change the name.
+ //
+ private static ScanManagerConfig
+ copy(String newname, ScanManagerConfig other) {
+ ScanManagerConfig newbean = XmlConfigUtils.xmlClone(other);
+ newbean.name = newname;
+ return newbean;
+ }
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java
new file mode 100644
index 0000000..a3e663d
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/XmlConfigUtils.java
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Logger;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+/**
+ * The class XmlConfigUtils is used to deal with XML serialization
+ * and XML files.
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class XmlConfigUtils {
+
+ /**
+ * A URI for our XML configuration namespace. This doesn't start with
+ * http:// because we are not going to publish this private schema
+ * anywhere.
+ **/
+ public static final String NAMESPACE =
+ "jmx:com.sun.jmx.examples.scandir.config";
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(XmlConfigUtils.class.getName());
+
+ // Our JAXBContext.
+ private static JAXBContext context;
+
+ // The file name of the XML file in which an instance of this object
+ // will read and write XML data.
+ final String file;
+
+ /**
+ * Creates a new instance of XmlConfigUtils.
+ * @param file The file name of the XML file in which an instance of this
+ * object will read and write XML data.
+ */
+ public XmlConfigUtils(String file) {
+ this.file = file;
+ }
+
+ /**
+ * Write the given bean to the XML file.
+ * <p>
+ * Performs an atomic write, first writing in {@code <file>.new}, then
+ * renaming {@code <file>} to {@code <file>~}, then renaming
+ * renaming {@code <file>.new} to {@code <file>}.
+ * </p>
+ * @param bean The configuration to write in the XML file.
+ * @throws IOException if write to file failed.
+ **/
+ public synchronized void writeToFile(ScanManagerConfig bean)
+ throws IOException {
+
+ // Creates a new file named <file>.new
+ final File f = newXmlTmpFile(file);
+ try {
+ final FileOutputStream out = new FileOutputStream(f);
+ boolean failed = true;
+ try {
+ // writes to <file>.new
+ write(bean,out,false);
+
+ // no exception: set failed=false for finaly {} block.
+ failed = false;
+ } finally {
+ out.close();
+ // An exception was raised: delete temporary file.
+ if (failed == true) f.delete();
+ }
+
+ // rename <file> to <file>~ and <file>.new to <file>
+ commit(file,f);
+ } catch (JAXBException x) {
+ final IOException io =
+ new IOException("Failed to write SessionConfigBean to " +
+ file+": "+x,x);
+ throw io;
+ }
+ }
+
+ /**
+ * Creates an XML string representation of the given bean.
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XMLbinding context.
+ * @return An XML string representation of the given bean.
+ **/
+ public static String toString(Object bean) {
+ try {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final Marshaller m = createMarshaller();
+ m.setProperty(m.JAXB_FRAGMENT,Boolean.TRUE);
+ m.marshal(bean, baos);
+ return baos.toString();
+ } catch (JAXBException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException(
+ "Failed to write SessionConfigBean: "+x,x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Creates an XML clone of the given bean.
+ * <p>
+ * In other words, this method XML-serializes the given bean, and
+ * XML-deserializes a copy of that bean.
+ * </p>
+ * @return A deep-clone of the given bean.
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XML binding context.
+ * @param bean The bean to clone.
+ */
+ public static ScanManagerConfig xmlClone(ScanManagerConfig bean) {
+ final Object clone = copy(bean);
+ return (ScanManagerConfig)clone;
+ }
+
+ /**
+ * Creates an XML clone of the given bean.
+ * <p>
+ * In other words, this method XML-serializes the given bean, and
+ * XML-deserializes a copy of that bean.
+ * </p>
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XML binding context.
+ * @return A deep-clone of the given bean.
+ **/
+ private static Object copy(Object bean) {
+ try {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final Marshaller m = createMarshaller();
+ m.marshal(bean, baos);
+ final ByteArrayInputStream bais =
+ new ByteArrayInputStream(baos.toByteArray());
+ return createUnmarshaller().unmarshal(bais);
+ } catch (JAXBException x) {
+ final IllegalArgumentException iae =
+ new IllegalArgumentException("Failed to write SessionConfigBean: "+x,x);
+ throw iae;
+ }
+ }
+
+ /**
+ * Creates an XML clone of the given bean.
+ * <p>
+ * In other words, this method XML-serializes the given bean, and
+ * XML-deserializes a copy of that bean.
+ * </p>
+ * @return A deep-clone of the given bean.
+ * @throws IllegalArgumentException if the bean class is not known by the
+ * underlying XML binding context.
+ * @param bean The bean to clone.
+ */
+ public static DirectoryScannerConfig xmlClone(DirectoryScannerConfig bean) {
+ final Object clone = copy(bean);
+ return (DirectoryScannerConfig)clone;
+ }
+
+ /**
+ * Reads the configuration from the XML configuration file.
+ * @throws IOException if it fails to read the configuration.
+ * @return A {@code ScanManagerConfig} bean read from the
+ * XML configuration file.
+ **/
+ public synchronized ScanManagerConfig readFromFile() throws IOException {
+ final File f = new File(file);
+ if (!f.exists())
+ throw new IOException("No such file: "+file);
+ if (!f.canRead())
+ throw new IOException("Can't read file: "+file);
+ try {
+ return read(f);
+ } catch (JAXBException x) {
+ final IOException io =
+ new IOException("Failed to read SessionConfigBean from " +
+ file+": "+x,x);
+ throw io;
+ }
+ }
+
+ /**
+ * Reads the configuration from the given XML configuration file.
+ * @param f the file to read from.
+ * @return A {@code ScanManagerConfig} bean read from the
+ * XML configuration file.
+ * @throws javax.xml.bind.JAXBException if it fails to read the configuration.
+ */
+ public static ScanManagerConfig read(File f)
+ throws JAXBException {
+ final Unmarshaller u = createUnmarshaller();
+ return (ScanManagerConfig) u.unmarshal(f);
+
+ }
+
+ /**
+ * Writes the given bean to the given output stream.
+ * @param bean the bean to write.
+ * @param os the output stream to write to.
+ * @param fragment whether the {@code <?xml ... ?>} header should be
+ * included. The header is not included if the bean is just an
+ * XML fragment encapsulated in a higher level XML element.
+ * @throws JAXBException An XML Binding exception occurred.
+ **/
+ public static void write(ScanManagerConfig bean, OutputStream os,
+ boolean fragment)
+ throws JAXBException {
+ writeXml((Object)bean,os,fragment);
+ }
+
+ /**
+ * Writes the given bean to the given output stream.
+ * @param bean the bean to write.
+ * @param os the output stream to write to.
+ * @param fragment whether the {@code <?xml ... ?>} header should be
+ * included. The header is not included if the bean is just an
+ * XML fragment encapsulated in a higher level XML element.
+ * @throws JAXBException An XML Binding exception occurred.
+ **/
+ public static void write(ResultRecord bean, OutputStream os, boolean fragment)
+ throws JAXBException {
+ writeXml((Object)bean,os,fragment);
+ }
+
+ /**
+ * Writes the given bean to the given output stream.
+ * @param bean the bean to write.
+ * @param os the output stream to write to.
+ * @param fragment whether the {@code <?xml ... ?>} header should be
+ * included. The header is not included if the bean is just an
+ * XML fragment encapsulated in a higher level XML element.
+ * @throws JAXBException An XML Binding exception occurred.
+ **/
+ private static void writeXml(Object bean, OutputStream os, boolean fragment)
+ throws JAXBException {
+ final Marshaller m = createMarshaller();
+ if (fragment) m.setProperty(m.JAXB_FRAGMENT,Boolean.TRUE);
+ m.marshal(bean,os);
+ }
+
+ // Creates a JAXB Unmarshaller.
+ private static Unmarshaller createUnmarshaller() throws JAXBException {
+ return getContext().createUnmarshaller();
+ }
+
+ // Creates a JAXB Marshaller - for nicely XML formatted output.
+ private static Marshaller createMarshaller() throws JAXBException {
+ final Marshaller m = getContext().createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
+ return m;
+ }
+
+ // Creates a JAXBContext if needed, and returns it.
+ // The JAXBContext instance we create will be able to handle the
+ // ScanManagerConfig and ResultRecord classes, plus all the property
+ // classes they reference (DirectoryScannerBean etc...).
+ //
+ private static synchronized JAXBContext getContext() throws JAXBException {
+ if (context == null)
+ context = JAXBContext.newInstance(ScanManagerConfig.class,
+ ResultRecord.class);
+ return context;
+ }
+
+
+ // Creates a new XML temporary file called <basename>.new
+ // This method is used to implement atomic writing to file.
+ // The usual sequence is:
+ //
+ // Final tmp = newXmlTmpFile(basename);
+ // boolean failed = true;
+ // try {
+ // ... write to 'tmp' ...
+ // // no exception: set failed=false for finaly {} block.
+ // failed = false;
+ // } finally
+ // // failed==true means there was an exception and
+ // // commit won't be called...
+ // if (failed==true) tmp.delete();
+ // }
+ // commit(tmp,basename)
+ //
+ private static File newXmlTmpFile(String basename) throws IOException {
+ final File f = new File(basename+".new");
+ if (!f.createNewFile())
+ throw new IOException("file "+f.getName()+" already exists");
+
+ try {
+ final OutputStream newStream = new FileOutputStream(f);
+ try {
+ final String decl =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
+ newStream.write(decl.getBytes("UTF-8"));
+ newStream.flush();
+ } finally {
+ newStream.close();
+ }
+ } catch (IOException x) {
+ f.delete();
+ throw x;
+ }
+ return f;
+ }
+
+ // Commit the temporary file by renaming <basename> to <baesname>~
+ // and tmpFile to <basename>.
+ private static File commit(String basename, File tmpFile)
+ throws IOException {
+ try {
+ final String backupName = basename+"~";
+ final File desired = new File(basename);
+ final File backup = new File(backupName);
+ backup.delete();
+ if (desired.exists()) {
+ if (!desired.renameTo(new File(backupName)))
+ throw new IOException("can't rename to "+backupName);
+ }
+ if (!tmpFile.renameTo(new File(basename)))
+ throw new IOException("can't rename to "+basename);
+ } catch (IOException x) {
+ tmpFile.delete();
+ throw x;
+ }
+ return new File(basename);
+ }
+
+ /**
+ * Creates a new committed XML file for {@code <basename>}, containing only
+ * the {@code <?xml ...?>} header.
+ * <p>This method will rename {@code <basename>} to {@code <basename>~},
+ * if it exists.
+ * </p>
+ * @return A newly created XML file containing the regular
+ * {@code <?xml ...?>} header.
+ * @param basename The name of the new file.
+ * @throws IOException if the new XML file couldn't be created.
+ */
+ public static File createNewXmlFile(String basename) throws IOException {
+ return commit(basename,newXmlTmpFile(basename));
+ }
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html
new file mode 100644
index 0000000..5390c29
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/config/package.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+ <head>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+ <title>com.sun.jmx.examples.scandir.config</title>
+ </head>
+ <body>
+ <p>
+ This package defines plain Java Beans, annotated for
+ XML bindings, and used to store and model the scandir
+ application configuration.
+ </p>
+ <p>All the Java Beans defined in this package have been
+ designed to be <i>naturally serialized</i> by JAXB.
+ Their bean properties were designed to minimize
+ the number of XML annotation required, as well as
+ making them transparently convertible by the
+ JMX MXBean framework.
+ </p>
+ <p>The {@link com.sun.jmx.examples.scandir.config.ScanManagerConfig}
+ bean corresponds to the root element of the application's configuration.
+ From an instance of this element, the
+ {@link com.sun.jmx.examples.scandir.ScanManagerMXBean} will be
+ able to initialize the
+ {@link com.sun.jmx.examples.scandir.ResultLogManagerMXBean} and will
+ create, register and initialize
+ {@link com.sun.jmx.examples.scandir.DirectoryScannerMXBean DirectoryScannerMXBeans}
+ </p>
+ <p>The {@link com.sun.jmx.examples.scandir.config.XmlConfigUtils} class is a simple utility
+ classes used to deal with XML and XML configuration files.
+ </p>
+ <p>The {@link com.sun.jmx.examples.scandir.config.ResultRecord ResultRecords}
+ are used to store the results of directory scans in the result logs
+ managed by the {@link com.sun.jmx.examples.scandir.ResultLogManagerMXBean}
+ </p>
+ </body>
+</html>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html
new file mode 100644
index 0000000..54d3172
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/com/sun/jmx/examples/scandir/package.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+
+<html>
+ <head>
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+ <title>com.sun.jmx.examples.scandir</title>
+ </head>
+ <body>
+ <p>
+ This package defines the set of MBeans which compose the
+ management interface of the scandir application.
+ </p>
+
+ </body>
+</html>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/access.properties b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/access.properties
new file mode 100644
index 0000000..c8286ed
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/access.properties
@@ -0,0 +1,51 @@
+######################################################################
+# Default Access Control File for Remote JMX(TM) Monitoring
+######################################################################
+#
+# Access control file for Remote JMX API access to monitoring.
+# This file defines the allowed access for different roles. The
+# password file (jmxremote.password by default) defines the roles and their
+# passwords. To be functional, a role must have an entry in
+# both the password and the access files.
+#
+# Default location of this file is $JRE/lib/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# (See that file for details)
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# Typical access file has multiple lines, where each line is blank,
+# a comment (like this one), or an access control entry.
+#
+# An access control entry consists of a role name, and an
+# associated access level. The role name is any string that does not
+# itself contain spaces or tabs. It corresponds to an entry in the
+# password file (jmxremote.password). The access level is one of the
+# following:
+# "readonly" grants access to read attributes of MBeans.
+# For monitoring, this means that a remote client in this
+# role can read measurements but cannot perform any action
+# that changes the environment of the running program.
+# "readwrite" grants access to read and write attributes of MBeans,
+# to invoke operations on them, and to create or remove them.
+# This access should be granted to only trusted clients,
+# since they can potentially interfere with the smooth
+# operation of a running program
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last
+# access entry is used.
+#
+#
+# Default access control entries:
+# o The "monitorRole" role has readonly access.
+# o The "controlRole" role has readwrite access.
+#
+# monitorRole readonly
+# controlRole readwrite
+
+guest readonly
+admin readwrite
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/management.properties b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/management.properties
new file mode 100644
index 0000000..5035139
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/management.properties
@@ -0,0 +1,273 @@
+#####################################################################
+# Default Configuration File for Java Platform Management
+#####################################################################
+#
+# The Management Configuration file (in java.util.Properties format)
+# will be read if one of the following system properties is set:
+# -Dcom.sun.management.jmxremote.port=<port-number>
+# or -Dcom.sun.management.snmp.port=<port-number>
+# or -Dcom.sun.management.config.file=<this-file>
+#
+# The default Management Configuration file is:
+#
+# $JRE/lib/management/management.properties
+#
+# Another location for the Management Configuration File can be specified
+# by the following property on the Java command line:
+#
+# -Dcom.sun.management.config.file=<this-file>
+#
+# If -Dcom.sun.management.config.file=<this-file> is set, the port
+# number for the management agent can be specified in the config file
+# using the following lines:
+#
+# ################ Management Agent Port #########################
+#
+# For setting the JMX RMI agent port use the following line
+com.sun.management.jmxremote.port=4545
+#
+# For setting the SNMP agent port use the following line
+# com.sun.management.snmp.port=<port-number>
+
+#####################################################################
+# Optional Instrumentation
+#####################################################################
+#
+# By default only the basic instrumentation with low overhead is on.
+# The following properties allow to selectively turn on optional
+# instrumentation which are off by default and may have some
+# additional overhead.
+#
+# com.sun.management.enableThreadContentionMonitoring
+#
+# This option enables thread contention monitoring if the
+# Java virtual machine supports such instrumentation.
+# Refer to the specification for the java.lang.management.ThreadMBean
+# interface - see isThreadContentionMonitoringSupported() method.
+#
+
+# To enable thread contention monitoring, uncomment the following line
+# com.sun.management.enableThreadContentionMonitoring
+
+#####################################################################
+# SNMP Management Properties
+#####################################################################
+#
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
+# is set then
+# - The SNMP agent (with the Java virtual machine MIB) is started
+# that listens on the specified port for incoming SNMP requests.
+# - the following properties for read for SNMP management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to the above system property (e.g. via setProperty method), this
+# config file, or the ACL file has no effect to the running SNMP agent.
+#
+
+#
+# ##################### SNMP Trap Port #########################
+#
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+# Specifies the remote port number at which managers are expected
+# to listen for trap. For each host defined in the ACL file,
+# the SNMP agent will send traps at <host>:<trap-destination-port-number>
+# Default for this property is 162.
+#
+
+# To set port for sending traps to a different port use the following line
+# com.sun.management.snmp.trap=<trap-destination-port-number>
+
+#
+# ################ SNMP listen interface #########################
+#
+# com.sun.management.snmp.interface=<InetAddress>
+# Specifies the local interface on which the SNMP agent will bind.
+# This is usefull when running on machines which have several
+# interfaces defined. It makes it possible to listen to a specific
+# subnet accessible through that interface.
+# Default for this property is "localhost".
+#
+# The format of the value for that property is any string accepted
+# by java.net.InetAddress.getByName(String).
+#
+
+# For restricting the port on which SNMP agent listens use the following line
+# com.sun.management.snmp.interface=<InetAddress>
+
+#
+# #################### SNMP ACL file #########################
+#
+# com.sun.management.snmp.acl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then the ACL file
+# is not checked: all manager hosts are allowed all access.
+#
+
+# For SNMP without checking ACL file uncomment the following line
+# com.sun.management.snmp.acl=false
+
+#
+# com.sun.management.snmp.acl.file=filepath
+# Specifies location for ACL file
+# This is optional - default location is
+# $JRE/lib/management/snmp.acl
+#
+# If the property "com.sun.management.snmp.acl" is set to false,
+# then this property and the ACL file are ignored.
+# Otherwise the ACL file must exist and be in the valid format.
+# If the ACL file is empty or non existent then no access is allowed.
+#
+# The SNMP agent will read the ACL file at startup time.
+# Modification to the ACL file has no effect to any running SNMP
+# agents which read that ACL file at startup.
+#
+
+# For a non-default acl file location use the following line
+# com.sun.management.snmp.acl.file=filepath
+
+#####################################################################
+# RMI Management Properties
+#####################################################################
+#
+# If system property -Dcom.sun.management.jmxremote.port=<port-number>
+# is set then
+# - A MBean server is started
+# - JRE Platform MBeans are registered in the MBean server
+# - RMI connector is published in a private readonly registry at
+# specified port using a well known name, "jmxrmi"
+# - the following properties are read for JMX remote management.
+#
+# The configuration can be specified only at startup time.
+# Later changes to above system property (e.g. via setProperty method),
+# this config file, the password file, or the access file have no effect to the
+# running MBean server, the connector, or the registry.
+#
+
+#
+# ###################### RMI SSL #############################
+#
+# com.sun.management.jmxremote.ssl=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then SSL is not used.
+#
+
+# For RMI monitoring without SSL use the following line
+# com.sun.management.jmxremote.ssl=false
+
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites=<cipher-suites>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS cipher suites to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS cipher suites are enabled
+# for use by accepted connections. If this property is not specified then
+# the SSL/TLS RMI Server Socket Factory uses the SSL/TLS cipher suites that
+# are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.enabled.protocols=<protocol-versions>
+# The value of this property is a string that is a comma-separated list
+# of SSL/TLS protocol versions to enable. This property can be specified in
+# conjunction with the previous property "com.sun.management.jmxremote.ssl"
+# in order to control which particular SSL/TLS protocol versions are
+# enabled for use by accepted connections. If this property is not
+# specified then the SSL/TLS RMI Server Socket Factory uses the SSL/TLS
+# protocol versions that are enabled by default.
+#
+
+# com.sun.management.jmxremote.ssl.need.client.auth=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true in conjunction with the previous
+# property "com.sun.management.jmxremote.ssl" then the SSL/TLS RMI Server
+# Socket Factory will require client authentication.
+#
+
+# For RMI monitoring with SSL client authentication use the following line
+com.sun.management.jmxremote.ssl.need.client.auth=true
+
+# com.sun.management.jmxremote.registry.ssl=true|false
+# Default for this property is false. (Case for true/false ignored)
+# If this property is specified as true then the RMI registry used
+# to bind the RMIServer remote object is protected with SSL/TLS
+# RMI Socket Factories that can be configured with the properties:
+# com.sun.management.jmxremote.ssl.enabled.cipher.suites
+# com.sun.management.jmxremote.ssl.enabled.protocols
+# com.sun.management.jmxremote.ssl.need.client.auth
+# If the two properties below are true at the same time, i.e.
+# com.sun.management.jmxremote.ssl=true
+# com.sun.management.jmxremote.registry.ssl=true
+# then the RMIServer remote object and the RMI registry are
+# both exported with the same SSL/TLS RMI Socket Factories.
+#
+
+# For using an SSL/TLS protected RMI registry use the following line
+com.sun.management.jmxremote.registry.ssl=true
+
+#
+# ################ RMI User authentication ################
+#
+# com.sun.management.jmxremote.authenticate=true|false
+# Default for this property is true. (Case for true/false ignored)
+# If this property is specified as false then no authentication is
+# performed and all users are allowed all access.
+#
+
+# For RMI monitoring without any checking use the following line
+# com.sun.management.jmxremote.authenticate=false
+
+#
+# ################ RMI Login configuration ###################
+#
+# com.sun.management.jmxremote.login.config=<config-name>
+# Specifies the name of a JAAS login configuration entry to use when
+# authenticating users of RMI monitoring.
+#
+# Setting this property is optional - the default login configuration
+# specifies a file-based authentication that uses the password file.
+#
+# When using this property to override the default login configuration
+# then the named configuration entry must be in a file that gets loaded
+# by JAAS. In addition, the login module(s) specified in the configuration
+# should use the name and/or password callbacks to acquire the user's
+# credentials. See the NameCallback and PasswordCallback classes in the
+# javax.security.auth.callback package for more details.
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+#
+
+# For a non-default login configuration use the following line
+# com.sun.management.jmxremote.login.config=<config-name>
+
+#
+# ################ RMI Password file location ##################
+#
+# com.sun.management.jmxremote.password.file=filepath
+# Specifies location for password file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.password
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise the password file must exist and be in the valid format.
+# If the password file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+com.sun.management.jmxremote.password.file=src/etc/password.properties
+
+#
+# ################ RMI Access file location #####################
+#
+# com.sun.management.jmxremote.access.file=filepath
+# Specifies location for access file
+# This is optional - default location is
+# $JRE/lib/management/jmxremote.access
+#
+# If the property "com.sun.management.jmxremote.authenticate" is set to
+# false, then this property and the password & access files are ignored.
+# Otherwise, the access file must exist and be in the valid format.
+# If the access file is empty or non-existent then no access is allowed.
+#
+
+# For a non-default password file location use the following line
+com.sun.management.jmxremote.access.file=src/etc/access.properties
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/password.properties b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/password.properties
new file mode 100644
index 0000000..d90c8c8
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/password.properties
@@ -0,0 +1,55 @@
+##############################################################
+# Password File for Remote JMX Monitoring
+##############################################################
+#
+# Password file for Remote JMX API access to monitoring. This
+# file defines the different roles and their passwords. The access
+# control file (jmxremote.access by default) defines the allowed
+# access for each role. To be functional, a role must have an entry
+# in both the password and the access files.
+#
+# Default location of this file is $JRE/lib/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/lib/management/management.properties
+# or by specifying a system property (See that file for details).
+
+
+##############################################################
+# File permissions of the jmxremote.password file
+##############################################################
+# Since there are cleartext passwords stored in this file,
+# this file must be readable by ONLY the owner,
+# otherwise the program will exit with an error.
+#
+# The file format for password and access files is syntactically the same
+# as the Properties file format. The syntax is described in the Javadoc
+# for java.util.Properties.load.
+# Typical password file has multiple lines, where each line is blank,
+# a comment (like this one), or a password entry.
+#
+#
+# A password entry consists of a role name and an associated
+# password. The role name is any string that does not itself contain
+# spaces or tabs. The password is again any string that does not
+# contain spaces or tabs. Note that passwords appear in the clear in
+# this file, so it is a good idea not to use valuable passwords.
+#
+# A given role should have at most one entry in this file. If a role
+# has no entry, it has no access.
+# If multiple entries are found for the same role name, then the last one
+# is used.
+#
+# In a typical installation, this file can be read by anybody on the
+# local machine, and possibly by people on other machines.
+# For # security, you should either restrict the access to this file,
+# or specify another, less accessible file in the management config file
+# as described above.
+#
+# Following are two commented-out entries. The "measureRole" role has
+# password "QED". The "controlRole" role has password "R&D".
+#
+# monitorRole QED
+# controlRole R&D
+
+guest guestpasswd
+admin adminpasswd
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml
new file mode 100644
index 0000000..cf0fece
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/src/etc/testconfig.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<ScanManager xmlns="jmx:com.sun.jmx.examples.scandir.config" name="testconfig">
+ <InitialResultLogConfig>
+ <LogFileMaxRecords>2048</LogFileMaxRecords>
+ <LogFileName>build/scandir.log</LogFileName>
+ <MemoryMaxRecords>128</MemoryMaxRecords>
+ </InitialResultLogConfig>
+ <DirectoryScannerList>
+ <DirectoryScanner name="scan-build">
+ <Actions>NOTIFY LOGRESULT</Actions>
+ <ExcludeFiles/>
+ <IncludeFiles>
+ <FileFilter>
+ <FilePattern>.*\.class</FilePattern>
+ <SizeExceedsMaxBytes>4096</SizeExceedsMaxBytes>
+ </FileFilter>
+ </IncludeFiles>
+ <RootDirectory>build</RootDirectory>
+ </DirectoryScanner>
+ </DirectoryScannerList>
+</ScanManager>
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java
new file mode 100644
index 0000000..06d1559
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/DirectoryScannerTest.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ResultRecord;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.util.LinkedList;
+import java.util.concurrent.BlockingQueue;
+import junit.framework.*;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import com.sun.jmx.examples.scandir.ScanManagerTest.Call;
+import java.util.EnumSet;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import javax.management.AttributeChangeNotification;
+import javax.management.Notification;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+
+import static com.sun.jmx.examples.scandir.ScanManagerTest.*;
+import static com.sun.jmx.examples.scandir.TestUtils.*;
+import java.io.File;
+import java.lang.management.ManagementFactory;
+import java.util.List;
+
+/**
+ * Unit tests for {@code DirectoryScanner}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class DirectoryScannerTest extends TestCase {
+
+ public DirectoryScannerTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(DirectoryScannerTest.class);
+
+ return suite;
+ }
+
+ private void doTestOperation(
+ DirectoryScannerMXBean proxy,
+ Call op,
+ EnumSet<ScanState> after,
+ String testName)
+ throws Exception {
+ System.out.println("doTestOperation: "+testName);
+
+ final LinkedBlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+
+ NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ queue.put(notification);
+ } catch (Exception x) {
+ System.err.println("Failed to queue notif: "+x);
+ }
+ }
+ };
+ NotificationFilter filter = null;
+ Object handback = null;
+ final ScanState before;
+ final NotificationEmitter emitter = (NotificationEmitter)
+ makeNotificationEmitter(proxy,DirectoryScannerMXBean.class);
+ emitter.addNotificationListener(listener, filter, handback);
+ before = proxy.getState();
+ op.call();
+ try {
+ final Notification notification =
+ queue.poll(3000,TimeUnit.MILLISECONDS);
+ assertEquals(AttributeChangeNotification.ATTRIBUTE_CHANGE,
+ notification.getType());
+ assertEquals(AttributeChangeNotification.class,
+ notification.getClass());
+ assertEquals(getObjectName(proxy),
+ notification.getSource());
+ AttributeChangeNotification acn =
+ (AttributeChangeNotification)notification;
+ assertEquals("State",acn.getAttributeName());
+ assertEquals(ScanState.class.getName(),acn.getAttributeType());
+ assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
+ assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
+ emitter.removeNotificationListener(listener,filter,handback);
+ } finally {
+ try {
+ op.cancel();
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+
+ /**
+ * Test of getRootDirectory method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testGetRootDirectory() throws Exception {
+ System.out.println("getRootDirectory");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ final String tmpdir = System.getProperty("java.io.tmpdir");
+ final ScanDirConfigMXBean config = manager.getConfigurationMBean();
+ System.err.println("Configuration MXBean is: " + config);
+ final DirectoryScannerConfig bean =
+ config.addDirectoryScanner("test",tmpdir,".*",0,0);
+ final String root = bean.getRootDirectory();
+ if (root == null)
+ throw new NullPointerException("bean.getRootDirectory()");
+ if (config.getConfiguration().getScan("test").getRootDirectory() == null)
+ throw new NullPointerException("config.getConfig().getScan(\"test\").getRootDirectory()");
+ manager.applyConfiguration(true);
+ final DirectoryScannerMXBean proxy =
+ manager.getDirectoryScanners().get("test");
+ final File tmpFile = new File(tmpdir);
+ final File rootFile = new File(proxy.getRootDirectory());
+ assertEquals(tmpFile,rootFile);
+ } catch (Exception x) {
+ x.printStackTrace();
+ throw x;
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+
+ /**
+ * Test of scan method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testScan() throws Exception {
+ System.out.println("scan");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ final String tmpdir = System.getProperty("java.io.tmpdir");
+ final ScanDirConfigMXBean config = manager.getConfigurationMBean();
+ final DirectoryScannerConfig bean =
+ config.addDirectoryScanner("test1",tmpdir,".*",0,0);
+ config.addDirectoryScanner("test2",tmpdir,".*",0,0);
+ config.addDirectoryScanner("test3",tmpdir,".*",0,0);
+ manager.applyConfiguration(true);
+ final DirectoryScannerMXBean proxy =
+ manager.getDirectoryScanners().get("test1");
+ final Call op = new Call() {
+ public void call() throws Exception {
+ final BlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+ final NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ queue.put(notification);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+ manager.start();
+ while(true) {
+ final Notification n = queue.poll(10,TimeUnit.SECONDS);
+ if (n == null) break;
+ final AttributeChangeNotification at =
+ (AttributeChangeNotification) n;
+ if (RUNNING == ScanState.valueOf((String)at.getNewValue()))
+ break;
+ else {
+ System.err.println("New state: "+(String)at.getNewValue()
+ +" isn't "+RUNNING);
+ }
+ }
+ assertContained(EnumSet.of(SCHEDULED,RUNNING,COMPLETED),
+ proxy.getState());
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ doTestOperation(proxy,op,
+ EnumSet.of(RUNNING,SCHEDULED,COMPLETED),
+ "scan");
+ } catch (Exception x) {
+ x.printStackTrace();
+ throw x;
+ } finally {
+ try {
+ manager.stop();
+ } catch (Exception x) {
+ System.err.println("Failed to stop: "+x);
+ }
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of getState method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testGetState() {
+ System.out.println("getState");
+
+ final DirectoryScannerConfig bean =
+ new DirectoryScannerConfig("test");
+ bean.setRootDirectory(System.getProperty("java.io.tmpdir"));
+ final ResultLogManager log = new ResultLogManager();
+ DirectoryScanner instance =
+ new DirectoryScanner(bean,log);
+
+ ScanState expResult = STOPPED;
+ ScanState result = instance.getState();
+ assertEquals(STOPPED, result);
+ instance.scan();
+ result = instance.getState();
+ assertEquals(COMPLETED, result);
+ }
+
+ /**
+ * Test of addNotificationListener method, of class com.sun.jmx.examples.scandir.DirectoryScanner.
+ */
+ public void testAddNotificationListener() throws Exception {
+ System.out.println("addNotificationListener");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.start();
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ try {
+ final String tmpdir = System.getProperty("java.io.tmpdir");
+ final ScanDirConfigMXBean config = manager.getConfigurationMBean();
+ final DirectoryScannerConfig bean =
+ config.addDirectoryScanner("test1",tmpdir,".*",0,0);
+ manager.applyConfiguration(true);
+ final DirectoryScannerMXBean proxy =
+ manager.getDirectoryScanners().get("test1");
+ doTestOperation(proxy,op,
+ EnumSet.of(RUNNING,SCHEDULED),
+ "scan");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java
new file mode 100644
index 0000000..c7e9599
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanDirConfigTest.java
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import com.sun.jmx.examples.scandir.config.XmlConfigUtils;
+import com.sun.jmx.examples.scandir.config.FileMatch;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import junit.framework.*;
+import com.sun.jmx.examples.scandir.config.DirectoryScannerConfig;
+import com.sun.jmx.examples.scandir.config.ScanManagerConfig;
+import java.io.File;
+import java.util.concurrent.BlockingQueue;
+import javax.management.*;
+
+/**
+ * Unit tests for {@code ScanDirConfig}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanDirConfigTest extends TestCase {
+
+ public ScanDirConfigTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ScanDirConfigTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of load method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testLoad() throws Exception {
+ System.out.println("load");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testLoad");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ bean.putScan(dir);
+ XmlConfigUtils.write(bean,new FileOutputStream(file),false);
+ instance.load();
+
+ assertEquals(bean,instance.getConfiguration());
+ bean.removeScan(dir.getName());
+ XmlConfigUtils.write(bean,new FileOutputStream(file),false);
+
+ assertNotSame(bean,instance.getConfiguration());
+
+ instance.load();
+
+ assertEquals(bean,instance.getConfiguration());
+
+ }
+
+ /**
+ * Test of save method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testSave() throws Exception {
+ System.out.println("save");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ final ScanManagerMXBean manager = ScanManager.register(mbs);
+
+ try {
+ final ScanDirConfigMXBean instance =
+ manager.createOtherConfigurationMBean("testSave",file.getAbsolutePath());
+ assertTrue(mbs.isRegistered(
+ ScanManager.makeScanDirConfigName("testSave")));
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testSave");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ bean.putScan(dir);
+ instance.setConfiguration(bean);
+ instance.save();
+ final ScanManagerConfig loaded =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded);
+ assertEquals(bean,loaded);
+
+ instance.getConfiguration().removeScan("tmp");
+ instance.save();
+ assertNotSame(loaded,instance.getConfiguration());
+ final ScanManagerConfig loaded2 =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded2);
+ } finally {
+ manager.close();
+ mbs.unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ }
+ final ObjectName all =
+ new ObjectName(ScanManager.SCAN_MANAGER_NAME.getDomain()+":*");
+ assertEquals(0,mbs.queryNames(all,null).size());
+ }
+
+ /**
+ * Test of saveTo method, of class com.sun.jmx.examples.scandir.ScanProfile.
+ */
+ /*
+ public void testSaveTo() throws Exception {
+ System.out.println("saveTo");
+
+ String filename = "";
+ ScanDirConfig instance = null;
+
+ instance.saveTo(filename);
+
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+ */
+
+ /**
+ * Test of getXmlConfigString method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testGetXmlConfigString() throws Exception {
+ System.out.println("getXmlConfigString");
+
+ try {
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testGetXmlConfigString");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ bean.putScan(dir);
+ instance.setConfiguration(bean);
+ System.out.println("Expected: " + XmlConfigUtils.toString(bean));
+ System.out.println("Received: " +
+ instance.getConfiguration().toString());
+ assertEquals(XmlConfigUtils.toString(bean),
+ instance.getConfiguration().toString());
+ } catch (Exception x) {
+ x.printStackTrace();
+ throw x;
+ }
+ }
+
+
+ /**
+ * Test of addNotificationListener method, of class
+ * com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testAddNotificationListener() throws Exception {
+ System.out.println("addNotificationListener");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+ final ScanManagerMXBean manager = ScanManager.register(mbs);
+
+ try {
+ final ScanDirConfigMXBean instance =
+ TestUtils.makeNotificationEmitter(
+ manager.createOtherConfigurationMBean("testSave",
+ file.getAbsolutePath()),
+ ScanDirConfigMXBean.class);
+ assertTrue(mbs.isRegistered(
+ ScanManager.makeScanDirConfigName("testSave")));
+ DirectoryScannerConfig dir =
+ instance.addDirectoryScanner("tmp",file.getParent(),".*",0,0);
+
+ final BlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+ final NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ queue.add(notification);
+ }
+ };
+ NotificationFilter filter = null;
+ Object handback = null;
+
+ ((NotificationEmitter)instance).addNotificationListener(listener,
+ filter, handback);
+
+ instance.save();
+ final ScanManagerConfig loaded =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded);
+
+ final ScanManagerConfig newConfig =
+ instance.getConfiguration();
+ newConfig.removeScan("tmp");
+ instance.setConfiguration(newConfig);
+ instance.save();
+ assertNotSame(loaded,instance.getConfiguration());
+ final ScanManagerConfig loaded2 =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertEquals(instance.getConfiguration(),loaded2);
+ instance.load();
+ for (int i=0;i<4;i++) {
+ final Notification n = queue.poll(3,TimeUnit.SECONDS);
+ assertNotNull(n);
+ assertEquals(TestUtils.getObjectName(instance),n.getSource());
+ switch(i) {
+ case 0: case 2:
+ assertEquals(ScanDirConfig.NOTIFICATION_SAVED,n.getType());
+ break;
+ case 1:
+ assertEquals(ScanDirConfig.NOTIFICATION_MODIFIED,n.getType());
+ break;
+ case 3:
+ assertEquals(ScanDirConfig.NOTIFICATION_LOADED,n.getType());
+ break;
+ default: break;
+ }
+ }
+ } finally {
+ manager.close();
+ mbs.unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ }
+ final ObjectName all =
+ new ObjectName(ScanManager.SCAN_MANAGER_NAME.getDomain()+":*");
+ assertEquals(0,mbs.queryNames(all,null).size());
+ }
+
+ /**
+ * Test of getConfigFilename method, of class
+ * com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testGetConfigFilename() throws Exception {
+ System.out.println("getConfigFilename");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+
+ String result = instance.getConfigFilename();
+ assertEquals(file.getAbsolutePath(), new File(result).getAbsolutePath());
+
+ }
+
+ /**
+ * Test of addDirectoryScanner method, of class
+ * com.sun.jmx.examples.scandir.ScanDirConfig.
+ */
+ public void testAddDirectoryScanner() throws IOException {
+ System.out.println("addDirectoryScanner");
+
+ System.out.println("save");
+
+ final File file = File.createTempFile("testconf",".xml");
+ final ScanDirConfig instance = new ScanDirConfig(file.getAbsolutePath());
+ final ScanManagerConfig bean =
+ new ScanManagerConfig("testSave");
+ final DirectoryScannerConfig dir =
+ new DirectoryScannerConfig("tmp");
+ dir.setRootDirectory(file.getParent());
+ FileMatch filter = new FileMatch();
+ filter.setFilePattern(".*");
+ dir.setIncludeFiles(new FileMatch[] {
+ filter
+ });
+ instance.setConfiguration(bean);
+ instance.addDirectoryScanner(dir.getName(),
+ dir.getRootDirectory(),
+ filter.getFilePattern(),
+ filter.getSizeExceedsMaxBytes(),
+ 0);
+ instance.save();
+ final ScanManagerConfig loaded =
+ new XmlConfigUtils(file.getAbsolutePath()).readFromFile();
+ assertNotNull(loaded.getScan(dir.getName()));
+ assertEquals(dir,loaded.getScan(dir.getName()));
+ assertEquals(instance.getConfiguration(),loaded);
+ assertEquals(instance.getConfiguration().getScan(dir.getName()),dir);
+ }
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java
new file mode 100644
index 0000000..94e3c98
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/ScanManagerTest.java
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import javax.management.InstanceNotFoundException;
+import javax.management.Notification;
+import junit.framework.*;
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+import com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.logging.Logger;
+import javax.management.AttributeChangeNotification;
+import javax.management.JMException;
+import javax.management.JMX;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+
+import static com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState.*;
+
+/**
+ * Unit tests for {@code ScanManager}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class ScanManagerTest extends TestCase {
+
+ public ScanManagerTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ScanManagerTest.class);
+
+ return suite;
+ }
+
+ /**
+ * Test of makeSingletonName method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testMakeSingletonName() {
+ System.out.println("makeSingletonName");
+
+ Class clazz = ScanManagerMXBean.class;
+
+ ObjectName expResult = ScanManager.SCAN_MANAGER_NAME;
+ ObjectName result = ScanManager.makeSingletonName(clazz);
+ assertEquals(expResult, result);
+
+ }
+
+ /**
+ * Test of register method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testRegister() throws Exception {
+ System.out.println("register");
+
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+
+
+ ScanManagerMXBean result = ScanManager.register(mbs);
+ try {
+ assertEquals(STOPPED,result.getState());
+ } finally {
+ try {
+ mbs.unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+
+ }
+
+ public interface Call {
+ public void call() throws Exception;
+ public void cancel() throws Exception;
+ }
+
+ /**
+ * Test of addNotificationListener method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testAddNotificationListener() throws Exception {
+ System.out.println("addNotificationListener");
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.schedule(100000,0);
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ try {
+ doTestOperation(manager,op,
+ EnumSet.of(RUNNING,SCHEDULED),
+ "schedule");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of addNotificationListener method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ private void doTestOperation(
+ ScanManagerMXBean proxy,
+ Call op,
+ EnumSet<ScanState> after,
+ String testName)
+ throws Exception {
+ System.out.println("doTestOperation: "+testName);
+
+ final LinkedBlockingQueue<Notification> queue =
+ new LinkedBlockingQueue<Notification>();
+
+ NotificationListener listener = new NotificationListener() {
+ public void handleNotification(Notification notification,
+ Object handback) {
+ try {
+ queue.put(notification);
+ } catch (Exception x) {
+ System.err.println("Failed to queue notif: "+x);
+ }
+ }
+ };
+ NotificationFilter filter = null;
+ Object handback = null;
+ final ScanState before;
+ final NotificationEmitter emitter = (NotificationEmitter)proxy;
+ emitter.addNotificationListener(listener, filter, handback);
+ before = proxy.getState();
+ op.call();
+ try {
+ final Notification notification =
+ queue.poll(3000,TimeUnit.MILLISECONDS);
+ assertEquals(AttributeChangeNotification.ATTRIBUTE_CHANGE,
+ notification.getType());
+ assertEquals(AttributeChangeNotification.class,
+ notification.getClass());
+ assertEquals(ScanManager.SCAN_MANAGER_NAME,
+ notification.getSource());
+ AttributeChangeNotification acn =
+ (AttributeChangeNotification)notification;
+ assertEquals("State",acn.getAttributeName());
+ assertEquals(ScanState.class.getName(),acn.getAttributeType());
+ assertEquals(before,ScanState.valueOf((String)acn.getOldValue()));
+ assertContained(after,ScanState.valueOf((String)acn.getNewValue()));
+ emitter.removeNotificationListener(listener,filter,handback);
+ } finally {
+ try {
+ op.cancel();
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of preRegister method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testPreRegister() throws Exception {
+ System.out.println("preRegister");
+
+ MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ ObjectName name = new ObjectName("DownUnder:type=Wombat");
+ ScanManager instance = new ScanManager();
+
+ ObjectName expResult = ScanManager.SCAN_MANAGER_NAME;
+ ObjectName result;
+ try {
+ result = instance.preRegister(server, name);
+ throw new RuntimeException("bad name accepted!");
+ } catch (IllegalArgumentException x) {
+ // OK!
+ result = instance.preRegister(server, null);
+ }
+ assertEquals(expResult, result);
+ result = instance.preRegister(server, ScanManager.SCAN_MANAGER_NAME);
+ assertEquals(expResult, result);
+ }
+
+
+ /**
+ * Test of getState method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testGetState() throws IOException, InstanceNotFoundException {
+ System.out.println("getState");
+
+ ScanManager instance = new ScanManager();
+
+ ScanState expResult = ScanState.STOPPED;
+ ScanState result = instance.getState();
+ assertEquals(expResult, result);
+ instance.start();
+ final ScanState afterStart = instance.getState();
+ assertContained(EnumSet.of(RUNNING,SCHEDULED,COMPLETED),afterStart);
+ instance.stop();
+ assertEquals(STOPPED,instance.getState());
+ instance.schedule(1000000L,1000000L);
+ assertEquals(SCHEDULED,instance.getState());
+ instance.stop();
+ assertEquals(STOPPED,instance.getState());
+ }
+
+ /**
+ * Test of schedule method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testSchedule() throws Exception {
+ System.out.println("schedule");
+
+ final long delay = 10000L;
+ final long interval = 10000L;
+
+ final ScanManagerMXBean manager = ScanManager.register();
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.schedule(delay,interval);
+ assertEquals(SCHEDULED,manager.getState());
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ try {
+ doTestOperation(manager,op,EnumSet.of(SCHEDULED),
+ "schedule");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ public static void assertContained(EnumSet<ScanState> allowed,
+ ScanState state) {
+ final String msg = String.valueOf(state) + " is not one of " + allowed;
+ assertTrue(msg,allowed.contains(state));
+ }
+
+ /**
+ * Test of stop method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testStop() throws Exception {
+ System.out.println("stop");
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ manager.schedule(1000000,0);
+ assertContained(EnumSet.of(SCHEDULED),manager.getState());
+ final Call op = new Call() {
+ public void call() throws Exception {
+ manager.stop();
+ assertEquals(STOPPED,manager.getState());
+ }
+ public void cancel() throws Exception {
+ if (manager.getState() != STOPPED)
+ manager.stop();
+ }
+ };
+ doTestOperation(manager,op,EnumSet.of(STOPPED),"stop");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+ /**
+ * Test of start method, of class com.sun.jmx.examples.scandir.ScanManager.
+ */
+ public void testStart() throws Exception {
+ final ScanManagerMXBean manager = ScanManager.register();
+ try {
+ final Call op = new Call() {
+ public void call() throws Exception {
+ assertEquals(STOPPED,manager.getState());
+ manager.start();
+ assertContained(EnumSet.of(RUNNING,SCHEDULED,COMPLETED),
+ manager.getState());
+ }
+ public void cancel() throws Exception {
+ manager.stop();
+ }
+ };
+ doTestOperation(manager,op,EnumSet.of(RUNNING,SCHEDULED,COMPLETED),
+ "start");
+ } finally {
+ try {
+ ManagementFactory.getPlatformMBeanServer().
+ unregisterMBean(ScanManager.SCAN_MANAGER_NAME);
+ } catch (Exception x) {
+ System.err.println("Failed to cleanup: "+x);
+ }
+ }
+ }
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java
new file mode 100644
index 0000000..4832949
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/TestUtils.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.logging.Logger;
+import javax.management.JMX;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.NotificationEmitter;
+import javax.management.ObjectName;
+
+/**
+ * A utility class defining static methods used by our tests.
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class TestUtils {
+
+ /**
+ * A logger for this class.
+ **/
+ private static final Logger LOG =
+ Logger.getLogger(TestUtils.class.getName());
+
+ /** Creates a new instance of TestUtils */
+ private TestUtils() {
+ }
+
+ /**
+ * Returns the ObjectName of the MBean that a proxy object
+ * is proxying.
+ **/
+ public static ObjectName getObjectName(Object proxy) {
+ if (!(proxy instanceof Proxy))
+ throw new IllegalArgumentException("not a "+Proxy.class.getName());
+ final Proxy p = (Proxy) proxy;
+ final InvocationHandler handler =
+ Proxy.getInvocationHandler(proxy);
+ if (handler instanceof MBeanServerInvocationHandler)
+ return ((MBeanServerInvocationHandler)handler).getObjectName();
+ throw new IllegalArgumentException("not a JMX Proxy");
+ }
+
+ /**
+ * Transfroms a proxy implementing T in a proxy implementing T plus
+ * NotificationEmitter
+ *
+ **/
+ public static <T> T makeNotificationEmitter(T proxy,
+ Class<T> mbeanInterface) {
+ if (proxy instanceof NotificationEmitter)
+ return proxy;
+ if (proxy == null) return null;
+ if (!(proxy instanceof Proxy))
+ throw new IllegalArgumentException("not a "+Proxy.class.getName());
+ final Proxy p = (Proxy) proxy;
+ final InvocationHandler handler =
+ Proxy.getInvocationHandler(proxy);
+ if (!(handler instanceof MBeanServerInvocationHandler))
+ throw new IllegalArgumentException("not a JMX Proxy");
+ final MBeanServerInvocationHandler h =
+ (MBeanServerInvocationHandler)handler;
+ final ObjectName name = h.getObjectName();
+ final MBeanServerConnection mbs = h.getMBeanServerConnection();
+ final boolean isMXBean = h.isMXBean();
+ final T newProxy;
+ if (isMXBean)
+ newProxy = JMX.newMXBeanProxy(mbs,name,mbeanInterface,true);
+ else
+ newProxy = JMX.newMBeanProxy(mbs,name,mbeanInterface,true);
+ return newProxy;
+ }
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java
new file mode 100644
index 0000000..e4cea49
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/test/com/sun/jmx/examples/scandir/config/XmlConfigUtilsTest.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.jmx.examples.scandir.config;
+
+import junit.framework.*;
+import java.io.File;
+
+/**
+ * Unit tests for {@code XmlConfigUtils}
+ *
+ * @author Sun Microsystems, 2006 - All rights reserved.
+ */
+public class XmlConfigUtilsTest extends TestCase {
+
+ public XmlConfigUtilsTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ protected void tearDown() throws Exception {
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(XmlConfigUtilsTest.class);
+
+ return suite;
+ }
+
+
+ /**
+ * Test of writeToFile method, of class XmlConfigUtils.
+ */
+ public void testWriteToFile() throws Exception {
+ System.out.println("writeToFile");
+
+ final File file = File.createTempFile("test",".xml");
+ file.deleteOnExit();
+
+ final String tmp = System.getProperty("java.io.tmpdir");
+
+ DirectoryScannerConfig dir1 =
+ new DirectoryScannerConfig("scan2");
+ dir1.setRootDirectory(tmp);
+ ScanManagerConfig bean = new ScanManagerConfig("session2");
+ bean.putScan(dir1);
+ XmlConfigUtils instance = new XmlConfigUtils(file.getPath());
+
+ instance.writeToFile(bean);
+ }
+
+ /**
+ * Test of readFromFile method, of class com.sun.jmx.examples.scandir.config.XmlConfigUtils.
+ */
+ public void testReadFromFile() throws Exception {
+ System.out.println("readFromFile");
+
+ final String tmp = System.getProperty("java.io.tmpdir");
+ final File file = File.createTempFile("test",".xml");
+ file.deleteOnExit();
+
+ DirectoryScannerConfig dir1 =
+ new DirectoryScannerConfig("scan1");
+ dir1.setRootDirectory(tmp);
+ ScanManagerConfig bean = new ScanManagerConfig("session1");
+ bean.putScan(dir1);
+ XmlConfigUtils instance = new XmlConfigUtils(file.getPath());
+
+ instance.writeToFile(bean);
+
+ ScanManagerConfig expResult = bean;
+ ScanManagerConfig result = instance.readFromFile();
+ System.out.println(result);
+ assertEquals(expResult, result);
+
+
+ }
+
+}
diff --git a/staging/linux-x86/sample/jmx/jmx-scandir/truststore b/staging/linux-x86/sample/jmx/jmx-scandir/truststore
new file mode 100644
index 0000000..2f5ba34
--- /dev/null
+++ b/staging/linux-x86/sample/jmx/jmx-scandir/truststore
Binary files differ
diff --git a/staging/linux-x86/sample/lambda/BulkDataOperations/index.html b/staging/linux-x86/sample/lambda/BulkDataOperations/index.html
new file mode 100644
index 0000000..5a16695
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/BulkDataOperations/index.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Bulk Data Operations Demo</title>
+</head>
+<body>
+<h2>Bulk Data Operations Demo</h2>
+
+<p>
+ This demo shows how to use bulk data operations with the new JDK8
+ Collections API.
+ The demo also demonstrates new features of JDK8 such as lambda expressions
+ and method/constructor references.
+</p>
+
+<ul>
+ <li><h3>CSV Processor</h3>
+
+ <p>
+ Analyzes a CSV file, finds and collects useful information, computes
+ different statistics. For more information, see the source file.
+ </p>
+ Source: <a href="src/CSVProcessor.java">src/CSVProcessor.java</a>
+ <li><h3>Grep</h3>
+
+ <p>
+ Behaves like the standard Linux tool Grep. For more information, see
+ the source file.
+ </p>
+ Source: <a href="src/Grep.java">src/Grep.java</a>
+ <li><h3>PasswordGenerator</h3>
+
+ <p>
+ Produces a password of desired length. For more information see
+ source file.
+ </p>
+ Source: <a
+ href="src/PasswordGenerator.java">src/PasswordGenerator.java</a>
+ <li><h3>WC</h3>
+
+ <p>
+ Counts newlines, words, characters, and the maximum line length of a
+ text file. For more information, see the source
+ file.
+ </p>
+ Source: <a href="src/WC.java">src/WC.java</a>
+</ul>
+</body>
+</html> \ No newline at end of file
diff --git a/staging/linux-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java b/staging/linux-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java
new file mode 100644
index 0000000..ded9030
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/BulkDataOperations/src/CSVProcessor.java
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.function.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+
+import static java.lang.Double.parseDouble;
+import static java.util.stream.Collectors.*;
+
+/**
+ * CSVProcessor is a tool for processing CSV files. There are several
+ * command-line options. Consult the {@link #printUsageAndExit} method for
+ * instructions and command line parameters. This sample shows examples of the
+ * following features:
+ * <ul>
+ * <li>Lambda and bulk operations. Working with streams: map(...), filter(...),
+ * sorted(...) methods. The collect(...) method with different collectors:
+ * Collectors.maxBy(...), Collectors.minBy(...), Collectors.toList(),
+ * Collectors.toCollection(...), Collectors.groupingBy(...),
+ * Collectors.toDoubleSummaryStatistics(...), and a custom Collector.</li>
+ * <li>Static method reference for printing values.</li>
+ * <li>Try-with-resources feature for closing files.</li>
+ * <li>Switch by String feature.</li>
+ * <li>Other new APIs: Pattern.asPredicate(), BinaryOperator
+ * BufferedReader.lines(), Collection.forEach(...), Comparator.comparing(...),
+ * Comparator.reversed(), Arrays.stream(...).</li>
+ * </ul>
+ *
+ */
+public class CSVProcessor {
+
+ //Number of characters that may be read
+ private static final int READ_AHEAD_LIMIT = 100_000_000;
+
+ /**
+ * The main method for the CSVProcessor program. Run the program with an
+ * empty argument list to see possible arguments.
+ *
+ * @param args the argument list for CSVProcessor.
+ */
+ public static void main(String[] args) {
+ if (args.length < 2) {
+ printUsageAndExit();
+ }
+ try (BufferedReader br = new BufferedReader(
+ Files.newBufferedReader(Paths.get(args[args.length - 1])))) {
+ //Assume that the first line contains column names.
+ List<String> header = Arrays.stream(br.readLine().split(","))
+ .map(String::trim).collect(toList());
+ //Calculate an index of the column in question.
+ int column = getColumnNumber(header, args[1]);
+ switch (args[0]) {
+ case "sort":
+ verifyArgumentNumber(args, 4);
+ //Define the sort order.
+ boolean isAsc;
+ switch (args[2].toUpperCase()) {
+ case "ASC":
+ isAsc = true;
+ break;
+ case "DESC":
+ isAsc = false;
+ break;
+ default:
+ printUsageAndExit("Illegal argument" + args[2]);
+ return;//Should not be reached.
+ }
+ /*
+ * Create a comparator that compares lines by comparing
+ * values in the specified column.
+ */
+ Comparator<String> cmp
+ = Comparator.comparing(str -> getCell(str, column),
+ String.CASE_INSENSITIVE_ORDER);
+ /*
+ * sorted(...) is used to sort records.
+ * forEach(...) is used to output sorted records.
+ */
+ br.lines().sorted(isAsc ? cmp : cmp.reversed())
+ .forEach(System.out::println);
+ break;
+ case "search":
+ verifyArgumentNumber(args, 4);
+ /*
+ * Records are filtered by a regex.
+ * forEach(...) is used to output filtered records.
+ */
+ Predicate<String> pattern
+ = Pattern.compile(args[2]).asPredicate();
+ br.lines().filter(str -> pattern.test(getCell(str, column)))
+ .forEach(System.out::println);
+ break;
+ case "groupby":
+ verifyArgumentNumber(args, 3);
+ /*
+ * Group lines by values in the column with collect(...), and
+ * print with forEach(...) for every distinct value within
+ * the column.
+ */
+ br.lines().collect(
+ Collectors.groupingBy(str -> getCell(str, column),
+ toCollection(TreeSet::new)))
+ .forEach((str, set) -> {
+ System.out.println(str + ":");
+ set.forEach(System.out::println);
+ });
+ break;
+ case "stat":
+ verifyArgumentNumber(args, 3);
+
+ /*
+ * BufferedReader will be read several times.
+ * Mark this point to return here after each pass.
+ * BufferedReader will be read right after the headers line
+ * because it is already read.
+ */
+ br.mark(READ_AHEAD_LIMIT);
+
+ /*
+ * Statistics can be collected by a custom collector in one
+ * pass. One pass is preferable.
+ */
+ System.out.println(
+ br.lines().collect(new Statistics(column)));
+
+ /*
+ * Alternatively, statistics can be collected
+ * by a built-in API in several passes.
+ * This method demonstrates how separate operations can be
+ * implemented using a built-in API.
+ */
+ br.reset();
+ statInSeveralPasses(br, column);
+ break;
+ default:
+ printUsageAndExit("Illegal argument" + args[0]);
+ }
+ } catch (IOException e) {
+ printUsageAndExit(e.toString());
+ }
+ }
+
+ private static void statInSeveralPasses(BufferedReader br, int column)
+ throws IOException {
+ System.out.println("#-----Statistics in several passes-------#");
+ //Create a comparator to compare records by the column.
+ Comparator<String> comparator
+ = Comparator.comparing(
+ (String str) -> parseDouble(getCell(str, column)));
+ //Find max record by using Collectors.maxBy(...)
+ System.out.println(
+ "Max: " + br.lines().collect(maxBy(comparator)).get());
+ br.reset();
+ //Find min record by using Collectors.minBy(...)
+ System.out.println(
+ "Min: " + br.lines().collect(minBy(comparator)).get());
+ br.reset();
+ //Compute the average value and sum with
+ //Collectors.toDoubleSummaryStatistics(...)
+ DoubleSummaryStatistics doubleSummaryStatistics
+ = br.lines().collect(summarizingDouble(
+ str -> parseDouble(getCell(str, column))));
+ System.out.println("Average: " + doubleSummaryStatistics.getAverage());
+ System.out.println("Sum: " + doubleSummaryStatistics.getSum());
+ }
+
+ private static void verifyArgumentNumber(String[] args, int n) {
+ if (args.length != n) {
+ printUsageAndExit("Expected " + n + " arguments but was "
+ + args.length);
+ }
+ }
+
+ private static int getColumnNumber(List<String> header, String name) {
+ int column = header.indexOf(name);
+ if (column == -1) {
+ printUsageAndExit("There is no column with name " + name);
+ }
+ return column;
+ }
+
+ private static String getCell(String record, int column) {
+ return record.split(",")[column].trim();
+ }
+
+ private static void printUsageAndExit(String... str) {
+ System.out.println("Usages:");
+
+ System.out.println("CSVProcessor sort COLUMN_NAME ASC|DESC FILE");
+ System.out.println("Sort lines by column COLUMN_NAME in CSV FILE\n");
+
+ System.out.println("CSVProcessor search COLUMN_NAME REGEX FILE");
+ System.out.println("Search for REGEX in column COLUMN_NAME in CSV FILE\n");
+
+ System.out.println("CSVProcessor groupby COLUMN_NAME FILE");
+ System.out.println("Split lines into different groups according to column "
+ + "COLUMN_NAME value\n");
+
+ System.out.println("CSVProcessor stat COLUMN_NAME FILE");
+ System.out.println("Compute max/min/average/sum statistics by column "
+ + "COLUMN_NAME\n");
+
+ Arrays.asList(str).forEach(System.err::println);
+ System.exit(1);
+ }
+
+ /*
+ * This is a custom implementation of the Collector interface.
+ * Statistics are objects gather max,min,sum,average statistics.
+ */
+ private static class Statistics
+ implements Collector<String, Statistics, Statistics> {
+
+
+ /*
+ * This implementation does not need to be thread safe because
+ * the parallel implementation of
+ * {@link java.util.stream.Stream#collect Stream.collect()}
+ * provides the necessary partitioning and isolation for safe parallel
+ * execution.
+ */
+ private String maxRecord;
+ private String minRecord;
+
+ private double sum;
+ private int lineCount;
+ private final BinaryOperator<String> maxOperator;
+ private final BinaryOperator<String> minOperator;
+ private final int column;
+
+ public Statistics(int column) {
+ this.column = column;
+ Comparator<String> cmp = Comparator.comparing(
+ (String str) -> parseDouble(getCell(str, column)));
+ maxOperator = BinaryOperator.maxBy(cmp);
+ minOperator = BinaryOperator.minBy(cmp);
+ }
+
+ /*
+ * Process line.
+ */
+ public Statistics accept(String line) {
+ maxRecord = maxRecord == null
+ ? line : maxOperator.apply(maxRecord, line);
+ minRecord = minRecord == null
+ ? line : minOperator.apply(minRecord, line);
+
+ sum += parseDouble(getCell(line, column));
+ lineCount++;
+ return this;
+ }
+
+
+ /*
+ * Merge two Statistics.
+ */
+ public Statistics combine(Statistics stat) {
+ maxRecord = maxOperator.apply(maxRecord, stat.getMaxRecord());
+ minRecord = minOperator.apply(minRecord, stat.getMinRecord());
+ sum += stat.getSum();
+ lineCount += stat.getLineCount();
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("#------Statistics------#\n");
+ sb.append("Max: ").append(getMaxRecord()).append("\n");
+ sb.append("Min: ").append(getMinRecord()).append("\n");
+ sb.append("Sum = ").append(getSum()).append("\n");
+ sb.append("Average = ").append(average()).append("\n");
+ sb.append("#------Statistics------#\n");
+ return sb.toString();
+ }
+
+ @Override
+ public Supplier<Statistics> supplier() {
+ return () -> new Statistics(column);
+ }
+
+ @Override
+ public BiConsumer<Statistics, String> accumulator() {
+ return Statistics::accept;
+ }
+
+ @Override
+ public BinaryOperator<Statistics> combiner() {
+ return Statistics::combine;
+
+ }
+
+ @Override
+ public Function<Statistics, Statistics> finisher() {
+ return stat -> stat;
+ }
+
+ @Override
+ public Set<Characteristics> characteristics() {
+ return EnumSet.of(Characteristics.IDENTITY_FINISH);
+ }
+
+ private String getMaxRecord() {
+ return maxRecord;
+ }
+
+ private String getMinRecord() {
+ return minRecord;
+ }
+
+ private double getSum() {
+ return sum;
+ }
+
+ private double average() {
+ return sum / lineCount;
+ }
+
+ private int getLineCount() {
+ return lineCount;
+ }
+
+ }
+
+}
diff --git a/staging/linux-x86/sample/lambda/BulkDataOperations/src/Grep.java b/staging/linux-x86/sample/lambda/BulkDataOperations/src/Grep.java
new file mode 100644
index 0000000..cb4bdf7
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/BulkDataOperations/src/Grep.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Grep prints lines matching a regex. See {@link #printUsageAndExit(String...)}
+ * method for instructions and command line parameters. This sample shows
+ * examples of using next features:
+ * <ul>
+ * <li>Lambda and bulk operations. Working with streams:
+ * map(...),filter(...),flatMap(...),limit(...) methods.</li>
+ * <li>Static method reference for printing values.</li>
+ * <li>New Collections API forEach(...) method.</li>
+ * <li>Try-with-resources feature.</li>
+ * <li>new Files.walk(...), Files.lines(...) API.</li>
+ * <li>Streams that need to be closed.</li>
+ * </ul>
+ *
+ */
+public class Grep {
+
+ private static void printUsageAndExit(String... str) {
+ System.out.println("Usage: " + Grep.class.getSimpleName()
+ + " [OPTION]... PATTERN FILE...");
+ System.out.println("Search for PATTERN in each FILE. "
+ + "If FILE is a directory then whole file tree of the directory"
+ + " will be processed.");
+ System.out.println("Example: grep -m 100 'hello world' menu.h main.c");
+ System.out.println("Options:");
+ System.out.println(" -m NUM: stop analysis after NUM matches");
+ Arrays.asList(str).forEach(System.err::println);
+ System.exit(1);
+ }
+
+ /**
+ * The main method for the Grep program. Run program with empty argument
+ * list to see possible arguments.
+ *
+ * @param args the argument list for Grep.
+ * @throws java.io.IOException If an I/O error occurs.
+ */
+ public static void main(String[] args) throws IOException {
+ long maxCount = Long.MAX_VALUE;
+ if (args.length < 2) {
+ printUsageAndExit();
+ }
+ int i = 0;
+ //parse OPTIONS
+ while (args[i].startsWith("-")) {
+ switch (args[i]) {
+ case "-m":
+ try {
+ maxCount = Long.parseLong(args[++i]);
+ } catch (NumberFormatException ex) {
+ printUsageAndExit(ex.toString());
+ }
+ break;
+ default:
+ printUsageAndExit("Unexpected option " + args[i]);
+ }
+ i++;
+ }
+ //parse PATTERN
+ Pattern pattern = Pattern.compile(args[i++]);
+ if (i == args.length) {
+ printUsageAndExit("There are no files for input");
+ }
+
+ try {
+ /*
+ * First obtain the list of all paths.
+ * For a small number of arguments there is little to be gained
+ * by producing this list in parallel. For one argument
+ * there will be no parallelism.
+ *
+ * File names are converted to paths. If a path is a directory then
+ * Stream is populated with whole file tree of the directory by
+ * flatMap() method. Files are filtered from directories.
+ */
+ List<Path> files = Arrays.stream(args, i, args.length)
+ .map(Paths::get)
+ // flatMap will ensure each I/O-based stream will be closed
+ .flatMap(Grep::getPathStream)
+ .filter(Files::isRegularFile)
+ .collect(toList());
+ /*
+ * Then operate on that list in parallel.
+ * This is likely to give a more even distribution of work for
+ * parallel execution.
+ *
+ * Lines are extracted from files. Lines are filtered by pattern.
+ * Stream is limited by number of matches. Each remaining string is
+ * displayed in std output by method reference System.out::println.
+ */
+ files.parallelStream()
+ // flatMap will ensure each I/O-based stream will be closed
+ .flatMap(Grep::path2Lines)
+ .filter(pattern.asPredicate())
+ .limit(maxCount)
+ .forEachOrdered(System.out::println);
+ } catch (UncheckedIOException ioe) {
+ printUsageAndExit(ioe.toString());
+ }
+ }
+
+ /**
+ * Flattens file system hierarchy into a stream. This code is not inlined
+ * for the reason of Files.walk() throwing a checked IOException that must
+ * be caught.
+ *
+ * @param path - the file or directory
+ * @return Whole file tree starting from path, a stream with one element -
+ * the path itself - if it is a file.
+ */
+ private static Stream<Path> getPathStream(Path path) {
+ try {
+ return Files.walk(path);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ /**
+ * Produces a stream of lines from a file. The result is a stream in order
+ * to close it later. This code is not inlined for the reason of
+ * Files.lines() throwing a checked IOException that must be caught.
+ *
+ * @param path - the file to read
+ * @return stream of lines from the file
+ */
+ private static Stream<String> path2Lines(Path path) {
+ try {
+ return Files.lines(path);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java b/staging/linux-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java
new file mode 100644
index 0000000..e467798
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/BulkDataOperations/src/PasswordGenerator.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.security.SecureRandom;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.IntStream;
+
+/**
+ * Generates password of desired length. See {@link #usage} method
+ * for instructions and command line parameters. This sample shows usages of:
+ * <ul>
+ * <li>Method references.</li>
+ * <li>Lambda and bulk operations. A stream of random integers is mapped to
+ * chars, limited by desired length and printed in standard output as password
+ * string.</li>
+ * </ul>
+ *
+ */
+public class PasswordGenerator {
+
+ private static void usage() {
+ System.out.println("Usage: PasswordGenerator LENGTH");
+ System.out.println(
+ "Password Generator produces password of desired LENGTH.");
+ }
+
+ private static final List<Integer> PASSWORD_CHARS = new ArrayList<>();
+
+ //Valid symbols.
+ static {
+ IntStream.rangeClosed('0', '9').forEach(PASSWORD_CHARS::add); // 0-9
+ IntStream.rangeClosed('A', 'Z').forEach(PASSWORD_CHARS::add); // A-Z
+ IntStream.rangeClosed('a', 'z').forEach(PASSWORD_CHARS::add); // a-z
+ }
+
+ /**
+ * The main method for the PasswordGenerator program. Run program with empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for PasswordGenerator.
+ */
+ public static void main(String[] args) {
+
+ if (args.length != 1) {
+ usage();
+ return;
+ }
+
+ long passwordLength;
+ try {
+ passwordLength = Long.parseLong(args[0]);
+ if (passwordLength < 1) {
+ printMessageAndUsage("Length has to be positive");
+ return;
+ }
+ } catch (NumberFormatException ex) {
+ printMessageAndUsage("Unexpected number format" + args[0]);
+ return;
+ }
+ /*
+ * Stream of random integers is created containing Integer values
+ * in range from 0 to PASSWORD_CHARS.size().
+ * The stream is limited by passwordLength.
+ * Valid chars are selected by generated index.
+ */
+ new SecureRandom().ints(passwordLength, 0, PASSWORD_CHARS.size())
+ .map(PASSWORD_CHARS::get)
+ .forEach(i -> System.out.print((char) i));
+ }
+
+ private static void printMessageAndUsage(String message) {
+ System.err.println(message);
+ usage();
+ }
+
+}
diff --git a/staging/linux-x86/sample/lambda/BulkDataOperations/src/WC.java b/staging/linux-x86/sample/lambda/BulkDataOperations/src/WC.java
new file mode 100644
index 0000000..c724f15
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/BulkDataOperations/src/WC.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.function.Consumer;
+import java.util.regex.Pattern;
+
+/**
+ * WC - Prints newline, word, and character counts for each file. See
+ * the {@link #usage} method for instructions and command line parameters. This
+ * sample shows usages of:
+ * <ul>
+ * <li>Lambda and bulk operations. Shows how to create a custom collector to
+ * gather custom statistics. Implements the collection of statistics using a
+ * built-in API.</li>
+ * <li>Constructor reference.</li>
+ * <li>Try-with-resources feature.</li>
+ * </ul>
+ *
+ */
+public class WC {
+
+ //The number of characters that may be read.
+ private static final int READ_AHEAD_LIMIT = 100_000_000;
+
+ //The pattern for splitting strings by non word characters to get words.
+ private static final Pattern nonWordPattern = Pattern.compile("\\W");
+
+ /**
+ * The main method for the WC program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for WC
+ * @throws java.io.IOException If an input exception occurred.
+ */
+ public static void main(String[] args) throws IOException {
+
+ if (args.length != 1) {
+ usage();
+ return;
+ }
+
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(args[0]))) {
+ reader.mark(READ_AHEAD_LIMIT);
+ /*
+ * Statistics can be gathered in four passes using a built-in API.
+ * The method demonstrates how separate operations can be
+ * implemented using a built-in API.
+ */
+ collectInFourPasses(reader);
+ /*
+ * Usage of several passes to collect data is not the best way.
+ * Statistics can be gathered by a custom collector in one pass.
+ */
+ reader.reset();
+ collectInOnePass(reader);
+ } catch (FileNotFoundException e) {
+ usage();
+ System.err.println(e);
+ }
+ }
+
+ private static void collectInFourPasses(BufferedReader reader)
+ throws IOException {
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is turned into a stream of chars by the flatMapToInt(...)
+ * method.
+ * Length of the stream is counted by count().
+ */
+ System.out.println("Character count = "
+ + reader.lines().flatMapToInt(String::chars).count());
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is split by nonWordPattern into words by flatMap(...)
+ * method.
+ * Empty lines are removed by the filter(...) method.
+ * Length of the stream is counted by count().
+ */
+ reader.reset();
+ System.out.println("Word count = "
+ + reader.lines()
+ .flatMap(nonWordPattern::splitAsStream)
+ .filter(str -> !str.isEmpty()).count());
+
+ reader.reset();
+ System.out.println("Newline count = " + reader.lines().count());
+ /*
+ * Input is read as a stream of lines by lines().
+ * Every line is mapped to its length.
+ * Maximum of the lengths is calculated.
+ */
+ reader.reset();
+ System.out.println("Max line length = "
+ + reader.lines().mapToInt(String::length).max().getAsInt());
+ }
+
+ private static void collectInOnePass(BufferedReader reader) {
+ /*
+ * The collect() method has three parameters:
+ * The first parameter is the {@code WCStatistic} constructor reference.
+ * collect() will create {@code WCStatistics} instances, where
+ * statistics will be aggregated.
+ * The second parameter shows how {@code WCStatistics} will process
+ * String.
+ * The third parameter shows how to merge two {@code WCStatistic}
+ * instances.
+ *
+ * Also {@code Collector} can be used, which would be more reusable
+ * solution. See {@code CSVProcessor} example for how {@code Collector}
+ * can be implemented.
+ *
+ * Note that the any performance increase when going parallel will
+ * depend on the size of the input (lines) and the cost per-element.
+ */
+ WCStatistics wc = reader.lines().parallel()
+ .collect(WCStatistics::new,
+ WCStatistics::accept,
+ WCStatistics::combine);
+ System.out.println(wc);
+ }
+
+ private static void usage() {
+ System.out.println("Usage: " + WC.class.getSimpleName() + " FILE");
+ System.out.println("Print newline, word,"
+ + " character counts and max line length for FILE.");
+ }
+
+ private static class WCStatistics implements Consumer<String> {
+ /*
+ * @implNote This implementation does not need to be thread safe because
+ * the parallel implementation of
+ * {@link java.util.stream.Stream#collect Stream.collect()}
+ * provides the necessary partitioning and isolation for safe parallel
+ * execution.
+ */
+
+ private long characterCount;
+ private long lineCount;
+ private long wordCount;
+ private long maxLineLength;
+
+
+ /*
+ * Processes line.
+ */
+ @Override
+ public void accept(String line) {
+ characterCount += line.length();
+ lineCount++;
+ wordCount += nonWordPattern.splitAsStream(line)
+ .filter(str -> !str.isEmpty()).count();
+ maxLineLength = Math.max(maxLineLength, line.length());
+ }
+
+ /*
+ * Merges two WCStatistics.
+ */
+ public void combine(WCStatistics stat) {
+ wordCount += stat.wordCount;
+ lineCount += stat.lineCount;
+ characterCount += stat.characterCount;
+ maxLineLength = Math.max(maxLineLength, stat.maxLineLength);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("#------WCStatistic------#\n");
+ sb.append("Character count = ").append(characterCount).append('\n');
+ sb.append("Word count = ").append(wordCount).append('\n');
+ sb.append("Newline count = ").append(lineCount).append('\n');
+ sb.append("Max line length = ").append(maxLineLength).append('\n');
+ return sb.toString();
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/lambda/DefaultMethods/ArrayIterator.java b/staging/linux-x86/sample/lambda/DefaultMethods/ArrayIterator.java
new file mode 100644
index 0000000..2eca801
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/DefaultMethods/ArrayIterator.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+/**
+ * The code sample illustrates the usage of default methods in the JDK 8. Most
+ * implementations of {@link Iterator} don't provide a useful
+ * {@link Iterator#remove()} method, however,
+ * they still have to implement this method to throw
+ * an UnsupportedOperationException. With the default method, the same
+ * default behavior in interface Iterator itself can be provided.
+ */
+public class ArrayIterator {
+
+ /** Close the constructor because ArrayIterator is part of the utility
+ * class.
+ */
+ protected ArrayIterator() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns an iterator that goes over the elements in the array.
+ *
+ * @param <E> type of an array element
+ * @param array source array to iterate over it
+ * @return an iterator that goes over the elements in the array
+ */
+ public static <E> Iterator<E> iterator(final E[] array) {
+ return new Iterator<E>() {
+ /**
+ * Index of the current position
+ *
+ */
+ private int index = 0;
+
+ /**
+ * Returns the next element in the iteration
+ *
+ * @return the next element in the iteration
+ * @throws NoSuchElementException if the iteration has no more
+ * elements
+ */
+ @Override
+ public boolean hasNext() {
+ return (index < array.length);
+ }
+
+ /**
+ * Returns {@code true} if the iteration has more elements. (In
+ * other words, returns {@code true} if {@link #next} returns
+ * an element, rather than throwing an exception.)
+ *
+ * @return {@code true} if the iteration has more elements
+ */
+ @Override
+ public E next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ return array[index++];
+ }
+
+ /**
+ * This method does not need to be overwritten in JDK 8.
+ */
+ //@Override
+ //public void remove() {
+ // throw UnsupportedOperationException(
+ // "Arrays don't support remove.")
+ //}
+ };
+ }
+
+ /**
+ * Sample usage of the ArrayIterator
+ *
+ * @param args command-line arguments
+ */
+ public static void main(final String[] args) {
+ Iterator<String> it = ArrayIterator.iterator(
+ new String[]{"one", "two", "three"});
+
+ while (it.hasNext()) {
+ System.out.println(it.next());
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/lambda/DefaultMethods/DiamondInheritance.java b/staging/linux-x86/sample/lambda/DefaultMethods/DiamondInheritance.java
new file mode 100644
index 0000000..9214d58
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/DefaultMethods/DiamondInheritance.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/**
+ * This sample diamond interface inheritance with <b>default methods</b>.
+ * If there's not already a unique method implementation to inherit,
+ * you must provide it. The inheritance diagram is similar to the following:
+ * <pre>
+ * Animal
+ * / \
+ * Horse Bird
+ * \ /
+ * Pegasus
+ * </pre>
+ *
+ * Both {@link Horse} and {@link Bird} interfaces implements the <code>go</code>
+ * method. The {@link Pegasus} class have to overrides the
+ * <code>go</code> method.
+ *
+ * The new syntax of super-call is used here:
+ * <pre>
+ * &lt;interface_name&gt;.super.&lt;method&gt;(...);
+ * For example: Horse.super.go();
+ * </pre> So, Pegasus moves like a horse.
+ */
+public class DiamondInheritance {
+
+ /**
+ * Base interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the "go" action for concrete animal
+ *
+ * @return string representation of the "go" action for concrete animal
+ */
+ String go();
+ }
+
+ /**
+ * Interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Horse extends Animal {
+
+ /**
+ * Return string representation of the "go" action for horse
+ *
+ * @return string representation of the "go" action for horse
+ */
+ @Override
+ default String go() {
+ return this.getClass().getSimpleName() + " walks on four legs";
+ }
+ }
+
+ /**
+ * Interface to illustrate the diamond inheritance.
+ *
+ * @see DiamondInheritance
+ */
+ public interface Bird extends Animal {
+
+ /**
+ * Return string representation of the "go" action for bird
+ *
+ * @return string representation of the "go" action for bird
+ */
+ @Override
+ default String go() {
+ return this.getClass().getSimpleName() + " walks on two legs";
+ }
+
+ /**
+ * Return string representation of the "fly" action for bird
+ *
+ * @return string representation of the "fly" action for bird
+ */
+ default String fly() {
+ return "I can fly";
+ }
+ }
+
+ /**
+ * Class to illustrate the diamond inheritance. Pegasus must mix horse and
+ * bird behavior.
+ *
+ * @see DiamondInheritance
+ */
+ public static class Pegasus implements Horse, Bird {
+
+ /**
+ * Return string representation of the "go" action for the fictitious
+ * creature Pegasus
+ *
+ * @return string representation of the "go" action for the fictitious
+ * creature Pegasus
+ */
+ @Override
+ public String go() {
+ return Horse.super.go();
+ }
+ }
+
+ /**
+ * Illustrate the behavior of the {@link Pegasus} class
+ *
+ * @param args command line arguments
+ */
+ public static void main(final String[] args) {
+ System.out.println(new Pegasus().go());
+ }
+}
diff --git a/staging/linux-x86/sample/lambda/DefaultMethods/Inheritance.java b/staging/linux-x86/sample/lambda/DefaultMethods/Inheritance.java
new file mode 100644
index 0000000..961de2c
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/DefaultMethods/Inheritance.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/**
+ * The sample illustrates rules to resolve conflicts between inheritance
+ * candidates with <b>default methods</b>. There are two simple rules:
+ * <ul>
+ * <li>Class wins. If the superclass has a concrete or abstract declaration of
+ * this method, then it is preferred over all defaults.</li>
+ * <li>Subtype wins. If an interface extends another interface, and both provide
+ * a default, then the more specific interface wins. </li>
+ * </ul>
+ */
+public class Inheritance {
+
+ /**
+ * The behavior of an creature that can swim
+ */
+ public interface Swimable {
+
+ /**
+ * Return string representation of the swim action for a creature that
+ * can swim
+ *
+ * @return string representation of the swim action for a creature
+ * that can swim
+ */
+ default String swim() {
+ return "I can swim.";
+ }
+ }
+
+ /**
+ * The abstract class that overrides {@link #swim} method
+ */
+ public abstract static class Fish implements Swimable {
+
+ /**
+ * Return string representation of the swim action for a fish
+ *
+ * @return string representation of the swim action for a fish
+ */
+ @Override
+ public String swim() {
+ return this.getClass().getSimpleName() + " swims under water";
+ }
+ }
+
+ /**
+ * This class is used for the illustration rule of 1. See the source code
+ * of the {@link #main} method.
+ * <pre>
+ * System.out.println(new Tuna().swim()); //"Tuna swims under water" output is suspected here
+ * </pre>
+ */
+ public static class Tuna extends Fish implements Swimable {
+ }
+
+ /**
+ * The behavior of an creature that can dive: the interface that overrides
+ * {@link #swim} method (subtype of {@link Swimable})
+ */
+ public interface Diveable extends Swimable {
+
+ /**
+ * Return string representation of the swim action for a creature that
+ * can dive
+ *
+ * @return string representation of the swim action for a creature
+ * that can dive
+ */
+ @Override
+ default String swim() {
+ return "I can swim on the surface of the water.";
+ }
+
+ /**
+ * Return string representation of the dive action for a creature that
+ * can dive
+ *
+ * @return string representation of the dive action for a creature
+ * that can dive
+ */
+ default String dive() {
+ return "I can dive.";
+ }
+ }
+
+ /**
+ * This class is used for the illustration of rule 2. See the source code
+ * of the {@link #main} method
+ * <pre>
+ * //"I can swim on the surface of the water." output is suspected here
+ * System.out.println(new Duck().swim());
+ * </pre>
+ */
+ public static class Duck implements Swimable, Diveable {
+ }
+
+ /**
+ * Illustrate behavior of the classes: {@link Tuna} and {@link Duck}
+ *
+ * @param args command line arguments
+ */
+ public static void main(final String[] args) {
+ // Illustrates rule 1. The Fish.swim() implementation wins
+ //"Tuna swims under water" is output
+ System.out.println(new Tuna().swim());
+
+ // Illustrates rule 2. The Diveable.swim() implementation wins
+ //"I can swim on the surface of the water." is output
+ System.out.println(new Duck().swim());
+ }
+}
diff --git a/staging/linux-x86/sample/lambda/DefaultMethods/MixIn.java b/staging/linux-x86/sample/lambda/DefaultMethods/MixIn.java
new file mode 100644
index 0000000..d9ed81d
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/DefaultMethods/MixIn.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+
+/**
+ * The example illustrates how to use the default method for mixin.
+ * @see BuildType
+ * @see Debuggable
+ */
+public class MixIn {
+
+ /**
+ * Implement this interface for a class that must be in debug print
+ */
+ public interface Debuggable {
+
+ /**
+ * Print the class name and all fields to a string. Uses reflection to
+ * obtain and access fields of this object.
+ *
+ * @return the string formatted like the following: <pre>
+ * State of the: &lt;Class Name&gt;
+ * &lt;member name&gt; : &lt;value&gt;
+ * ...
+ * </pre>
+ */
+ default String toDebugString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("State of the: ").append(
+ this.getClass().getSimpleName()).append("\n");
+ for (Class cls = this.getClass();
+ cls != null;
+ cls = cls.getSuperclass()) {
+ for (Field f : cls.getDeclaredFields()) {
+ try {
+ f.setAccessible(true);
+ sb.append(f.getName()).append(" : ").
+ append(f.get(this)).append("\n");
+ } catch (IllegalAccessException e) {
+ }
+ }
+ }
+ return sb.toString();
+ }
+ }
+
+ /**
+ * Sample exception class to demonstrate mixin. This enum inherits the
+ * behavior of the {@link Debuggable}
+ */
+ public static enum BuildType implements Debuggable {
+
+ BUILD(0, "-build"),
+ PLAN(0, "-plan"),
+ EXCLUDE(1, "-exclude"),
+ TOTAL(2, "-total");
+
+ private final int compareOrder;
+ private final String pathSuffix;
+
+ private BuildType(int compareOrder, String pathSuffix) {
+ this.compareOrder = compareOrder;
+ this.pathSuffix = pathSuffix;
+ }
+
+ public int getCompareOrder() {
+ return compareOrder;
+ }
+
+ public String getPathSuffix() {
+ return pathSuffix;
+ }
+ }
+
+ /**
+ * Illustrate the behavior of the MixClass
+ *
+ * @param args command-line arguments
+ * @throws java.io.IOException internal demo error
+ */
+ public static void main(final String[] args) throws IOException {
+ System.out.println(BuildType.BUILD.toDebugString());
+ }
+}
diff --git a/staging/linux-x86/sample/lambda/DefaultMethods/Reflection.java b/staging/linux-x86/sample/lambda/DefaultMethods/Reflection.java
new file mode 100644
index 0000000..78424a2
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/DefaultMethods/Reflection.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+/**
+ * The code sample illustrates changes in the reflection API linked
+ * <b>default methods</b>. Since Java SE 8, a new method is added into the class
+ * <b><code>java.lang.reflect.Method</code></b>, with which you can reflectively
+ * determine whether or not a default method provided by an interface
+ * (<b><code>Method.isDefault()</code></b>).
+ */
+public class Reflection {
+
+ /**
+ * Base interface to illustrate the new reflection API.
+ *
+ * @see Dog
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the eat action for Animal
+ *
+ * @return string representation of the eat action for Animal
+ */
+ default String eat() {
+ return this.getClass().getSimpleName()
+ + " eats like an ordinary animal";
+ }
+
+ /**
+ * Return string representation of the sleep action for Animal
+ *
+ * @return string representation of the sleep action for Animal
+ */
+ default String sleep() {
+ return this.getClass().getSimpleName()
+ + " sleeps like an ordinary animal";
+ }
+
+ /**
+ * Return string representation of the go action for Animal
+ *
+ * @return string representation of the go action for Animal
+ */
+ String go();
+ }
+
+ /**
+ * Dog class to illustrate the new reflection API. You can see that:
+ * <ul>
+ * <li> the {@link #go} and {@link #sleep} methods are not default.
+ * {@link #go} is not the default implementation and the {@link #sleep}
+ * method implementation wins as subtype (according with {@link Inheritance}
+ * rule. 2) </li>
+ * <li> the {@link #eat} is a simple default method that is not overridden
+ * in this class.
+ * </li>
+ * </ul>
+ */
+ public static class Dog implements Animal {
+
+ /**
+ * Return string representation of the go action for Dog
+ *
+ * @return string representation of the go action for Dog
+ */
+ @Override
+ public String go() {
+ return "Dog walks on four legs";
+ }
+
+ /**
+ * Return string representation of the sleep action for Dog
+ *
+ * @return string representation of the sleep action for Dog
+ */
+ @Override
+ public String sleep() {
+ return "Dog sleeps";
+ }
+ }
+
+ /**
+ * Illustrate the usage of the method java.lang.reflect.Method.isDefault()
+ *
+ * @param args command-line arguments
+ * @throws NoSuchMethodException internal demo error
+ */
+ public static void main(final String[] args) throws NoSuchMethodException {
+ Dog dog = new Dog();
+ Stream.of(Dog.class.getMethod("eat"), Dog.class.getMethod("go"), Dog.class.getMethod("sleep"))
+ .forEach((m) -> {
+ System.out.println("Method name: " + m.getName());
+ System.out.println(" isDefault: " + m.isDefault());
+ System.out.print(" invoke: ");
+ try {
+ m.invoke(dog);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ }
+ System.out.println();
+ });
+ }
+}
diff --git a/staging/linux-x86/sample/lambda/DefaultMethods/SimplestUsage.java b/staging/linux-x86/sample/lambda/DefaultMethods/SimplestUsage.java
new file mode 100644
index 0000000..a971858
--- /dev/null
+++ b/staging/linux-x86/sample/lambda/DefaultMethods/SimplestUsage.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/**
+ * The sample illustrates the simplest use case of the <b>default methods</b>.
+ */
+public class SimplestUsage {
+
+ /**
+ * The Animal interface provides the default implementation
+ * of the {@link #eat} method.
+ */
+ public interface Animal {
+
+ /**
+ * Return string representation of the eat action for Animal
+ *
+ * @return string representation of the eat action for Animal
+ */
+ default String eat() {
+ return this.getClass().getSimpleName()
+ + " eats like an ordinary animal";
+ }
+ }
+
+ /**
+ * The Dog class doesn't have its own implementation of the {@link #eat}
+ * method and uses the default implementation.
+ */
+ public static class Dog implements Animal {
+ }
+
+ /**
+ * The Mosquito class implements {@link #eat} method, its own implementation
+ * overrides the default implementation.
+ *
+ */
+ public static class Mosquito implements Animal {
+
+ /**
+ * Return string representation of the eat action for Mosquito
+ *
+ * @return string representation of the eat action for Mosquito
+ */
+ @Override
+ public String eat() {
+ return "Mosquito consumes blood";
+ }
+ }
+
+ /**
+ * Illustrate behavior of the classes: {@link Dog} and {@link Mosquito}
+ *
+ * @param args command-line arguments
+ */
+ public static void main(String[] args) {
+ // "Dog eats like an ordinary animal" is output
+ System.out.println(new Dog().eat());
+
+ // "Mosquito consumes blood" is output
+ System.out.println(new Mosquito().eat());
+ }
+}
diff --git a/staging/linux-x86/sample/nbproject/project.xml b/staging/linux-x86/sample/nbproject/project.xml
new file mode 100644
index 0000000..8417326
--- /dev/null
+++ b/staging/linux-x86/sample/nbproject/project.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>JDK Samples</name>
+ <view>
+ <items/>
+ </view>
+ <subprojects>
+ <project>jmx/jmx-scandir</project>
+ <project>scripting/scriptpad</project>
+ <project>webservices/EbayClient</project>
+ <project>webservices/EbayServer</project>
+ </subprojects>
+ </general-data>
+ </configuration>
+</project>
diff --git a/staging/linux-x86/sample/nio/chatserver/ChatServer.java b/staging/linux-x86/sample/nio/chatserver/ChatServer.java
new file mode 100644
index 0000000..f807aa1
--- /dev/null
+++ b/staging/linux-x86/sample/nio/chatserver/ChatServer.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.StandardSocketOptions;
+import java.nio.channels.*;
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Implements a chat server, this class holds the list of {@code clients} connected to the server.
+ * It sets up a server socket using AsynchronousServerSocketChannel listening to a specified port.
+ */
+public class ChatServer implements Runnable {
+ private final List<Client> connections = Collections.synchronizedList(new ArrayList<Client>());
+ private int port;
+ private final AsynchronousServerSocketChannel listener;
+ private final AsynchronousChannelGroup channelGroup;
+
+ /**
+ *
+ * @param port to listen to
+ * @throws java.io.IOException when failing to start the server
+ */
+ public ChatServer(int port) throws IOException {
+ channelGroup = AsynchronousChannelGroup.withFixedThreadPool(Runtime.getRuntime().availableProcessors(),
+ Executors.defaultThreadFactory());
+ this.port = port;
+ listener = createListener(channelGroup);
+ }
+
+ /**
+ *
+ * @return The socket address that the server is bound to
+ * @throws java.io.IOException if an I/O error occurs
+ */
+ public SocketAddress getSocketAddress() throws IOException {
+ return listener.getLocalAddress();
+ }
+
+ /**
+ * Start accepting connections
+ */
+ public void run() {
+
+ // call accept to wait for connections, tell it to call our CompletionHandler when there
+ // is a new incoming connection
+ listener.accept(null, new CompletionHandler<AsynchronousSocketChannel, Void>() {
+ @Override
+ public void completed(AsynchronousSocketChannel result, Void attachment) {
+ // request a new accept and handle the incoming connection
+ listener.accept(null, this);
+ handleNewConnection(result);
+ }
+
+ @Override
+ public void failed(Throwable exc, Void attachment) {
+ }
+ });
+ }
+
+ /**
+ * Shuts down the server
+ * @throws InterruptedException if terminated while waiting for shutdown
+ * @throws IOException if failing to shutdown the channel group
+ */
+ public void shutdown() throws InterruptedException, IOException {
+ channelGroup.shutdownNow();
+ channelGroup.awaitTermination(1, TimeUnit.SECONDS);
+ }
+
+ /*
+ * Creates a listener and starts accepting connections
+ */
+ private AsynchronousServerSocketChannel createListener(AsynchronousChannelGroup channelGroup) throws IOException {
+ final AsynchronousServerSocketChannel listener = openChannel(channelGroup);
+ listener.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+ listener.bind(new InetSocketAddress(port));
+ return listener;
+ }
+
+ private AsynchronousServerSocketChannel openChannel(AsynchronousChannelGroup channelGroup) throws IOException {
+ return AsynchronousServerSocketChannel.open(channelGroup);
+ }
+
+ /**
+ * Creates a new client and adds it to the list of connections.
+ * Sets the clients handler to the initial state of NameReader
+ *
+ * @param channel the newly accepted channel
+ */
+ private void handleNewConnection(AsynchronousSocketChannel channel) {
+ Client client = new Client(channel, new ClientReader(this, new NameReader(this)));
+ try {
+ channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
+ } catch (IOException e) {
+ // ignore
+ }
+ connections.add(client);
+ client.run();
+ }
+
+ /**
+ * Sends a message to all clients except the source.
+ * The method is synchronized as it is desired that messages are sent to
+ * all clients in the same order as received.
+ *
+ * @param client the message source
+ * @param message the message to be sent
+ */
+ public void writeMessageToClients(Client client, String message) {
+ synchronized (connections) {
+ for (Client clientConnection : connections) {
+ if (clientConnection != client) {
+ clientConnection.writeMessageFrom(client, message);
+ }
+ }
+ }
+ }
+
+ public void removeClient(Client client) {
+ connections.remove(client);
+ }
+
+ private static void usage() {
+ System.err.println("ChatServer [-port <port number>]");
+ System.exit(1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ int port = 5000;
+ if (args.length != 0 && args.length != 2) {
+ usage();
+ } else if (args.length == 2) {
+ try {
+ if (args[0].equals("-port")) {
+ port = Integer.parseInt(args[1]);
+ } else {
+ usage();
+ }
+ } catch (NumberFormatException e) {
+ usage();
+ }
+ }
+ System.out.println("Running on port " + port);
+ new ChatServer(port).run();
+ }
+}
diff --git a/staging/linux-x86/sample/nio/chatserver/Client.java b/staging/linux-x86/sample/nio/chatserver/Client.java
new file mode 100644
index 0000000..31ee034
--- /dev/null
+++ b/staging/linux-x86/sample/nio/chatserver/Client.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousSocketChannel;
+import java.nio.channels.CompletionHandler;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Client represents a remote connection to the chat server.
+ * It contains methods for reading and writing messages from the
+ * channel.
+ * Messages are considered to be separated by newline, so incomplete
+ * messages are buffered in the {@code Client}.
+ *
+ * All reads and writes are asynchronous and uses the nio2 asynchronous
+ * elements.
+ */
+class Client {
+ private final AsynchronousSocketChannel channel;
+ private AtomicReference<ClientReader> reader;
+ private String userName;
+ private final StringBuilder messageBuffer = new StringBuilder();
+
+ private final Queue<ByteBuffer> queue = new LinkedList<ByteBuffer>();
+ private boolean writing = false;
+
+ public Client(AsynchronousSocketChannel channel, ClientReader reader) {
+ this.channel = channel;
+ this.reader = new AtomicReference<ClientReader>(reader);
+ }
+
+ /**
+ * Enqueues a write of the buffer to the channel.
+ * The call is asynchronous so the buffer is not safe to modify after
+ * passing the buffer here.
+ *
+ * @param buffer the buffer to send to the channel
+ */
+ private void writeMessage(final ByteBuffer buffer) {
+ boolean threadShouldWrite = false;
+
+ synchronized(queue) {
+ queue.add(buffer);
+ // Currently no thread writing, make this thread dispatch a write
+ if (!writing) {
+ writing = true;
+ threadShouldWrite = true;
+ }
+ }
+
+ if (threadShouldWrite) {
+ writeFromQueue();
+ }
+ }
+
+ private void writeFromQueue() {
+ ByteBuffer buffer;
+
+ synchronized (queue) {
+ buffer = queue.poll();
+ if (buffer == null) {
+ writing = false;
+ }
+ }
+
+ // No new data in buffer to write
+ if (writing) {
+ writeBuffer(buffer);
+ }
+ }
+
+ private void writeBuffer(ByteBuffer buffer) {
+ channel.write(buffer, buffer, new CompletionHandler<Integer, ByteBuffer>() {
+ @Override
+ public void completed(Integer result, ByteBuffer buffer) {
+ if (buffer.hasRemaining()) {
+ channel.write(buffer, buffer, this);
+ } else {
+ // Go back and check if there is new data to write
+ writeFromQueue();
+ }
+ }
+
+ @Override
+ public void failed(Throwable exc, ByteBuffer attachment) {
+ }
+ });
+ }
+
+ /**
+ * Sends a message
+ * @param string the message
+ */
+ public void writeStringMessage(String string) {
+ writeMessage(ByteBuffer.wrap(string.getBytes()));
+ }
+
+ /**
+ * Send a message from a specific client
+ * @param client the message is sent from
+ * @param message to send
+ */
+ public void writeMessageFrom(Client client, String message) {
+ if (reader.get().acceptsMessages()) {
+ writeStringMessage(client.getUserName() + ": " + message);
+ }
+ }
+
+ /**
+ * Enqueue a read
+ * @param completionHandler callback on completed read
+ */
+ public void read(CompletionHandler<Integer, ? super ByteBuffer> completionHandler) {
+ ByteBuffer input = ByteBuffer.allocate(256);
+ if (!channel.isOpen()) {
+ return;
+ }
+ channel.read(input, input, completionHandler);
+ }
+
+ /**
+ * Closes the channel
+ */
+ public void close() {
+ try {
+ channel.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Run the current states actions.
+ */
+ public void run() {
+ reader.get().run(this);
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public void setReader(ClientReader reader) {
+ this.reader.set(reader);
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void appendMessage(String message) {
+ synchronized (messageBuffer) {
+ messageBuffer.append(message);
+ }
+ }
+
+ /**
+ * @return the next newline separated message in the buffer. null is returned if the buffer
+ * doesn't contain any newline.
+ */
+ public String nextMessage() {
+ synchronized(messageBuffer) {
+ int nextNewline = messageBuffer.indexOf("\n");
+ if (nextNewline == -1) {
+ return null;
+ }
+ String message = messageBuffer.substring(0, nextNewline + 1);
+ messageBuffer.delete(0, nextNewline + 1);
+ return message;
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/chatserver/ClientReader.java b/staging/linux-x86/sample/nio/chatserver/ClientReader.java
new file mode 100644
index 0000000..822125a
--- /dev/null
+++ b/staging/linux-x86/sample/nio/chatserver/ClientReader.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+import java.nio.channels.CompletionHandler;
+
+/**
+ * Handles a cycle of reading / writing on the {@code Client}.
+ */
+class ClientReader {
+ private final DataReader callback;
+ private final ChatServer chatServer;
+
+ ClientReader(ChatServer chatServer, DataReader callback) {
+ this.chatServer = chatServer;
+ this.callback = callback;
+ }
+
+ public boolean acceptsMessages() {
+ return callback.acceptsMessages();
+ }
+
+ /**
+ * Runs a cycle of doing a beforeRead action and then enqueuing a new
+ * read on the client. Handles closed channels and errors while reading.
+ * If the client is still connected a new round of actions are called.
+ */
+ public void run(final Client client) {
+ callback.beforeRead(client);
+ client.read(new CompletionHandler<Integer, ByteBuffer>() {
+ @Override
+ public void completed(Integer result, ByteBuffer buffer) {
+ // if result is negative or zero the connection has been closed or something gone wrong
+ if (result < 1) {
+ client.close();
+ System.out.println("Closing connection to " + client);
+ chatServer.removeClient(client);
+ } else {
+ callback.onData(client, buffer, result);
+ // enqueue next round of actions
+ client.run();
+ }
+ }
+
+ @Override
+ public void failed(Throwable exc, ByteBuffer buffer) {
+ client.close();
+ chatServer.removeClient(client);
+ }
+ });
+ }
+}
diff --git a/staging/linux-x86/sample/nio/chatserver/DataReader.java b/staging/linux-x86/sample/nio/chatserver/DataReader.java
new file mode 100644
index 0000000..8858c9f
--- /dev/null
+++ b/staging/linux-x86/sample/nio/chatserver/DataReader.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+
+public interface DataReader {
+ void beforeRead(Client client);
+ void onData(Client client, ByteBuffer buffer, int bytes);
+ boolean acceptsMessages();
+}
diff --git a/staging/linux-x86/sample/nio/chatserver/MessageReader.java b/staging/linux-x86/sample/nio/chatserver/MessageReader.java
new file mode 100644
index 0000000..81c370b
--- /dev/null
+++ b/staging/linux-x86/sample/nio/chatserver/MessageReader.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+
+/**
+ * Writes all messages in our buffer to the other clients
+ * and appends new data read from the socket to our buffer
+ */
+class MessageReader implements DataReader {
+ private final ChatServer chatServer;
+
+ public MessageReader(ChatServer chatServer) {
+ this.chatServer = chatServer;
+ }
+
+ public boolean acceptsMessages() {
+ return true;
+ }
+
+ /**
+ * Write all full messages in our buffer to
+ * the other clients
+ *
+ * @param client the client to read messages from
+ */
+ @Override
+ public void beforeRead(Client client) {
+ // Check if we have any messages buffered and send them
+ String message = client.nextMessage();
+ while (message != null) {
+ chatServer.writeMessageToClients(client, message);
+ message = client.nextMessage();
+ }
+ }
+
+ /**
+ * Append the read buffer to the clients message buffer
+ * @param client the client to append messages to
+ * @param buffer the buffer we received from the socket
+ * @param bytes the number of bytes read into the buffer
+ */
+ @Override
+ public void onData(Client client, ByteBuffer buffer, int bytes) {
+ buffer.flip();
+ // Just append the message on the buffer
+ client.appendMessage(new String(buffer.array(), 0, bytes));
+ }
+}
diff --git a/staging/linux-x86/sample/nio/chatserver/NameReader.java b/staging/linux-x86/sample/nio/chatserver/NameReader.java
new file mode 100644
index 0000000..341d4da
--- /dev/null
+++ b/staging/linux-x86/sample/nio/chatserver/NameReader.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+
+/**
+ * The first state a newly connected {@code Client} is in, this
+ * handles writing out the welcoming message and reads the response
+ * up to a newline. When a newline character have been received
+ * it changes the handler from NameReader to MessageReader on the
+ * client.
+ */
+class NameReader implements DataReader {
+ private final StringBuilder buffer = new StringBuilder();
+ private final ChatServer chatServer;
+ private boolean once = true;
+ private static final String NEWLINE = "\n";
+
+ public NameReader(ChatServer chatServer) {
+ this.chatServer = chatServer;
+ }
+
+ /**
+ * Writes the welcoming message to the client the first time this method
+ * is called.
+ *
+ * @param client the client to receive the message
+ */
+ @Override
+ public void beforeRead(Client client) {
+ // if it is a long name that takes more than one read we only want to display Name: once.
+ if (once) {
+ client.writeStringMessage("Name: ");
+ once = false;
+ }
+ }
+
+ public boolean acceptsMessages() {
+ return false;
+ }
+
+ /**
+ * Receives incoming data from the socket, searches for a newline
+ * and tries to set the username if one is found
+ */
+ @Override
+ public void onData(Client client, ByteBuffer buffer, int bytes) {
+ buffer.flip();
+ String name;
+ name = this.buffer.append(new String(buffer.array(), 0, bytes)).toString();
+ if (name.contains(NEWLINE)) {
+ onUserNameRead(client, name);
+ }
+ }
+
+ /**
+ * Splits the name on the newlines, takes the first as the username
+ * and appends everything else to the clients message buffer.
+ * Sets the clients handler to MessageReader.
+ *
+ * @param client the client to set the username for
+ * @param name the string containing the buffered input
+ */
+ private void onUserNameRead(Client client, String name) {
+ String[] strings = name.split(NEWLINE, 2);
+ client.setUserName(strings[0].trim());
+ sendRemainingParts(client, strings);
+ client.setReader(new ClientReader(chatServer, new MessageReader(chatServer)));
+ client.writeStringMessage("Welcome " + client.getUserName() + "\n");
+ }
+
+ /**
+ * Appends the remaining parts to the clients message buffer
+ *
+ * @param client the client
+ * @param strings the messages to append to the buffer
+ */
+ private void sendRemainingParts(Client client, String[] strings) {
+ for (int i = 1; i < strings.length; ++i) {
+ client.appendMessage(strings[i]);
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/chatserver/README.txt b/staging/linux-x86/sample/nio/chatserver/README.txt
new file mode 100644
index 0000000..ec9b476
--- /dev/null
+++ b/staging/linux-x86/sample/nio/chatserver/README.txt
@@ -0,0 +1,62 @@
+A Simple Chat Server Example
+
+INTRODUCTION
+============
+This directory contains a very simple chat server, the server takes input from a
+socket ("user") and sends it to all other connected sockets ("users") along with
+the provided name the user was asked for when first connecting.
+
+The server was written to demonstrate the asynchronous I/O API in JDK 7.
+The sample assumes the reader has some familiarity with the subject matter.
+
+SETUP
+=====
+
+The server must be built with version 7 (or later) of the JDK.
+The server is built with:
+
+ % mkdir build
+ % javac -source 7 -target 7 -d build *.java
+
+EXECUTION
+=========
+
+ % java -classpath build ChatServer [-port <port number>]
+
+ Usage: ChatServer [options]
+ options:
+ -port port port number
+ default: 5000
+
+CLIENT EXECUTION
+================
+
+No client binary is included in the sample.
+Connections can be made using for example the telnet command or any program
+that supports a raw TCP connection to a port.
+
+SOURCE CODE OVERVIEW
+====================
+ChatServer is the main class, it handles the startup and handles incoming
+connections on the listening sockets. It keeps a list of connected client
+and provides methods for sending a message to them.
+
+Client represents a connected user, it provides methods for reading/writing
+from/to the underlying socket. It also contains a buffer of input read from
+the user.
+
+DataReader provides the interface of the two states a user can
+be in. Waiting for a name (and not receiving any messages while doing so, implemented
+by NameReader) and waiting for messages from the user (implemented by MessageReader).
+
+ClientReader contains the "main loop" for a connected client.
+
+NameReader is the initial state for a new client, it sends the user a string and
+waits for a response before changing the state to MessageReader.
+
+MessageReader is the main state for a client, it checks for new messages to send to
+other clients and reads messages from the client.
+
+FINALLY
+=======
+This is a sample: it is not production quality and isn't optimized for performance.
diff --git a/staging/linux-x86/sample/nio/file/AclEdit.java b/staging/linux-x86/sample/nio/file/AclEdit.java
new file mode 100644
index 0000000..90af865
--- /dev/null
+++ b/staging/linux-x86/sample/nio/file/AclEdit.java
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+import java.util.*;
+import java.util.regex.Pattern;
+
+/**
+ * Sample utility for editing a file's ACL.
+ */
+
+public class AclEdit {
+
+ // parse string as list of ACE permissions separated by /
+ static Set<AclEntryPermission> parsePermissions(String permsString) {
+ Set<AclEntryPermission> perms = new HashSet<AclEntryPermission>();
+ String[] result = permsString.split("/");
+ for (String s : result) {
+ if (s.equals(""))
+ continue;
+ try {
+ perms.add(AclEntryPermission.valueOf(s.toUpperCase()));
+ } catch (IllegalArgumentException x) {
+ System.err.format("Invalid permission '%s'\n", s);
+ System.exit(-1);
+ }
+ }
+ return perms;
+ }
+
+ // parse string as list of ACE flags separated by /
+ static Set<AclEntryFlag> parseFlags(String flagsString) {
+ Set<AclEntryFlag> flags = new HashSet<AclEntryFlag>();
+ String[] result = flagsString.split("/");
+ for (String s : result) {
+ if (s.equals(""))
+ continue;
+ try {
+ flags.add(AclEntryFlag.valueOf(s.toUpperCase()));
+ } catch (IllegalArgumentException x) {
+ System.err.format("Invalid flag '%s'\n", s);
+ System.exit(-1);
+ }
+ }
+ return flags;
+ }
+
+ // parse ACE type
+ static AclEntryType parseType(String typeString) {
+ // FIXME: support audit and alarm types in the future
+ if (typeString.equalsIgnoreCase("allow"))
+ return AclEntryType.ALLOW;
+ if (typeString.equalsIgnoreCase("deny"))
+ return AclEntryType.DENY;
+ System.err.format("Invalid type '%s'\n", typeString);
+ System.exit(-1);
+ return null; // keep compiler happy
+ }
+
+ /**
+ * Parse string of the form:
+ * [user|group:]<username|groupname>:<perms>[:flags]:<allow|deny>
+ */
+ static AclEntry parseAceString(String s,
+ UserPrincipalLookupService lookupService)
+ {
+ String[] result = s.split(":");
+
+ // must have at least 3 components (username:perms:type)
+ if (result.length < 3)
+ usage();
+
+ int index = 0;
+ int remaining = result.length;
+
+ // optional first component can indicate user or group type
+ boolean isGroup = false;
+ if (result[index].equalsIgnoreCase("user") ||
+ result[index].equalsIgnoreCase("group"))
+ {
+ if (--remaining < 3)
+ usage();
+ isGroup = result[index++].equalsIgnoreCase("group");
+ }
+
+ // user and permissions required
+ String userString = result[index++]; remaining--;
+ String permsString = result[index++]; remaining--;
+
+ // flags are optional
+ String flagsString = "";
+ String typeString = null;
+ if (remaining == 1) {
+ typeString = result[index++];
+ } else {
+ if (remaining == 2) {
+ flagsString = result[index++];
+ typeString = result[index++];
+ } else {
+ usage();
+ }
+ }
+
+ // lookup UserPrincipal
+ UserPrincipal user = null;
+ try {
+ user = (isGroup) ?
+ lookupService.lookupPrincipalByGroupName(userString) :
+ lookupService.lookupPrincipalByName(userString);
+ } catch (UserPrincipalNotFoundException x) {
+ System.err.format("Invalid %s '%s'\n",
+ ((isGroup) ? "group" : "user"),
+ userString);
+ System.exit(-1);
+ } catch (IOException x) {
+ System.err.format("Lookup of '%s' failed: %s\n", userString, x);
+ System.exit(-1);
+ }
+
+ // map string representation of permissions, flags, and type
+ Set<AclEntryPermission> perms = parsePermissions(permsString);
+ Set<AclEntryFlag> flags = parseFlags(flagsString);
+ AclEntryType type = parseType(typeString);
+
+ // build the ACL entry
+ return AclEntry.newBuilder()
+ .setType(type)
+ .setPrincipal(user)
+ .setPermissions(perms).setFlags(flags).build();
+ }
+
+ static void usage() {
+ System.err.println("usage: java AclEdit [ACL-operation] file");
+ System.err.println("");
+ System.err.println("Example 1: Prepends access control entry to the begining of the myfile's ACL");
+ System.err.println(" java AclEdit A+alice:read_data/read_attributes:allow myfile");
+ System.err.println("");
+ System.err.println("Example 2: Remove the entry at index 6 of myfile's ACL");
+ System.err.println(" java AclEdit A6- myfile");
+ System.err.println("");
+ System.err.println("Example 3: Replace the entry at index 2 of myfile's ACL");
+ System.err.println(" java AclEdit A2=bob:write_data/append_data:deny myfile");
+ System.exit(-1);
+ }
+
+ static enum Action {
+ PRINT,
+ ADD,
+ REMOVE,
+ REPLACE;
+ }
+
+ /**
+ * Main class: parses arguments and prints or edits ACL
+ */
+ public static void main(String[] args) throws IOException {
+ Action action = null;
+ int index = -1;
+ String entryString = null;
+
+ // parse arguments
+ if (args.length < 1 || args[0].equals("-help") || args[0].equals("-?"))
+ usage();
+
+ if (args.length == 1) {
+ action = Action.PRINT;
+ } else {
+ String s = args[0];
+
+ // A[index]+entry
+ if (Pattern.matches("^A[0-9]*\\+.*", s)) {
+ String[] result = s.split("\\+", 2);
+ if (result.length == 2) {
+ if (result[0].length() < 2) {
+ index = 0;
+ } else {
+ index = Integer.parseInt(result[0].substring(1));
+ }
+ entryString = result[1];
+ action = Action.ADD;
+ }
+ }
+
+ // Aindex-
+ if (Pattern.matches("^A[0-9]+\\-", s)) {
+ String[] result = s.split("\\-", 2);
+ if (result.length == 2) {
+ index = Integer.parseInt(result[0].substring(1));
+ entryString = result[1];
+ action = Action.REMOVE;
+ }
+ }
+
+ // Aindex=entry
+ if (Pattern.matches("^A[0-9]+=.*", s)) {
+ String[] result = s.split("=", 2);
+ if (result.length == 2) {
+ index = Integer.parseInt(result[0].substring(1));
+ entryString = result[1];
+ action = Action.REPLACE;
+ }
+ }
+ }
+ if (action == null)
+ usage();
+
+ int fileArg = (action == Action.PRINT) ? 0 : 1;
+ Path file = Paths.get(args[fileArg]);
+
+ // read file's ACL
+ AclFileAttributeView view =
+ Files.getFileAttributeView(file, AclFileAttributeView.class);
+ if (view == null) {
+ System.err.println("ACLs not supported on this platform");
+ System.exit(-1);
+ }
+ List<AclEntry> acl = view.getAcl();
+
+ switch (action) {
+ // print ACL
+ case PRINT : {
+ for (int i=0; i<acl.size(); i++) {
+ System.out.format("%5d: %s\n", i, acl.get(i));
+ }
+ break;
+ }
+
+ // add ACE to existing ACL
+ case ADD: {
+ AclEntry entry = parseAceString(entryString, file
+ .getFileSystem().getUserPrincipalLookupService());
+ if (index >= acl.size()) {
+ acl.add(entry);
+ } else {
+ acl.add(index, entry);
+ }
+ view.setAcl(acl);
+ break;
+ }
+
+ // remove ACE
+ case REMOVE: {
+ if (index >= acl.size()) {
+ System.err.format("Index '%d' is invalid", index);
+ System.exit(-1);
+ }
+ acl.remove(index);
+ view.setAcl(acl);
+ break;
+ }
+
+ // replace ACE
+ case REPLACE: {
+ if (index >= acl.size()) {
+ System.err.format("Index '%d' is invalid", index);
+ System.exit(-1);
+ }
+ AclEntry entry = parseAceString(entryString, file
+ .getFileSystem().getUserPrincipalLookupService());
+ acl.set(index, entry);
+ view.setAcl(acl);
+ break;
+ }
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/file/Chmod.java b/staging/linux-x86/sample/nio/file/Chmod.java
new file mode 100644
index 0000000..05c16b9
--- /dev/null
+++ b/staging/linux-x86/sample/nio/file/Chmod.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import static java.nio.file.attribute.PosixFilePermission.*;
+import static java.nio.file.FileVisitResult.*;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Sample code that changes the permissions of files in a similar manner to the
+ * chmod(1) program.
+ */
+
+public class Chmod {
+
+ /**
+ * Compiles a list of one or more <em>symbolic mode expressions</em> that
+ * may be used to change a set of file permissions. This method is
+ * intended for use where file permissions are required to be changed in
+ * a manner similar to the UNIX <i>chmod</i> program.
+ *
+ * <p> The {@code exprs} parameter is a comma separated list of expressions
+ * where each takes the form:
+ * <blockquote>
+ * <i>who operator</i> [<i>permissions</i>]
+ * </blockquote>
+ * where <i>who</i> is one or more of the characters {@code 'u'}, {@code 'g'},
+ * {@code 'o'}, or {@code 'a'} meaning the owner (user), group, others, or
+ * all (owner, group, and others) respectively.
+ *
+ * <p> <i>operator</i> is the character {@code '+'}, {@code '-'}, or {@code
+ * '='} signifying how permissions are to be changed. {@code '+'} means the
+ * permissions are added, {@code '-'} means the permissions are removed, and
+ * {@code '='} means the permissions are assigned absolutely.
+ *
+ * <p> <i>permissions</i> is a sequence of zero or more of the following:
+ * {@code 'r'} for read permission, {@code 'w'} for write permission, and
+ * {@code 'x'} for execute permission. If <i>permissions</i> is omitted
+ * when assigned absolutely, then the permissions are cleared for
+ * the owner, group, or others as identified by <i>who</i>. When omitted
+ * when adding or removing then the expression is ignored.
+ *
+ * <p> The following examples demonstrate possible values for the {@code
+ * exprs} parameter:
+ *
+ * <table border="0">
+ * <tr>
+ * <td> {@code u=rw} </td>
+ * <td> Sets the owner permissions to be read and write. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code ug+w} </td>
+ * <td> Sets the owner write and group write permissions. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code u+w,o-rwx} </td>
+ * <td> Sets the owner write, and removes the others read, others write
+ * and others execute permissions. </td>
+ * </tr>
+ * <tr>
+ * <td> {@code o=} </td>
+ * <td> Sets the others permission to none (others read, others write and
+ * others execute permissions are removed if set) </td>
+ * </tr>
+ * </table>
+ *
+ * @param exprs
+ * List of one or more <em>symbolic mode expressions</em>
+ *
+ * @return A {@code Changer} that may be used to changer a set of
+ * file permissions
+ *
+ * @throws IllegalArgumentException
+ * If the value of the {@code exprs} parameter is invalid
+ */
+ public static Changer compile(String exprs) {
+ // minimum is who and operator (u= for example)
+ if (exprs.length() < 2)
+ throw new IllegalArgumentException("Invalid mode");
+
+ // permissions that the changer will add or remove
+ final Set<PosixFilePermission> toAdd = new HashSet<PosixFilePermission>();
+ final Set<PosixFilePermission> toRemove = new HashSet<PosixFilePermission>();
+
+ // iterate over each of expression modes
+ for (String expr: exprs.split(",")) {
+ // minimum of who and operator
+ if (expr.length() < 2)
+ throw new IllegalArgumentException("Invalid mode");
+
+ int pos = 0;
+
+ // who
+ boolean u = false;
+ boolean g = false;
+ boolean o = false;
+ boolean done = false;
+ for (;;) {
+ switch (expr.charAt(pos)) {
+ case 'u' : u = true; break;
+ case 'g' : g = true; break;
+ case 'o' : o = true; break;
+ case 'a' : u = true; g = true; o = true; break;
+ default : done = true;
+ }
+ if (done)
+ break;
+ pos++;
+ }
+ if (!u && !g && !o)
+ throw new IllegalArgumentException("Invalid mode");
+
+ // get operator and permissions
+ char op = expr.charAt(pos++);
+ String mask = (expr.length() == pos) ? "" : expr.substring(pos);
+
+ // operator
+ boolean add = (op == '+');
+ boolean remove = (op == '-');
+ boolean assign = (op == '=');
+ if (!add && !remove && !assign)
+ throw new IllegalArgumentException("Invalid mode");
+
+ // who= means remove all
+ if (assign && mask.length() == 0) {
+ assign = false;
+ remove = true;
+ mask = "rwx";
+ }
+
+ // permissions
+ boolean r = false;
+ boolean w = false;
+ boolean x = false;
+ for (int i=0; i<mask.length(); i++) {
+ switch (mask.charAt(i)) {
+ case 'r' : r = true; break;
+ case 'w' : w = true; break;
+ case 'x' : x = true; break;
+ default:
+ throw new IllegalArgumentException("Invalid mode");
+ }
+ }
+
+ // update permissions set
+ if (add) {
+ if (u) {
+ if (r) toAdd.add(OWNER_READ);
+ if (w) toAdd.add(OWNER_WRITE);
+ if (x) toAdd.add(OWNER_EXECUTE);
+ }
+ if (g) {
+ if (r) toAdd.add(GROUP_READ);
+ if (w) toAdd.add(GROUP_WRITE);
+ if (x) toAdd.add(GROUP_EXECUTE);
+ }
+ if (o) {
+ if (r) toAdd.add(OTHERS_READ);
+ if (w) toAdd.add(OTHERS_WRITE);
+ if (x) toAdd.add(OTHERS_EXECUTE);
+ }
+ }
+ if (remove) {
+ if (u) {
+ if (r) toRemove.add(OWNER_READ);
+ if (w) toRemove.add(OWNER_WRITE);
+ if (x) toRemove.add(OWNER_EXECUTE);
+ }
+ if (g) {
+ if (r) toRemove.add(GROUP_READ);
+ if (w) toRemove.add(GROUP_WRITE);
+ if (x) toRemove.add(GROUP_EXECUTE);
+ }
+ if (o) {
+ if (r) toRemove.add(OTHERS_READ);
+ if (w) toRemove.add(OTHERS_WRITE);
+ if (x) toRemove.add(OTHERS_EXECUTE);
+ }
+ }
+ if (assign) {
+ if (u) {
+ if (r) toAdd.add(OWNER_READ);
+ else toRemove.add(OWNER_READ);
+ if (w) toAdd.add(OWNER_WRITE);
+ else toRemove.add(OWNER_WRITE);
+ if (x) toAdd.add(OWNER_EXECUTE);
+ else toRemove.add(OWNER_EXECUTE);
+ }
+ if (g) {
+ if (r) toAdd.add(GROUP_READ);
+ else toRemove.add(GROUP_READ);
+ if (w) toAdd.add(GROUP_WRITE);
+ else toRemove.add(GROUP_WRITE);
+ if (x) toAdd.add(GROUP_EXECUTE);
+ else toRemove.add(GROUP_EXECUTE);
+ }
+ if (o) {
+ if (r) toAdd.add(OTHERS_READ);
+ else toRemove.add(OTHERS_READ);
+ if (w) toAdd.add(OTHERS_WRITE);
+ else toRemove.add(OTHERS_WRITE);
+ if (x) toAdd.add(OTHERS_EXECUTE);
+ else toRemove.add(OTHERS_EXECUTE);
+ }
+ }
+ }
+
+ // return changer
+ return new Changer() {
+ @Override
+ public Set<PosixFilePermission> change(Set<PosixFilePermission> perms) {
+ perms.addAll(toAdd);
+ perms.removeAll(toRemove);
+ return perms;
+ }
+ };
+ }
+
+ /**
+ * A task that <i>changes</i> a set of {@link PosixFilePermission} elements.
+ */
+ public interface Changer {
+ /**
+ * Applies the changes to the given set of permissions.
+ *
+ * @param perms
+ * The set of permissions to change
+ *
+ * @return The {@code perms} parameter
+ */
+ Set<PosixFilePermission> change(Set<PosixFilePermission> perms);
+ }
+
+ /**
+ * Changes the permissions of the file using the given Changer.
+ */
+ static void chmod(Path file, Changer changer) {
+ try {
+ Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file);
+ Files.setPosixFilePermissions(file, changer.change(perms));
+ } catch (IOException x) {
+ System.err.println(x);
+ }
+ }
+
+ /**
+ * Changes the permission of each file and directory visited
+ */
+ static class TreeVisitor implements FileVisitor<Path> {
+ private final Changer changer;
+
+ TreeVisitor(Changer changer) {
+ this.changer = changer;
+ }
+
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+ chmod(dir, changer);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+ chmod(file, changer);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
+ if (exc != null)
+ System.err.println("WARNING: " + exc);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) {
+ System.err.println("WARNING: " + exc);
+ return CONTINUE;
+ }
+ }
+
+ static void usage() {
+ System.err.println("java Chmod [-R] symbolic-mode-list file...");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ if (args.length < 2)
+ usage();
+ int argi = 0;
+ int maxDepth = 0;
+ if (args[argi].equals("-R")) {
+ if (args.length < 3)
+ usage();
+ argi++;
+ maxDepth = Integer.MAX_VALUE;
+ }
+
+ // compile the symbolic mode expressions
+ Changer changer = compile(args[argi++]);
+ TreeVisitor visitor = new TreeVisitor(changer);
+
+ Set<FileVisitOption> opts = Collections.emptySet();
+ while (argi < args.length) {
+ Path file = Paths.get(args[argi]);
+ Files.walkFileTree(file, opts, maxDepth, visitor);
+ argi++;
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/file/Copy.java b/staging/linux-x86/sample/nio/file/Copy.java
new file mode 100644
index 0000000..0d61ef3
--- /dev/null
+++ b/staging/linux-x86/sample/nio/file/Copy.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import static java.nio.file.StandardCopyOption.*;
+import java.nio.file.attribute.*;
+import static java.nio.file.FileVisitResult.*;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Sample code that copies files in a similar manner to the cp(1) program.
+ */
+
+public class Copy {
+
+ /**
+ * Returns {@code true} if okay to overwrite a file ("cp -i")
+ */
+ static boolean okayToOverwrite(Path file) {
+ String answer = System.console().readLine("overwrite %s (yes/no)? ", file);
+ return (answer.equalsIgnoreCase("y") || answer.equalsIgnoreCase("yes"));
+ }
+
+ /**
+ * Copy source file to target location. If {@code prompt} is true then
+ * prompt user to overwrite target if it exists. The {@code preserve}
+ * parameter determines if file attributes should be copied/preserved.
+ */
+ static void copyFile(Path source, Path target, boolean prompt, boolean preserve) {
+ CopyOption[] options = (preserve) ?
+ new CopyOption[] { COPY_ATTRIBUTES, REPLACE_EXISTING } :
+ new CopyOption[] { REPLACE_EXISTING };
+ if (!prompt || Files.notExists(target) || okayToOverwrite(target)) {
+ try {
+ Files.copy(source, target, options);
+ } catch (IOException x) {
+ System.err.format("Unable to copy: %s: %s%n", source, x);
+ }
+ }
+ }
+
+ /**
+ * A {@code FileVisitor} that copies a file-tree ("cp -r")
+ */
+ static class TreeCopier implements FileVisitor<Path> {
+ private final Path source;
+ private final Path target;
+ private final boolean prompt;
+ private final boolean preserve;
+
+ TreeCopier(Path source, Path target, boolean prompt, boolean preserve) {
+ this.source = source;
+ this.target = target;
+ this.prompt = prompt;
+ this.preserve = preserve;
+ }
+
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+ // before visiting entries in a directory we copy the directory
+ // (okay if directory already exists).
+ CopyOption[] options = (preserve) ?
+ new CopyOption[] { COPY_ATTRIBUTES } : new CopyOption[0];
+
+ Path newdir = target.resolve(source.relativize(dir));
+ try {
+ Files.copy(dir, newdir, options);
+ } catch (FileAlreadyExistsException x) {
+ // ignore
+ } catch (IOException x) {
+ System.err.format("Unable to create: %s: %s%n", newdir, x);
+ return SKIP_SUBTREE;
+ }
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+ copyFile(file, target.resolve(source.relativize(file)),
+ prompt, preserve);
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
+ // fix up modification time of directory when done
+ if (exc == null && preserve) {
+ Path newdir = target.resolve(source.relativize(dir));
+ try {
+ FileTime time = Files.getLastModifiedTime(dir);
+ Files.setLastModifiedTime(newdir, time);
+ } catch (IOException x) {
+ System.err.format("Unable to copy all attributes to: %s: %s%n", newdir, x);
+ }
+ }
+ return CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) {
+ if (exc instanceof FileSystemLoopException) {
+ System.err.println("cycle detected: " + file);
+ } else {
+ System.err.format("Unable to copy: %s: %s%n", file, exc);
+ }
+ return CONTINUE;
+ }
+ }
+
+ static void usage() {
+ System.err.println("java Copy [-ip] source... target");
+ System.err.println("java Copy -r [-ip] source-dir... target");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ boolean recursive = false;
+ boolean prompt = false;
+ boolean preserve = false;
+
+ // process options
+ int argi = 0;
+ while (argi < args.length) {
+ String arg = args[argi];
+ if (!arg.startsWith("-"))
+ break;
+ if (arg.length() < 2)
+ usage();
+ for (int i=1; i<arg.length(); i++) {
+ char c = arg.charAt(i);
+ switch (c) {
+ case 'r' : recursive = true; break;
+ case 'i' : prompt = true; break;
+ case 'p' : preserve = true; break;
+ default : usage();
+ }
+ }
+ argi++;
+ }
+
+ // remaining arguments are the source files(s) and the target location
+ int remaining = args.length - argi;
+ if (remaining < 2)
+ usage();
+ Path[] source = new Path[remaining-1];
+ int i=0;
+ while (remaining > 1) {
+ source[i++] = Paths.get(args[argi++]);
+ remaining--;
+ }
+ Path target = Paths.get(args[argi]);
+
+ // check if target is a directory
+ boolean isDir = Files.isDirectory(target);
+
+ // copy each source file/directory to target
+ for (i=0; i<source.length; i++) {
+ Path dest = (isDir) ? target.resolve(source[i].getFileName()) : target;
+
+ if (recursive) {
+ // follow links when copying files
+ EnumSet<FileVisitOption> opts = EnumSet.of(FileVisitOption.FOLLOW_LINKS);
+ TreeCopier tc = new TreeCopier(source[i], dest, prompt, preserve);
+ Files.walkFileTree(source[i], opts, Integer.MAX_VALUE, tc);
+ } else {
+ // not recursive so source must not be a directory
+ if (Files.isDirectory(source[i])) {
+ System.err.format("%s: is a directory%n", source[i]);
+ continue;
+ }
+ copyFile(source[i], dest, prompt, preserve);
+ }
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/file/DiskUsage.java b/staging/linux-x86/sample/nio/file/DiskUsage.java
new file mode 100644
index 0000000..7d30bdf
--- /dev/null
+++ b/staging/linux-x86/sample/nio/file/DiskUsage.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+
+/**
+ * Example utility that works like the df(1M) program to print out disk space
+ * information
+ */
+
+public class DiskUsage {
+
+ static final long K = 1024;
+
+ static void printFileStore(FileStore store) throws IOException {
+ long total = store.getTotalSpace() / K;
+ long used = (store.getTotalSpace() - store.getUnallocatedSpace()) / K;
+ long avail = store.getUsableSpace() / K;
+
+ String s = store.toString();
+ if (s.length() > 20) {
+ System.out.println(s);
+ s = "";
+ }
+ System.out.format("%-20s %12d %12d %12d\n", s, total, used, avail);
+ }
+
+ public static void main(String[] args) throws IOException {
+ System.out.format("%-20s %12s %12s %12s\n", "Filesystem", "kbytes", "used", "avail");
+ if (args.length == 0) {
+ FileSystem fs = FileSystems.getDefault();
+ for (FileStore store: fs.getFileStores()) {
+ printFileStore(store);
+ }
+ } else {
+ for (String file: args) {
+ FileStore store = Files.getFileStore(Paths.get(file));
+ printFileStore(store);
+ }
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/file/FileType.java b/staging/linux-x86/sample/nio/file/FileType.java
new file mode 100644
index 0000000..d001d60
--- /dev/null
+++ b/staging/linux-x86/sample/nio/file/FileType.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import java.io.IOException;
+
+public class FileType {
+ public static void main(String[] args) throws IOException {
+ if (args.length == 0) {
+ System.err.println("usage: java FileType file...");
+ System.exit(-1);
+ }
+ for (String arg: args) {
+ Path file = Paths.get(arg);
+ String type;
+ if (Files.isDirectory(file)) {
+ type = "directory";
+ } else {
+ type = Files.probeContentType(file);
+ if (type == null)
+ type = "<not recognized>";
+ }
+ System.out.format("%s\t%s%n", file, type);
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/file/WatchDir.java b/staging/linux-x86/sample/nio/file/WatchDir.java
new file mode 100644
index 0000000..4c73820
--- /dev/null
+++ b/staging/linux-x86/sample/nio/file/WatchDir.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.file.*;
+import static java.nio.file.StandardWatchEventKinds.*;
+import static java.nio.file.LinkOption.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+
+/**
+ * Example to watch a directory (or tree) for changes to files.
+ */
+
+public class WatchDir {
+
+ private final WatchService watcher;
+ private final boolean recursive;
+ private boolean trace = false;
+ private int count;
+
+ @SuppressWarnings("unchecked")
+ static <T> WatchEvent<T> cast(WatchEvent<?> event) {
+ return (WatchEvent<T>)event;
+ }
+
+ /**
+ * Register the given directory with the WatchService
+ */
+ private void register(Path dir) throws IOException {
+ WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
+ count++;
+ if (trace)
+ System.out.format("register: %s\n", dir);
+ }
+
+ /**
+ * Register the given directory, and all its sub-directories, with the
+ * WatchService.
+ */
+ private void registerAll(final Path start) throws IOException {
+ // register directory and sub-directories
+ Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
+ throws IOException
+ {
+ register(dir);
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ }
+
+ /**
+ * Creates a WatchService and registers the given directory
+ */
+ WatchDir(Path dir, boolean recursive) throws IOException {
+ this.watcher = FileSystems.getDefault().newWatchService();
+ this.recursive = recursive;
+
+ if (recursive) {
+ System.out.format("Scanning %s ...\n", dir);
+ registerAll(dir);
+ System.out.println("Done.");
+ } else {
+ register(dir);
+ }
+
+ // enable trace after initial registration
+ this.trace = true;
+ }
+
+ /**
+ * Process all events for keys queued to the watcher
+ */
+ void processEvents() {
+ for (;;) {
+
+ // wait for key to be signalled
+ WatchKey key;
+ try {
+ key = watcher.take();
+ } catch (InterruptedException x) {
+ return;
+ }
+
+ for (WatchEvent<?> event: key.pollEvents()) {
+ WatchEvent.Kind kind = event.kind();
+
+ // TBD - provide example of how OVERFLOW event is handled
+ if (kind == OVERFLOW) {
+ continue;
+ }
+
+ // Context for directory entry event is the file name of entry
+ WatchEvent<Path> ev = cast(event);
+ Path name = ev.context();
+ Path child = ((Path)key.watchable()).resolve(name);
+
+ // print out event
+ System.out.format("%s: %s\n", event.kind().name(), child);
+
+ // if directory is created, and watching recursively, then
+ // register it and its sub-directories
+ if (recursive && (kind == ENTRY_CREATE)) {
+ try {
+ if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
+ registerAll(child);
+ }
+ } catch (IOException x) {
+ // ignore to keep sample readbale
+ }
+ }
+ }
+
+ // reset key
+ boolean valid = key.reset();
+ if (!valid) {
+ // directory no longer accessible
+ count--;
+ if (count == 0)
+ break;
+ }
+ }
+ }
+
+ static void usage() {
+ System.err.println("usage: java WatchDir [-r] dir");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ // parse arguments
+ if (args.length == 0 || args.length > 2)
+ usage();
+ boolean recursive = false;
+ int dirArg = 0;
+ if (args[0].equals("-r")) {
+ if (args.length < 2)
+ usage();
+ recursive = true;
+ dirArg++;
+ }
+
+ // register directory and process its events
+ Path dir = Paths.get(args[dirArg]);
+ new WatchDir(dir, recursive).processEvents();
+ }
+}
diff --git a/staging/linux-x86/sample/nio/file/Xdd.java b/staging/linux-x86/sample/nio/file/Xdd.java
new file mode 100644
index 0000000..c0c7f87
--- /dev/null
+++ b/staging/linux-x86/sample/nio/file/Xdd.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.file.*;
+import java.nio.file.attribute.*;
+import java.io.IOException;
+
+/**
+ * Example code to list/set/get/delete the user-defined attributes of a file.
+ */
+
+public class Xdd {
+
+ static void usage() {
+ System.out.println("Usage: java Xdd <file>");
+ System.out.println(" java Xdd -set <name>=<value> <file>");
+ System.out.println(" java Xdd -get <name> <file>");
+ System.out.println(" java Xdd -del <name> <file>");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ // one or three parameters
+ if (args.length != 1 && args.length != 3)
+ usage();
+
+ Path file = (args.length == 1) ?
+ Paths.get(args[0]) : Paths.get(args[2]);
+
+ // check that user defined attributes are supported by the file store
+ FileStore store = Files.getFileStore(file);
+ if (!store.supportsFileAttributeView(UserDefinedFileAttributeView.class)) {
+ System.err.format("UserDefinedFileAttributeView not supported on %s\n", store);
+ System.exit(-1);
+
+ }
+ UserDefinedFileAttributeView view =
+ Files.getFileAttributeView(file, UserDefinedFileAttributeView.class);
+
+ // list user defined attributes
+ if (args.length == 1) {
+ System.out.println(" Size Name");
+ System.out.println("-------- --------------------------------------");
+ for (String name: view.list()) {
+ System.out.format("%8d %s\n", view.size(name), name);
+ }
+ return;
+ }
+
+ // Add/replace a file's user defined attribute
+ if (args[0].equals("-set")) {
+ // name=value
+ String[] s = args[1].split("=");
+ if (s.length != 2)
+ usage();
+ String name = s[0];
+ String value = s[1];
+ view.write(name, Charset.defaultCharset().encode(value));
+ return;
+ }
+
+ // Print out the value of a file's user defined attribute
+ if (args[0].equals("-get")) {
+ String name = args[1];
+ int size = view.size(name);
+ ByteBuffer buf = ByteBuffer.allocateDirect(size);
+ view.read(name, buf);
+ buf.flip();
+ System.out.println(Charset.defaultCharset().decode(buf).toString());
+ return;
+ }
+
+ // Delete a file's user defined attribute
+ if (args[0].equals("-del")) {
+ view.delete(args[1]);
+ return;
+ }
+
+ // option not recognized
+ usage();
+ }
+ }
diff --git a/staging/linux-x86/sample/nio/multicast/MulticastAddress.java b/staging/linux-x86/sample/nio/multicast/MulticastAddress.java
new file mode 100644
index 0000000..05f5ca5
--- /dev/null
+++ b/staging/linux-x86/sample/nio/multicast/MulticastAddress.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.UnknownHostException;
+import java.net.SocketException;
+
+/**
+ * Parses and represents a multicast address.
+ */
+
+class MulticastAddress {
+ private final InetAddress group;
+ private final int port;
+ private final NetworkInterface interf;
+
+ private MulticastAddress(InetAddress group, int port, NetworkInterface interf) {
+ this.group = group;
+ this.port = port;
+ this.interf = interf;
+ }
+
+ InetAddress group() {
+ return group;
+ }
+
+ int port() {
+ return port;
+ }
+
+ /**
+ * @return The network interface, may be {@code null}
+ */
+ NetworkInterface interf() {
+ return interf;
+ }
+
+ /**
+ * Parses a string of the form "group:port[@interface]", returning
+ * a MulticastAddress representing the address
+ */
+ static MulticastAddress parse(String s) {
+ String[] components = s.split("@");
+ if (components.length > 2)
+ throw new IllegalArgumentException("At most one '@' expected");
+
+ // get group and port
+ String target = components[0];
+ int len = components[0].length();
+ int colon = components[0].lastIndexOf(':');
+ if ((colon < 1) || (colon > (len-2)))
+ throw new IllegalArgumentException("group:port expected");
+ String groupString = target.substring(0, colon);
+ int port = -1;
+ try {
+ port = Integer.parseInt(target.substring(colon+1, len));
+ } catch (NumberFormatException x) {
+ throw new IllegalArgumentException(x);
+ }
+
+ // handle IPv6 literal address
+ if (groupString.charAt(0) == '[') {
+ len = groupString.length();
+ if (groupString.charAt(len-1) != ']')
+ throw new IllegalArgumentException("missing ']'");
+ groupString = groupString.substring(1,len-1);
+ if (groupString.length() == 0)
+ throw new IllegalArgumentException("missing IPv6 address");
+ }
+
+ // get group address
+ InetAddress group = null;
+ try {
+ group = InetAddress.getByName(groupString);
+ } catch (UnknownHostException x) {
+ throw new IllegalArgumentException(x);
+ }
+ if (!group.isMulticastAddress()) {
+ throw new IllegalArgumentException("'" + group.getHostAddress() +
+ "' is not multicast address");
+ }
+
+ // optional interface
+ NetworkInterface interf = null;
+ if (components.length == 2) {
+ try {
+ interf = NetworkInterface.getByName(components[1]);
+ } catch (SocketException x) {
+ throw new IllegalArgumentException(x);
+ }
+ if (interf == null) {
+ throw new IllegalArgumentException("'" + components[1] +
+ "' is not valid interface");
+ }
+ }
+ return new MulticastAddress(group, port, interf);
+ }
+}
diff --git a/staging/linux-x86/sample/nio/multicast/Reader.java b/staging/linux-x86/sample/nio/multicast/Reader.java
new file mode 100644
index 0000000..303c356
--- /dev/null
+++ b/staging/linux-x86/sample/nio/multicast/Reader.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+import java.nio.charset.*;
+import java.nio.ByteBuffer;
+import java.net.*;
+import java.io.IOException;
+import java.util.*;
+
+public class Reader {
+
+ static void usage() {
+ System.err.println("usage: java Reader group:port@interf [-only source...] [-block source...]");
+ System.exit(-1);
+ }
+
+ static void printDatagram(SocketAddress sa, ByteBuffer buf) {
+ System.out.format("-- datagram from %s --\n",
+ ((InetSocketAddress)sa).getAddress().getHostAddress());
+ System.out.println(Charset.defaultCharset().decode(buf));
+ }
+
+ static void parseAddessList(String s, List<InetAddress> list)
+ throws UnknownHostException
+ {
+ String[] sources = s.split(",");
+ for (int i=0; i<sources.length; i++) {
+ list.add(InetAddress.getByName(sources[i]));
+ }
+ }
+
+ public static void main(String[] args) throws IOException {
+ if (args.length == 0)
+ usage();
+
+ // first parameter is the multicast address (interface required)
+ MulticastAddress target = MulticastAddress.parse(args[0]);
+ if (target.interf() == null)
+ usage();
+
+ // addition arguments are source addresses to include or exclude
+ List<InetAddress> includeList = new ArrayList<InetAddress>();
+ List<InetAddress> excludeList = new ArrayList<InetAddress>();
+ int argc = 1;
+ while (argc < args.length) {
+ String option = args[argc++];
+ if (argc >= args.length)
+ usage();
+ String value = args[argc++];
+ if (option.equals("-only")) {
+ parseAddessList(value, includeList);
+ continue;
+ }
+ if (option.equals("-block")) {
+ parseAddessList(value, excludeList);
+ continue;
+ }
+ usage();
+ }
+ if (!includeList.isEmpty() && !excludeList.isEmpty()) {
+ usage();
+ }
+
+ // create and bind socket
+ ProtocolFamily family = StandardProtocolFamily.INET;
+ if (target.group() instanceof Inet6Address) {
+ family = StandardProtocolFamily.INET6;
+ }
+ DatagramChannel dc = DatagramChannel.open(family)
+ .setOption(StandardSocketOptions.SO_REUSEADDR, true)
+ .bind(new InetSocketAddress(target.port()));
+
+ if (includeList.isEmpty()) {
+ // join group and block addresses on the exclude list
+ MembershipKey key = dc.join(target.group(), target.interf());
+ for (InetAddress source: excludeList) {
+ key.block(source);
+ }
+ } else {
+ // join with source-specific membership for each source
+ for (InetAddress source: includeList) {
+ dc.join(target.group(), target.interf(), source);
+ }
+ }
+
+ // register socket with Selector
+ Selector sel = Selector.open();
+ dc.configureBlocking(false);
+ dc.register(sel, SelectionKey.OP_READ);
+
+ // print out each datagram that we receive
+ ByteBuffer buf = ByteBuffer.allocateDirect(4096);
+ for (;;) {
+ int updated = sel.select();
+ if (updated > 0) {
+ Iterator<SelectionKey> iter = sel.selectedKeys().iterator();
+ while (iter.hasNext()) {
+ SelectionKey sk = iter.next();
+ iter.remove();
+
+ DatagramChannel ch = (DatagramChannel)sk.channel();
+ SocketAddress sa = ch.receive(buf);
+ if (sa != null) {
+ buf.flip();
+ printDatagram(sa, buf);
+ buf.rewind();
+ buf.limit(buf.capacity());
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/multicast/Sender.java b/staging/linux-x86/sample/nio/multicast/Sender.java
new file mode 100644
index 0000000..f8685f6
--- /dev/null
+++ b/staging/linux-x86/sample/nio/multicast/Sender.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+import java.nio.charset.Charset;
+import java.net.*;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Sample multicast sender to send a message in a multicast datagram
+ * to a given group.
+ */
+
+public class Sender {
+
+ private static void usage() {
+ System.err.println("usage: java Sender group:port[@interface] message");
+ System.exit(-1);
+ }
+
+ public static void main(String[] args) throws IOException {
+ if (args.length < 2)
+ usage();
+
+ MulticastAddress target = MulticastAddress.parse(args[0]);
+
+ // create socket
+ ProtocolFamily family = StandardProtocolFamily.INET;
+ if (target.group() instanceof Inet6Address)
+ family = StandardProtocolFamily.INET6;
+ DatagramChannel dc = DatagramChannel.open(family).bind(new InetSocketAddress(0));
+ if (target.interf() != null) {
+ dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, target.interf());
+ }
+
+ // send multicast packet
+ dc.send(Charset.defaultCharset().encode(args[1]),
+ new InetSocketAddress(target.group(), target.port()));
+ dc.close();
+ }
+
+}
diff --git a/staging/linux-x86/sample/nio/server/AcceptHandler.java b/staging/linux-x86/sample/nio/server/AcceptHandler.java
new file mode 100644
index 0000000..41c2570
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/AcceptHandler.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import javax.net.ssl.*;
+
+/**
+ * A single threaded Handler that performs accepts SocketChannels and
+ * registers the Channels with the read/write Selector.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class AcceptHandler implements Handler {
+
+ private ServerSocketChannel channel;
+ private Dispatcher dsp;
+
+ private SSLContext sslContext;
+
+ AcceptHandler(ServerSocketChannel ssc, Dispatcher dsp,
+ SSLContext sslContext) {
+ channel = ssc;
+ this.dsp = dsp;
+ this.sslContext = sslContext;
+ }
+
+ public void handle(SelectionKey sk) throws IOException {
+
+ if (!sk.isAcceptable())
+ return;
+
+ SocketChannel sc = channel.accept();
+ if (sc == null) {
+ return;
+ }
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, false /* non-blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, false /* non-blocking */));
+
+ RequestHandler rh = new RequestHandler(cio);
+ dsp.register(cio.getSocketChannel(), SelectionKey.OP_READ, rh);
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/Acceptor.java b/staging/linux-x86/sample/nio/server/Acceptor.java
new file mode 100644
index 0000000..cfdaf0e
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Acceptor.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import javax.net.ssl.*;
+
+/**
+ * A Runnable class which sits in a loop accepting SocketChannels,
+ * then registers the Channels with the read/write Selector.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Acceptor implements Runnable {
+
+ private ServerSocketChannel ssc;
+ private Dispatcher d;
+
+ private SSLContext sslContext;
+
+ Acceptor(ServerSocketChannel ssc, Dispatcher d, SSLContext sslContext) {
+ this.ssc = ssc;
+ this.d = d;
+ this.sslContext = sslContext;
+ }
+
+ public void run() {
+ for (;;) {
+ try {
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, false /* non-blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, false /* non-blocking */));
+
+ RequestHandler rh = new RequestHandler(cio);
+
+ d.register(cio.getSocketChannel(), SelectionKey.OP_READ, rh);
+
+ } catch (IOException x) {
+ x.printStackTrace();
+ break;
+ }
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/B1.java b/staging/linux-x86/sample/nio/server/B1.java
new file mode 100644
index 0000000..c6d7e90
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/B1.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+
+/**
+ * A blocking/single-threaded server which completely services
+ * each connection before moving to the next.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class B1 extends Server {
+
+ B1(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws Exception {
+ for (;;) {
+
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, true /* blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, true /* blocking */));
+
+ RequestServicer svc = new RequestServicer(cio);
+ svc.run();
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/BN.java b/staging/linux-x86/sample/nio/server/BN.java
new file mode 100644
index 0000000..c765a8b
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/BN.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+
+/**
+ * A Blocking/Multi-threaded Server which creates a new thread for each
+ * connection. This is not efficient for large numbers of connections.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class BN extends Server {
+
+ BN(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws IOException {
+ for (;;) {
+
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, true /* blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, true /* blocking */));
+
+ RequestServicer svc = new RequestServicer(cio);
+ Thread th = new Thread(svc);
+ th.start();
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/BP.java b/staging/linux-x86/sample/nio/server/BP.java
new file mode 100644
index 0000000..9540f1c
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/BP.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+import java.util.concurrent.*;
+
+/**
+ * A multi-threaded server which creates a pool of threads for use
+ * by the server. The Thread pool decides how to schedule those threads.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class BP extends Server {
+
+ private static final int POOL_MULTIPLE = 4;
+
+ BP(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws Exception {
+
+ ExecutorService xec = Executors.newFixedThreadPool(
+ Runtime.getRuntime().availableProcessors() * POOL_MULTIPLE);
+
+ for (;;) {
+
+ SocketChannel sc = ssc.accept();
+
+ ChannelIO cio = (sslContext != null ?
+ ChannelIOSecure.getInstance(
+ sc, true /* blocking */, sslContext) :
+ ChannelIO.getInstance(
+ sc, true /* blocking */));
+
+ RequestServicer svc = new RequestServicer(cio);
+ xec.execute(svc);
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/ChannelIO.java b/staging/linux-x86/sample/nio/server/ChannelIO.java
new file mode 100644
index 0000000..7d1ca18
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/ChannelIO.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+
+/**
+ * A helper class for properly sizing inbound byte buffers and
+ * redirecting I/O calls to the proper SocketChannel call.
+ * <P>
+ * Many of these calls may seem unnecessary until you consider
+ * that they are placeholders for the secure variant, which is much
+ * more involved. See ChannelIOSecure for more information.
+ *
+ * @author Brad R. Wetmore
+ * @author Mark Reinhold
+ */
+class ChannelIO {
+
+ protected SocketChannel sc;
+
+ /*
+ * All of the inbound request data lives here until we determine
+ * that we've read everything, then we pass that data back to the
+ * caller.
+ */
+ protected ByteBuffer requestBB;
+ static private int requestBBSize = 4096;
+
+ protected ChannelIO(SocketChannel sc, boolean blocking)
+ throws IOException {
+ this.sc = sc;
+ sc.configureBlocking(blocking);
+ }
+
+ static ChannelIO getInstance(SocketChannel sc, boolean blocking)
+ throws IOException {
+ ChannelIO cio = new ChannelIO(sc, blocking);
+ cio.requestBB = ByteBuffer.allocate(requestBBSize);
+
+ return cio;
+ }
+
+ SocketChannel getSocketChannel() {
+ return sc;
+ }
+
+ /*
+ * Return a ByteBuffer with "remaining" space to work. If you have to
+ * reallocate the ByteBuffer, copy the existing info into the new buffer.
+ */
+ protected void resizeRequestBB(int remaining) {
+ if (requestBB.remaining() < remaining) {
+ // Expand buffer for large request
+ ByteBuffer bb = ByteBuffer.allocate(requestBB.capacity() * 2);
+ requestBB.flip();
+ bb.put(requestBB);
+ requestBB = bb;
+ }
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * This variant is for Servers without SelectionKeys (e.g.
+ * blocking).
+ * <P>
+ * return true when we're done with handshaking.
+ */
+ boolean doHandshake() throws IOException {
+ return true;
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * This variant is for Servers with SelectionKeys, so that
+ * we can register for selectable operations (e.g. selectable
+ * non-blocking).
+ * <P>
+ * return true when we're done with handshaking.
+ */
+ boolean doHandshake(SelectionKey sk) throws IOException {
+ return true;
+ }
+
+ /*
+ * Resize (if necessary) the inbound data buffer, and then read more
+ * data into the read buffer.
+ */
+ int read() throws IOException {
+ /*
+ * Allocate more space if less than 5% remains
+ */
+ resizeRequestBB(requestBBSize/20);
+ return sc.read(requestBB);
+ }
+
+ /*
+ * All data has been read, pass back the request in one buffer.
+ */
+ ByteBuffer getReadBuf() {
+ return requestBB;
+ }
+
+ /*
+ * Write the src buffer into the socket channel.
+ */
+ int write(ByteBuffer src) throws IOException {
+ return sc.write(src);
+ }
+
+ /*
+ * Perform a FileChannel.TransferTo on the socket channel.
+ */
+ long transferTo(FileChannel fc, long pos, long len) throws IOException {
+ return fc.transferTo(pos, len, sc);
+ }
+
+ /*
+ * Flush any outstanding data to the network if possible.
+ * <P>
+ * This isn't really necessary for the insecure variant, but needed
+ * for the secure one where intermediate buffering must take place.
+ * <P>
+ * Return true if successful.
+ */
+ boolean dataFlush() throws IOException {
+ return true;
+ }
+
+ /*
+ * Start any connection shutdown processing.
+ * <P>
+ * This isn't really necessary for the insecure variant, but needed
+ * for the secure one where intermediate buffering must take place.
+ * <P>
+ * Return true if successful, and the data has been flushed.
+ */
+ boolean shutdown() throws IOException {
+ return true;
+ }
+
+ /*
+ * Close the underlying connection.
+ */
+ void close() throws IOException {
+ sc.close();
+ }
+
+}
diff --git a/staging/linux-x86/sample/nio/server/ChannelIOSecure.java b/staging/linux-x86/sample/nio/server/ChannelIOSecure.java
new file mode 100644
index 0000000..7508966
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/ChannelIOSecure.java
@@ -0,0 +1,650 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+
+/**
+ * A helper class which performs I/O using the SSLEngine API.
+ * <P>
+ * Each connection has a SocketChannel and a SSLEngine that is
+ * used through the lifetime of the Channel. We allocate byte buffers
+ * for use as the outbound and inbound network buffers.
+ *
+ * <PRE>
+ * Application Data
+ * src requestBB
+ * | ^
+ * | | |
+ * v | |
+ * +----+-----|-----+----+
+ * | | |
+ * | SSL|Engine |
+ * wrap() | | | unwrap()
+ * | OUTBOUND | INBOUND |
+ * | | |
+ * +----+-----|-----+----+
+ * | | ^
+ * | | |
+ * v |
+ * outNetBB inNetBB
+ * Net data
+ * </PRE>
+ *
+ * These buffers handle all of the intermediary data for the SSL
+ * connection. To make things easy, we'll require outNetBB be
+ * completely flushed before trying to wrap any more data, but we
+ * could certainly remove that restriction by using larger buffers.
+ * <P>
+ * There are many, many ways to handle compute and I/O strategies.
+ * What follows is a relatively simple one. The reader is encouraged
+ * to develop the strategy that best fits the application.
+ * <P>
+ * In most of the non-blocking operations in this class, we let the
+ * Selector tell us when we're ready to attempt an I/O operation (by the
+ * application repeatedly calling our methods). Another option would be
+ * to attempt the operation and return from the method when no forward
+ * progress can be made.
+ * <P>
+ * There's lots of room for enhancements and improvement in this example.
+ * <P>
+ * We're checking for SSL/TLS end-of-stream truncation attacks via
+ * sslEngine.closeInbound(). When you reach the end of a input stream
+ * via a read() returning -1 or an IOException, we call
+ * sslEngine.closeInbound() to signal to the sslEngine that no more
+ * input will be available. If the peer's close_notify message has not
+ * yet been received, this could indicate a trucation attack, in which
+ * an attacker is trying to prematurely close the connection. The
+ * closeInbound() will throw an exception if this condition were
+ * present.
+ *
+ * @author Brad R. Wetmore
+ * @author Mark Reinhold
+ */
+class ChannelIOSecure extends ChannelIO {
+
+ private SSLEngine sslEngine = null;
+
+ private int appBBSize;
+ private int netBBSize;
+
+ /*
+ * All I/O goes through these buffers.
+ * <P>
+ * It might be nice to use a cache of ByteBuffers so we're
+ * not alloc/dealloc'ing ByteBuffer's for each new SSLEngine.
+ * <P>
+ * We use our superclass' requestBB for our application input buffer.
+ * Outbound application data is supplied to us by our callers.
+ */
+ private ByteBuffer inNetBB;
+ private ByteBuffer outNetBB;
+
+ /*
+ * An empty ByteBuffer for use when one isn't available, say
+ * as a source buffer during initial handshake wraps or for close
+ * operations.
+ */
+ private static ByteBuffer hsBB = ByteBuffer.allocate(0);
+
+ /*
+ * The FileChannel we're currently transferTo'ing (reading).
+ */
+ private ByteBuffer fileChannelBB = null;
+
+ /*
+ * During our initial handshake, keep track of the next
+ * SSLEngine operation that needs to occur:
+ *
+ * NEED_WRAP/NEED_UNWRAP
+ *
+ * Once the initial handshake has completed, we can short circuit
+ * handshake checks with initialHSComplete.
+ */
+ private HandshakeStatus initialHSStatus;
+ private boolean initialHSComplete;
+
+ /*
+ * We have received the shutdown request by our caller, and have
+ * closed our outbound side.
+ */
+ private boolean shutdown = false;
+
+ /*
+ * Constructor for a secure ChannelIO variant.
+ */
+ protected ChannelIOSecure(SocketChannel sc, boolean blocking,
+ SSLContext sslc) throws IOException {
+ super(sc, blocking);
+
+ /*
+ * We're a server, so no need to use host/port variant.
+ *
+ * The first call for a server is a NEED_UNWRAP.
+ */
+ sslEngine = sslc.createSSLEngine();
+ sslEngine.setUseClientMode(false);
+ initialHSStatus = HandshakeStatus.NEED_UNWRAP;
+ initialHSComplete = false;
+
+ // Create a buffer using the normal expected packet size we'll
+ // be getting. This may change, depending on the peer's
+ // SSL implementation.
+ netBBSize = sslEngine.getSession().getPacketBufferSize();
+ inNetBB = ByteBuffer.allocate(netBBSize);
+ outNetBB = ByteBuffer.allocate(netBBSize);
+ outNetBB.position(0);
+ outNetBB.limit(0);
+ }
+
+ /*
+ * Static factory method for creating a secure ChannelIO object.
+ * <P>
+ * We need to allocate different sized application data buffers
+ * based on whether we're secure or not. We can't determine
+ * this until our sslEngine is created.
+ */
+ static ChannelIOSecure getInstance(SocketChannel sc, boolean blocking,
+ SSLContext sslc) throws IOException {
+
+ ChannelIOSecure cio = new ChannelIOSecure(sc, blocking, sslc);
+
+ // Create a buffer using the normal expected application size we'll
+ // be getting. This may change, depending on the peer's
+ // SSL implementation.
+ cio.appBBSize = cio.sslEngine.getSession().getApplicationBufferSize();
+ cio.requestBB = ByteBuffer.allocate(cio.appBBSize);
+
+ return cio;
+ }
+
+ /*
+ * Calls up to the superclass to adjust the buffer size
+ * by an appropriate increment.
+ */
+ protected void resizeRequestBB() {
+ resizeRequestBB(appBBSize);
+ }
+
+ /*
+ * Adjust the inbount network buffer to an appropriate size.
+ */
+ private void resizeResponseBB() {
+ ByteBuffer bb = ByteBuffer.allocate(netBBSize);
+ inNetBB.flip();
+ bb.put(inNetBB);
+ inNetBB = bb;
+ }
+
+ /*
+ * Writes bb to the SocketChannel.
+ * <P>
+ * Returns true when the ByteBuffer has no remaining data.
+ */
+ private boolean tryFlush(ByteBuffer bb) throws IOException {
+ super.write(bb);
+ return !bb.hasRemaining();
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * This variant is for Servers without SelectionKeys (e.g.
+ * blocking).
+ */
+ boolean doHandshake() throws IOException {
+ return doHandshake(null);
+ }
+
+ /*
+ * Perform any handshaking processing.
+ * <P>
+ * If a SelectionKey is passed, register for selectable
+ * operations.
+ * <P>
+ * In the blocking case, our caller will keep calling us until
+ * we finish the handshake. Our reads/writes will block as expected.
+ * <P>
+ * In the non-blocking case, we just received the selection notification
+ * that this channel is ready for whatever the operation is, so give
+ * it a try.
+ * <P>
+ * return:
+ * true when handshake is done.
+ * false while handshake is in progress
+ */
+ boolean doHandshake(SelectionKey sk) throws IOException {
+
+ SSLEngineResult result;
+
+ if (initialHSComplete) {
+ return initialHSComplete;
+ }
+
+ /*
+ * Flush out the outgoing buffer, if there's anything left in
+ * it.
+ */
+ if (outNetBB.hasRemaining()) {
+
+ if (!tryFlush(outNetBB)) {
+ return false;
+ }
+
+ // See if we need to switch from write to read mode.
+
+ switch (initialHSStatus) {
+
+ /*
+ * Is this the last buffer?
+ */
+ case FINISHED:
+ initialHSComplete = true;
+ // Fall-through to reregister need for a Read.
+
+ case NEED_UNWRAP:
+ if (sk != null) {
+ sk.interestOps(SelectionKey.OP_READ);
+ }
+ break;
+ }
+
+ return initialHSComplete;
+ }
+
+
+ switch (initialHSStatus) {
+
+ case NEED_UNWRAP:
+ if (sc.read(inNetBB) == -1) {
+ sslEngine.closeInbound();
+ return initialHSComplete;
+ }
+
+needIO:
+ while (initialHSStatus == HandshakeStatus.NEED_UNWRAP) {
+ resizeRequestBB(); // expected room for unwrap
+ inNetBB.flip();
+ result = sslEngine.unwrap(inNetBB, requestBB);
+ inNetBB.compact();
+
+ initialHSStatus = result.getHandshakeStatus();
+
+ switch (result.getStatus()) {
+
+ case OK:
+ switch (initialHSStatus) {
+ case NOT_HANDSHAKING:
+ throw new IOException(
+ "Not handshaking during initial handshake");
+
+ case NEED_TASK:
+ initialHSStatus = doTasks();
+ break;
+
+ case FINISHED:
+ initialHSComplete = true;
+ break needIO;
+ }
+
+ break;
+
+ case BUFFER_UNDERFLOW:
+ // Resize buffer if needed.
+ netBBSize = sslEngine.getSession().getPacketBufferSize();
+ if (netBBSize > inNetBB.capacity()) {
+ resizeResponseBB();
+ }
+
+ /*
+ * Need to go reread the Channel for more data.
+ */
+ if (sk != null) {
+ sk.interestOps(SelectionKey.OP_READ);
+ }
+ break needIO;
+
+ case BUFFER_OVERFLOW:
+ // Reset the application buffer size.
+ appBBSize =
+ sslEngine.getSession().getApplicationBufferSize();
+ break;
+
+ default: //CLOSED:
+ throw new IOException("Received" + result.getStatus() +
+ "during initial handshaking");
+ }
+ } // "needIO" block.
+
+ /*
+ * Just transitioned from read to write.
+ */
+ if (initialHSStatus != HandshakeStatus.NEED_WRAP) {
+ break;
+ }
+
+ // Fall through and fill the write buffers.
+
+ case NEED_WRAP:
+ /*
+ * The flush above guarantees the out buffer to be empty
+ */
+ outNetBB.clear();
+ result = sslEngine.wrap(hsBB, outNetBB);
+ outNetBB.flip();
+
+ initialHSStatus = result.getHandshakeStatus();
+
+ switch (result.getStatus()) {
+ case OK:
+
+ if (initialHSStatus == HandshakeStatus.NEED_TASK) {
+ initialHSStatus = doTasks();
+ }
+
+ if (sk != null) {
+ sk.interestOps(SelectionKey.OP_WRITE);
+ }
+
+ break;
+
+ default: // BUFFER_OVERFLOW/BUFFER_UNDERFLOW/CLOSED:
+ throw new IOException("Received" + result.getStatus() +
+ "during initial handshaking");
+ }
+ break;
+
+ default: // NOT_HANDSHAKING/NEED_TASK/FINISHED
+ throw new RuntimeException("Invalid Handshaking State" +
+ initialHSStatus);
+ } // switch
+
+ return initialHSComplete;
+ }
+
+ /*
+ * Do all the outstanding handshake tasks in the current Thread.
+ */
+ private SSLEngineResult.HandshakeStatus doTasks() {
+
+ Runnable runnable;
+
+ /*
+ * We could run this in a separate thread, but
+ * do in the current for now.
+ */
+ while ((runnable = sslEngine.getDelegatedTask()) != null) {
+ runnable.run();
+ }
+ return sslEngine.getHandshakeStatus();
+ }
+
+ /*
+ * Read the channel for more information, then unwrap the
+ * (hopefully application) data we get.
+ * <P>
+ * If we run out of data, we'll return to our caller (possibly using
+ * a Selector) to get notification that more is available.
+ * <P>
+ * Each call to this method will perform at most one underlying read().
+ */
+ int read() throws IOException {
+ SSLEngineResult result;
+
+ if (!initialHSComplete) {
+ throw new IllegalStateException();
+ }
+
+ int pos = requestBB.position();
+
+ if (sc.read(inNetBB) == -1) {
+ sslEngine.closeInbound(); // probably throws exception
+ return -1;
+ }
+
+ do {
+ resizeRequestBB(); // expected room for unwrap
+ inNetBB.flip();
+ result = sslEngine.unwrap(inNetBB, requestBB);
+ inNetBB.compact();
+
+ /*
+ * Could check here for a renegotation, but we're only
+ * doing a simple read/write, and won't have enough state
+ * transitions to do a complete handshake, so ignore that
+ * possibility.
+ */
+ switch (result.getStatus()) {
+
+ case BUFFER_OVERFLOW:
+ // Reset the application buffer size.
+ appBBSize = sslEngine.getSession().getApplicationBufferSize();
+ break;
+
+ case BUFFER_UNDERFLOW:
+ // Resize buffer if needed.
+ netBBSize = sslEngine.getSession().getPacketBufferSize();
+ if (netBBSize > inNetBB.capacity()) {
+ resizeResponseBB();
+
+ break; // break, next read will support larger buffer.
+ }
+ case OK:
+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ doTasks();
+ }
+ break;
+
+ default:
+ throw new IOException("sslEngine error during data read: " +
+ result.getStatus());
+ }
+ } while ((inNetBB.position() != 0) &&
+ result.getStatus() != Status.BUFFER_UNDERFLOW);
+
+ return (requestBB.position() - pos);
+ }
+
+ /*
+ * Try to write out as much as possible from the src buffer.
+ */
+ int write(ByteBuffer src) throws IOException {
+
+ if (!initialHSComplete) {
+ throw new IllegalStateException();
+ }
+
+ return doWrite(src);
+ }
+
+ /*
+ * Try to flush out any existing outbound data, then try to wrap
+ * anything new contained in the src buffer.
+ * <P>
+ * Return the number of bytes actually consumed from the buffer,
+ * but the data may actually be still sitting in the output buffer,
+ * waiting to be flushed.
+ */
+ private int doWrite(ByteBuffer src) throws IOException {
+ int retValue = 0;
+
+ if (outNetBB.hasRemaining() && !tryFlush(outNetBB)) {
+ return retValue;
+ }
+
+ /*
+ * The data buffer is empty, we can reuse the entire buffer.
+ */
+ outNetBB.clear();
+
+ SSLEngineResult result = sslEngine.wrap(src, outNetBB);
+ retValue = result.bytesConsumed();
+
+ outNetBB.flip();
+
+ switch (result.getStatus()) {
+
+ case OK:
+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ doTasks();
+ }
+ break;
+
+ default:
+ throw new IOException("sslEngine error during data write: " +
+ result.getStatus());
+ }
+
+ /*
+ * Try to flush the data, regardless of whether or not
+ * it's been selected. Odds of a write buffer being full
+ * is less than a read buffer being empty.
+ */
+ if (outNetBB.hasRemaining()) {
+ tryFlush(outNetBB);
+ }
+
+ return retValue;
+ }
+
+ /*
+ * Perform a FileChannel.TransferTo on the socket channel.
+ * <P>
+ * We have to copy the data into an intermediary app ByteBuffer
+ * first, then send it through the SSLEngine.
+ * <P>
+ * We return the number of bytes actually read out of the
+ * filechannel. However, the data may actually be stuck
+ * in the fileChannelBB or the outNetBB. The caller
+ * is responsible for making sure to call dataFlush()
+ * before shutting down.
+ */
+ long transferTo(FileChannel fc, long pos, long len) throws IOException {
+
+ if (!initialHSComplete) {
+ throw new IllegalStateException();
+ }
+
+ if (fileChannelBB == null) {
+ fileChannelBB = ByteBuffer.allocate(appBBSize);
+ fileChannelBB.limit(0);
+ }
+
+ fileChannelBB.compact();
+ int fileRead = fc.read(fileChannelBB);
+ fileChannelBB.flip();
+
+ /*
+ * We ignore the return value here, we return the
+ * number of bytes actually consumed from the the file.
+ * We'll flush the output buffer before we start shutting down.
+ */
+ doWrite(fileChannelBB);
+
+ return fileRead;
+ }
+
+ /*
+ * Flush any remaining data.
+ * <P>
+ * Return true when the fileChannelBB and outNetBB are empty.
+ */
+ boolean dataFlush() throws IOException {
+ boolean fileFlushed = true;
+
+ if ((fileChannelBB != null) && fileChannelBB.hasRemaining()) {
+ doWrite(fileChannelBB);
+ fileFlushed = !fileChannelBB.hasRemaining();
+ } else if (outNetBB.hasRemaining()) {
+ tryFlush(outNetBB);
+ }
+
+ return (fileFlushed && !outNetBB.hasRemaining());
+ }
+
+ /*
+ * Begin the shutdown process.
+ * <P>
+ * Close out the SSLEngine if not already done so, then
+ * wrap our outgoing close_notify message and try to send it on.
+ * <P>
+ * Return true when we're done passing the shutdown messsages.
+ */
+ boolean shutdown() throws IOException {
+
+ if (!shutdown) {
+ sslEngine.closeOutbound();
+ shutdown = true;
+ }
+
+ if (outNetBB.hasRemaining() && tryFlush(outNetBB)) {
+ return false;
+ }
+
+ /*
+ * By RFC 2616, we can "fire and forget" our close_notify
+ * message, so that's what we'll do here.
+ */
+ outNetBB.clear();
+ SSLEngineResult result = sslEngine.wrap(hsBB, outNetBB);
+ if (result.getStatus() != Status.CLOSED) {
+ throw new SSLException("Improper close state");
+ }
+ outNetBB.flip();
+
+ /*
+ * We won't wait for a select here, but if this doesn't work,
+ * we'll cycle back through on the next select.
+ */
+ if (outNetBB.hasRemaining()) {
+ tryFlush(outNetBB);
+ }
+
+ return (!outNetBB.hasRemaining() &&
+ (result.getHandshakeStatus() != HandshakeStatus.NEED_WRAP));
+ }
+
+ /*
+ * close() is not overridden
+ */
+}
diff --git a/staging/linux-x86/sample/nio/server/Content.java b/staging/linux-x86/sample/nio/server/Content.java
new file mode 100644
index 0000000..52e06fa
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Content.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * An Sendable interface extension that adds additional
+ * methods for additional information, such as Files
+ * or Strings.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Content extends Sendable {
+
+ String type();
+
+ // Returns -1 until prepare() invoked
+ long length();
+
+}
diff --git a/staging/linux-x86/sample/nio/server/Dispatcher.java b/staging/linux-x86/sample/nio/server/Dispatcher.java
new file mode 100644
index 0000000..9474c12
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Dispatcher.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+
+/**
+ * Base class for the Dispatchers.
+ * <P>
+ * Servers use these to obtain ready status, and then to dispatch jobs.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Dispatcher extends Runnable {
+
+ void register(SelectableChannel ch, int ops, Handler h)
+ throws IOException;
+
+}
diff --git a/staging/linux-x86/sample/nio/server/Dispatcher1.java b/staging/linux-x86/sample/nio/server/Dispatcher1.java
new file mode 100644
index 0000000..533e4b8
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Dispatcher1.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import java.util.*;
+
+/**
+ * A single-threaded dispatcher.
+ * <P>
+ * When a SelectionKey is ready, it dispatches the job in this
+ * thread.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Dispatcher1 implements Dispatcher {
+
+ private Selector sel;
+
+ Dispatcher1() throws IOException {
+ sel = Selector.open();
+ }
+
+ // Doesn't really need to be runnable
+ public void run() {
+ for (;;) {
+ try {
+ dispatch();
+ } catch (IOException x) {
+ x.printStackTrace();
+ }
+ }
+ }
+
+ private void dispatch() throws IOException {
+ sel.select();
+ for (Iterator i = sel.selectedKeys().iterator(); i.hasNext(); ) {
+ SelectionKey sk = (SelectionKey)i.next();
+ i.remove();
+ Handler h = (Handler)sk.attachment();
+ h.handle(sk);
+ }
+ }
+
+ public void register(SelectableChannel ch, int ops, Handler h)
+ throws IOException {
+ ch.register(sel, ops, h);
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/DispatcherN.java b/staging/linux-x86/sample/nio/server/DispatcherN.java
new file mode 100644
index 0000000..7b601b0
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/DispatcherN.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+import java.util.*;
+
+/**
+ * A Multi-threaded dispatcher.
+ * <P>
+ * In this example, one thread does accepts, and the second
+ * does read/writes.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class DispatcherN implements Dispatcher {
+
+ private Selector sel;
+
+ DispatcherN() throws IOException {
+ sel = Selector.open();
+ }
+
+ public void run() {
+ for (;;) {
+ try {
+ dispatch();
+ } catch (IOException x) {
+ x.printStackTrace();
+ }
+ }
+ }
+
+ private Object gate = new Object();
+
+ private void dispatch() throws IOException {
+ sel.select();
+ for (Iterator i = sel.selectedKeys().iterator(); i.hasNext(); ) {
+ SelectionKey sk = (SelectionKey)i.next();
+ i.remove();
+ Handler h = (Handler)sk.attachment();
+ h.handle(sk);
+ }
+ synchronized (gate) { }
+ }
+
+ public void register(SelectableChannel ch, int ops, Handler h)
+ throws IOException {
+ synchronized (gate) {
+ sel.wakeup();
+ ch.register(sel, ops, h);
+ }
+ }
+
+}
diff --git a/staging/linux-x86/sample/nio/server/FileContent.java b/staging/linux-x86/sample/nio/server/FileContent.java
new file mode 100644
index 0000000..82c44a9
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/FileContent.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.net.*;
+import java.nio.channels.*;
+import java.nio.charset.*;
+
+/**
+ * A Content type that provides for transferring files.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class FileContent implements Content {
+
+ private static File ROOT = new File("root");
+
+ private File fn;
+
+ FileContent(URI uri) {
+ fn = new File(ROOT,
+ uri.getPath()
+ .replace('/',
+ File.separatorChar));
+ }
+
+ private String type = null;
+
+ public String type() {
+ if (type != null)
+ return type;
+ String nm = fn.getName();
+ if (nm.endsWith(".html"))
+ type = "text/html; charset=iso-8859-1";
+ else if ((nm.indexOf('.') < 0) || nm.endsWith(".txt"))
+ type = "text/plain; charset=iso-8859-1";
+ else
+ type = "application/octet-stream";
+ return type;
+ }
+
+ private FileChannel fc = null;
+ private long length = -1;
+ private long position = -1; // NB only; >= 0 if transferring
+
+ public long length() {
+ return length;
+ }
+
+ public void prepare() throws IOException {
+ if (fc == null)
+ fc = new RandomAccessFile(fn, "r").getChannel();
+ length = fc.size();
+ position = 0; // NB only
+ }
+
+ public boolean send(ChannelIO cio) throws IOException {
+ if (fc == null)
+ throw new IllegalStateException();
+ if (position < 0) // NB only
+ throw new IllegalStateException();
+
+ /*
+ * Short-circuit if we're already done.
+ */
+ if (position >= length) {
+ return false;
+ }
+
+ position += cio.transferTo(fc, position, length - position);
+ return (position < length);
+ }
+
+ public void release() throws IOException {
+ if (fc != null) {
+ fc.close();
+ fc = null;
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/Handler.java b/staging/linux-x86/sample/nio/server/Handler.java
new file mode 100644
index 0000000..110feb7
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Handler.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.channels.*;
+
+/**
+ * Base class for the Handlers.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Handler {
+
+ void handle(SelectionKey sk) throws IOException;
+
+}
diff --git a/staging/linux-x86/sample/nio/server/MalformedRequestException.java b/staging/linux-x86/sample/nio/server/MalformedRequestException.java
new file mode 100644
index 0000000..89b0db6
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/MalformedRequestException.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * Exception class used when a request can't be properly parsed.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class MalformedRequestException extends Exception {
+
+ MalformedRequestException() { }
+
+ MalformedRequestException(String msg) {
+ super(msg);
+ }
+
+ MalformedRequestException(Exception x) {
+ super(x);
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/N1.java b/staging/linux-x86/sample/nio/server/N1.java
new file mode 100644
index 0000000..d02bc93
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/N1.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.nio.channels.*;
+
+/**
+ * A non-blocking/single-threaded server. All accept() and
+ * read()/write() operations are performed by a single thread, but only
+ * after being selected for those operations by a Selector.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class N1 extends Server {
+
+ N1(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ ssc.configureBlocking(false);
+ }
+
+ void runServer() throws Exception {
+ Dispatcher d = new Dispatcher1();
+ d.register(ssc, SelectionKey.OP_ACCEPT,
+ new AcceptHandler(ssc, d, sslContext));
+ d.run();
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/N2.java b/staging/linux-x86/sample/nio/server/N2.java
new file mode 100644
index 0000000..2a21612
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/N2.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+/**
+ * A non-blocking/dual-threaded which performs accept()s in one thread,
+ * and services requests in a second. Both threads use select().
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public class N2 extends Server {
+
+ N2(int port, int backlog, boolean secure) throws Exception {
+ super(port, backlog, secure);
+ }
+
+ void runServer() throws Exception {
+ Dispatcher d = new DispatcherN();
+ Acceptor a = new Acceptor(ssc, d, sslContext);
+ new Thread(a).start();
+ d.run();
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/README.txt b/staging/linux-x86/sample/nio/server/README.txt
new file mode 100644
index 0000000..aa803e8
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/README.txt
@@ -0,0 +1,279 @@
+ A Simple NIO-based HTTP/HTTPS Server Example
+
+
+INTRODUCTION
+============
+This directory contains a simple HTTP/HTTPS server. HTTP/HTTPS are two
+common network protocols that provide for data transfer, and are more
+fully described in RFC 2616 and RFC 2818 (Available at
+http://www.ietf.org ). HTTPS is essentially HTTP after the connection
+has been secured with SSL/TLS. TLS is the successor to SSL, and is
+described in RFC 2246.
+
+This server was written to demonstrate some of the functionality new to
+the Java 2 platform. The demo is not meant to be a full tutorial, and
+assumes the reader has some familiarity with the subject matter.
+
+In particular, it shows:
+
+ New I/O (java.nio, java.nio.channels, java.util.regex, java.nio.charset)
+
+ Introduced in version 1.4 of the platform, NIO was designed to
+ overcome some of the scalability limitations found in the
+ existing blocking java.net.* API's, and to address other
+ concepts such as Regular Expression parsing and Character
+ Sets.
+
+ This server demonstrates:
+
+ ByteBuffer
+ Blocking and Non-Blocking I/O
+ SocketChannel
+ ServerSocketChannel
+ Selector
+ CharacterSet
+ Pattern matching using Regular Expressions
+
+ JSSE (javax.net.ssl)
+
+ Introduced in version 1.4 of the platform, JSSE provides
+ network security using SSL/TLS for java.net.Socket-based
+ traffic. In version 1.5, the SSLEngine API was introduced
+ which separates the SSL/TLS functionality from the underlying
+ I/O model. By making this separation, applications can adapt
+ I/O and compute strategies to best fit their circumstances.
+
+ This server demonstrates:
+
+ Using SSLEngine to create a HTTPS server
+ Creating simple key material for use with HTTPS
+
+ Concurrency Library (java.util.concurrent)
+
+ Introduced in version 1.5 of the platform, the concurrency
+ library provides a mechanism which decouples task submission
+ from the mechanics of how each task will be run.
+
+ This server demonstrates:
+
+ A ThreadPool with a fixed number of threads, which is
+ based on the number of available processors.
+
+
+SETUP
+=====
+
+The server must be built on version 1.5 (or later) of the platform.
+Invoking the following should be sufficient:
+
+ % mkdir build
+ % javac -source 1.5 -target 1.5 -d build *.java
+
+The following creates the document root:
+
+ % mkdir root
+
+All documents should be placed in this directory.
+
+For HTTPS, the server authenticates itself to clients by using simple
+Public Key Infrastructure (PKI) credentials in the form of
+X509Certificates. You must create the server's credentials before
+attempting to run the server in "-secure" mode. The server is
+currently hardcoded to look for its credentials in a file called
+"testkeys".
+
+In this example, we'll create credentials for a fictional widget web
+site owned by the ubiquitous "Xyzzy, Inc.". When you run this in your
+own environment, replace "widgets.xyzzy.com" with the hostname of your
+server.
+
+The easiest way to create the SSL/TLS credentials is to use the
+java keytool, by doing the following:
+
+ (<CR> represents your end-of-line key)
+
+ % keytool -genkey -keyalg rsa -keystore testkeys -alias widgets
+ Enter keystore password: passphrase
+ What is your first and last name?
+ [Unknown]: widgets.xyzzy.com<CR>
+ What is the name of your organizational unit?
+ [Unknown]: Consumer Widgets Group<CR>
+ What is the name of your organization?
+ [Unknown]: Xyzzy, Inc.<CR>
+ What is the name of your City or Locality?
+ [Unknown]: Arcata<CR>
+ What is the name of your State or Province?
+ [Unknown]: CA<CR>
+ What is the two-letter country code for this unit?
+ [Unknown]: US<CR>
+ Is CN=widgets.xyzzy.com, OU=Consumer Widgets Group, O="Xyzzy, Inc.",
+ L=Arcata, ST=CA, C=US correct?
+ [no]: yes<CR>
+
+ Enter key password for <mykey>
+ (RETURN if same as keystore password): <CR>
+
+This directory also contain a very simple URL reader (URLDumper), which
+connects to a specified URL and places all output into a specified file.
+
+
+SERVER EXECUTION
+================
+
+ % java -classpath build Server N1
+
+ Usage: Server <type> [options]
+ type:
+ B1 Blocking/Single-threaded Server
+ BN Blocking/Multi-threaded Server
+ BP Blocking/Pooled-thread Server
+ N1 Nonblocking/Single-threaded Server
+ N2 Nonblocking/Dual-threaded Server
+
+ options:
+ -port port port number
+ default: 8000
+ -backlog backlog backlog
+ default: 1024
+ -secure encrypt with SSL/TLS
+ default is insecure
+
+"http://" URLs should be used with insecure mode, and
+"https://" for secure mode.
+
+The "B*" servers use classic blocking I/O: in other words, calls to
+read()/write() will not return until the I/O operation has completed. The
+"N*" servers use non-blocking mode and Selectors to determine which
+Channels are ready to perform I/O.
+
+B1: A single-threaded server which completely services each
+ connection before moving to the next.
+
+B2: A multi-threaded server which creates a new thread for each
+ connection. This is not efficient for large numbers of
+ connections.
+
+BP: A multi-threaded server which creates a pool of threads for use
+ by the server. The Thread pool decides how to schedule those
+ threads.
+
+N1: A single-threaded server. All accept() and read()/write()
+ operations are performed by a single thread, but only after
+ being selected for those operations by a Selector.
+
+N2: A dual-threaded server which performs accept()s in one thread, and
+ services requests in a second. Both threads use select().
+
+
+CLIENT EXECUTION
+================
+You can test the server using any standard browser such as Internet
+Explorer or Mozilla, but since the browser will not trust the
+credentials you just created, you may need to accept the credentials
+via the browser's pop-up dialog box.
+
+Alternatively, to use the certificates using the simple included JSSE
+client URLDumper, export the server certificate into a new truststore,
+and then run the application using the new truststore.
+
+ % keytool -export -keystore testkeys -alias widgets -file widgets.cer
+ Enter keystore password: passphrase<CR>
+ Certificate stored in file <widgets.cer>
+
+ % keytool -import -keystore trustCerts -alias widgetServer \
+ -file widgets.cer
+ Enter keystore password: passphrase<CR>
+ Owner: CN=widgets.xyzzy.com, OU=Consumer, O="xyzzy, inc.", L=Arcata,
+ ST=CA, C=US
+ Issuer: CN=widgets.xyzzy.com, OU=Consumer, O="xyzzy, inc.",
+ L=Arcata, ST=CA, C=US
+ Serial number: 4086cc7a
+ Valid from: Wed Apr 21 12:33:14 PDT 2004 until: Tue Jul 20 12:33:14
+ PDT 2004
+ Certificate fingerprints:
+ MD5: 39:71:42:CD:BF:0D:A9:8C:FB:8B:4A:CD:F8:6D:19:1F
+ SHA1: 69:5D:38:E9:F4:6C:E5:A7:4C:EA:45:8E:FB:3E:F3:9A:84:01:6F:22
+ Trust this certificate? [no]: yes<CR>
+ Certificate was added to keystore
+
+ % java -classpath build -Djavax.net.ssl.trustStore=trustCerts \
+ -Djavax.net.ssl.TrustStorePassword=passphrase \
+ URLDumper https://widgets.xyzzy.com:8000/ outputFile
+
+NOTE: The server must be run with "-secure" in order to receive
+"https://" URLs.
+
+WARNING: This is just a simple example for code exposition, you should
+spend more time understanding PKI security concerns.
+
+
+SOURCE CODE OVERVIEW
+====================
+
+The main class is Server, which handles program startup, and is
+subclassed by the "B*" and "N*" server classes.
+
+Following a successful accept(), the "B*" variants each create a
+RequestServicer object to perform the actual request/reply operations. The
+primary differences between the different "B*" servers is how the
+RequestServicer is actually run:
+
+ B1: RequestServicer.run() is directly called.
+ BN: A new thread is started, and the thread calls RequestServicer.run().
+ BP: A ThreadPool is created, and the pool framework is given Runnable
+ tasks to complete.
+
+In the "N*" variations, a Dispatcher object is created, which is
+responsible for performing the select, and then issuing the
+corresponding handler:
+
+ N1: A single thread is used for all accept()/read()/write() operations
+ N2: Similar to N1, but a separate thread is used for the accept()
+ operations.
+
+In all cases, once the connection has been accepted, a ChannelIO object
+is created to handle all I/O. In the insecure case, the corresponding
+SocketChannel methods are directly called. However in the secure case,
+more manipulations are needed to first secure the channel, then
+encrypt/decrypt the data, and finally properly send any shutdown
+messages. ChannelIOSecure extends ChannelIO, and provides the secure
+variants of the corresponding ChannelIO calls.
+
+RequestServicer and RequestHandler are the main drivers for the
+blocking and non-blocking variants, respectively. They are responsible
+for:
+
+ Performing any initial handshaking
+
+ Reading the request data
+ All data is stored in a local buffer in the ChannelIO
+ structure.
+
+ Parsing the request
+ The request data is obtained from the ChannelIO object, and
+ is processed by Request class, which represents the
+ parsed URI address.
+
+ Locating/preparing/sending the data or reporting error conditions.
+ A Reply object is created which represents the entire object to send,
+ including the HTTP/HTTPS headers.
+
+ Shutdown/closing the channel.
+
+
+CLOSING THOUGHTS
+================
+This example represents a simple server: it is not production quality.
+It was primarily meant to demonstrate the new APIs in versions 1.4 and
+1.5 of the platform.
+
+This example could certainly be expanded to address other areas of
+concern: for example, assigning multiple threads to handle the selected
+Channels, or delegating SSLEngine tasks to multiple threads. There are
+so many ways to implement compute and I/O strategies, we encourage you
+to experiment and find what works best for your situation.
+
+To steal a phrase from many textbooks:
+
+ "It is left as an exercise for the reader..."
+
diff --git a/staging/linux-x86/sample/nio/server/Reply.java b/staging/linux-x86/sample/nio/server/Reply.java
new file mode 100644
index 0000000..c128ee8
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Reply.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+/**
+ * An object used for sending Content to the requestor.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Reply implements Sendable {
+
+ /**
+ * A helper class which define the HTTP response codes
+ */
+ static class Code {
+
+ private int number;
+ private String reason;
+ private Code(int i, String r) { number = i; reason = r; }
+ public String toString() { return number + " " + reason; }
+
+ static Code OK = new Code(200, "OK");
+ static Code BAD_REQUEST = new Code(400, "Bad Request");
+ static Code NOT_FOUND = new Code(404, "Not Found");
+ static Code METHOD_NOT_ALLOWED = new Code(405, "Method Not Allowed");
+
+ }
+
+ private Code code;
+ private Content content;
+ private boolean headersOnly;
+
+ Reply(Code rc, Content c) {
+ this(rc, c, null);
+ }
+
+ Reply(Code rc, Content c, Request.Action head) {
+ code = rc;
+ content = c;
+ headersOnly = (head == Request.Action.HEAD);
+ }
+
+ private static String CRLF = "\r\n";
+ private static Charset ascii = Charset.forName("US-ASCII");
+
+ private ByteBuffer hbb = null;
+
+ private ByteBuffer headers() {
+ CharBuffer cb = CharBuffer.allocate(1024);
+ for (;;) {
+ try {
+ cb.put("HTTP/1.0 ").put(code.toString()).put(CRLF);
+ cb.put("Server: niossl/0.1").put(CRLF);
+ cb.put("Content-type: ").put(content.type()).put(CRLF);
+ cb.put("Content-length: ")
+ .put(Long.toString(content.length())).put(CRLF);
+ cb.put(CRLF);
+ break;
+ } catch (BufferOverflowException x) {
+ assert(cb.capacity() < (1 << 16));
+ cb = CharBuffer.allocate(cb.capacity() * 2);
+ continue;
+ }
+ }
+ cb.flip();
+ return ascii.encode(cb);
+ }
+
+ public void prepare() throws IOException {
+ content.prepare();
+ hbb = headers();
+ }
+
+ public boolean send(ChannelIO cio) throws IOException {
+
+ if (hbb == null)
+ throw new IllegalStateException();
+
+ if (hbb.hasRemaining()) {
+ if (cio.write(hbb) <= 0)
+ return true;
+ }
+
+ if (!headersOnly) {
+ if (content.send(cio))
+ return true;
+ }
+
+ if (!cio.dataFlush())
+ return true;
+
+ return false;
+ }
+
+ public void release() throws IOException {
+ content.release();
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/Request.java b/staging/linux-x86/sample/nio/server/Request.java
new file mode 100644
index 0000000..fa36d1e
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Request.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.net.*;
+import java.nio.*;
+import java.nio.charset.*;
+import java.util.regex.*;
+
+/**
+ * An encapsulation of the request received.
+ * <P>
+ * The static method parse() is responsible for creating this
+ * object.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class Request {
+
+ /**
+ * A helper class for parsing HTTP command actions.
+ */
+ static class Action {
+
+ private String name;
+ private Action(String name) { this.name = name; }
+ public String toString() { return name; }
+
+ static Action GET = new Action("GET");
+ static Action PUT = new Action("PUT");
+ static Action POST = new Action("POST");
+ static Action HEAD = new Action("HEAD");
+
+ static Action parse(String s) {
+ if (s.equals("GET"))
+ return GET;
+ if (s.equals("PUT"))
+ return PUT;
+ if (s.equals("POST"))
+ return POST;
+ if (s.equals("HEAD"))
+ return HEAD;
+ throw new IllegalArgumentException(s);
+ }
+ }
+
+ private Action action;
+ private String version;
+ private URI uri;
+
+ Action action() { return action; }
+ String version() { return version; }
+ URI uri() { return uri; }
+
+ private Request(Action a, String v, URI u) {
+ action = a;
+ version = v;
+ uri = u;
+ }
+
+ public String toString() {
+ return (action + " " + version + " " + uri);
+ }
+
+ static boolean isComplete(ByteBuffer bb) {
+ int p = bb.position() - 4;
+ if (p < 0)
+ return false;
+ return (((bb.get(p + 0) == '\r') &&
+ (bb.get(p + 1) == '\n') &&
+ (bb.get(p + 2) == '\r') &&
+ (bb.get(p + 3) == '\n')));
+ }
+
+ private static Charset ascii = Charset.forName("US-ASCII");
+
+ /*
+ * The expected message format is first compiled into a pattern,
+ * and is then compared against the inbound character buffer to
+ * determine if there is a match. This convienently tokenizes
+ * our request into usable pieces.
+ *
+ * This uses Matcher "expression capture groups" to tokenize
+ * requests like:
+ *
+ * GET /dir/file HTTP/1.1
+ * Host: hostname
+ *
+ * into:
+ *
+ * group[1] = "GET"
+ * group[2] = "/dir/file"
+ * group[3] = "1.1"
+ * group[4] = "hostname"
+ *
+ * The text in between the parens are used to captured the regexp text.
+ */
+ private static Pattern requestPattern
+ = Pattern.compile("\\A([A-Z]+) +([^ ]+) +HTTP/([0-9\\.]+)$"
+ + ".*^Host: ([^ ]+)$.*\r\n\r\n\\z",
+ Pattern.MULTILINE | Pattern.DOTALL);
+
+ static Request parse(ByteBuffer bb) throws MalformedRequestException {
+
+ CharBuffer cb = ascii.decode(bb);
+ Matcher m = requestPattern.matcher(cb);
+ if (!m.matches())
+ throw new MalformedRequestException();
+ Action a;
+ try {
+ a = Action.parse(m.group(1));
+ } catch (IllegalArgumentException x) {
+ throw new MalformedRequestException();
+ }
+ URI u;
+ try {
+ u = new URI("http://"
+ + m.group(4)
+ + m.group(2));
+ } catch (URISyntaxException x) {
+ throw new MalformedRequestException();
+ }
+ return new Request(a, m.group(3), u);
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/RequestHandler.java b/staging/linux-x86/sample/nio/server/RequestHandler.java
new file mode 100644
index 0000000..91d2bda
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/RequestHandler.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+
+/**
+ * Primary driver class used by non-blocking Servers to receive,
+ * prepare, send, and shutdown requests.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class RequestHandler implements Handler {
+
+ private ChannelIO cio;
+ private ByteBuffer rbb = null;
+
+ private boolean requestReceived = false;
+ private Request request = null;
+ private Reply reply = null;
+
+ private static int created = 0;
+
+ RequestHandler(ChannelIO cio) {
+ this.cio = cio;
+
+ // Simple heartbeat to let user know we're alive.
+ synchronized (RequestHandler.class) {
+ created++;
+ if ((created % 50) == 0) {
+ System.out.println(".");
+ created = 0;
+ } else {
+ System.out.print(".");
+ }
+ }
+ }
+
+ // Returns true when request is complete
+ // May expand rbb if more room required
+ //
+ private boolean receive(SelectionKey sk) throws IOException {
+ ByteBuffer tmp = null;
+
+ if (requestReceived) {
+ return true;
+ }
+
+ if (!cio.doHandshake(sk)) {
+ return false;
+ }
+
+ if ((cio.read() < 0) || Request.isComplete(cio.getReadBuf())) {
+ rbb = cio.getReadBuf();
+ return (requestReceived = true);
+ }
+ return false;
+ }
+
+ // When parse is successfull, saves request and returns true
+ //
+ private boolean parse() throws IOException {
+ try {
+ request = Request.parse(rbb);
+ return true;
+ } catch (MalformedRequestException x) {
+ reply = new Reply(Reply.Code.BAD_REQUEST,
+ new StringContent(x));
+ }
+ return false;
+ }
+
+ // Ensures that reply field is non-null
+ //
+ private void build() throws IOException {
+ Request.Action action = request.action();
+ if ((action != Request.Action.GET) &&
+ (action != Request.Action.HEAD)) {
+ reply = new Reply(Reply.Code.METHOD_NOT_ALLOWED,
+ new StringContent(request.toString()));
+ }
+ reply = new Reply(Reply.Code.OK,
+ new FileContent(request.uri()), action);
+ }
+
+ public void handle(SelectionKey sk) throws IOException {
+ try {
+
+ if (request == null) {
+ if (!receive(sk))
+ return;
+ rbb.flip();
+ if (parse())
+ build();
+ try {
+ reply.prepare();
+ } catch (IOException x) {
+ reply.release();
+ reply = new Reply(Reply.Code.NOT_FOUND,
+ new StringContent(x));
+ reply.prepare();
+ }
+ if (send()) {
+ // More bytes remain to be written
+ sk.interestOps(SelectionKey.OP_WRITE);
+ } else {
+ // Reply completely written; we're done
+ if (cio.shutdown()) {
+ cio.close();
+ reply.release();
+ }
+ }
+ } else {
+ if (!send()) { // Should be rp.send()
+ if (cio.shutdown()) {
+ cio.close();
+ reply.release();
+ }
+ }
+ }
+ } catch (IOException x) {
+ String m = x.getMessage();
+ if (!m.equals("Broken pipe") &&
+ !m.equals("Connection reset by peer")) {
+ System.err.println("RequestHandler: " + x.toString());
+ }
+
+ try {
+ /*
+ * We had a failure here, so we'll try to be nice
+ * before closing down and send off a close_notify,
+ * but if we can't get the message off with one try,
+ * we'll just shutdown.
+ */
+ cio.shutdown();
+ } catch (IOException e) {
+ // ignore
+ }
+
+ cio.close();
+ if (reply != null) {
+ reply.release();
+ }
+ }
+
+ }
+
+ private boolean send() throws IOException {
+ try {
+ return reply.send(cio);
+ } catch (IOException x) {
+ if (x.getMessage().startsWith("Resource temporarily")) {
+ System.err.println("## RTA");
+ return true;
+ }
+ throw x;
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/RequestServicer.java b/staging/linux-x86/sample/nio/server/RequestServicer.java
new file mode 100644
index 0000000..88d40b5
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/RequestServicer.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+
+/**
+ * Primary driver class used by blocking Servers to receive,
+ * prepare, send, and shutdown requests.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class RequestServicer implements Runnable {
+
+ private ChannelIO cio;
+
+ private static int created = 0;
+
+ RequestServicer(ChannelIO cio) {
+ this.cio = cio;
+
+ // Simple heartbeat to let user know we're alive.
+ synchronized (RequestServicer.class) {
+ created++;
+ if ((created % 50) == 0) {
+ System.out.println(".");
+ created = 0;
+ } else {
+ System.out.print(".");
+ }
+ }
+ }
+
+ private void service() throws IOException {
+ Reply rp = null;
+ try {
+ ByteBuffer rbb = receive(); // Receive
+ Request rq = null;
+ try { // Parse
+ rq = Request.parse(rbb);
+ } catch (MalformedRequestException x) {
+ rp = new Reply(Reply.Code.BAD_REQUEST,
+ new StringContent(x));
+ }
+ if (rp == null) rp = build(rq); // Build
+ do {} while (rp.send(cio)); // Send
+ do {} while (!cio.shutdown());
+ cio.close();
+ rp.release();
+ } catch (IOException x) {
+ String m = x.getMessage();
+ if (!m.equals("Broken pipe") &&
+ !m.equals("Connection reset by peer")) {
+ System.err.println("RequestHandler: " + x.toString());
+ }
+
+ try {
+ /*
+ * We had a failure here, so we'll try to be nice
+ * before closing down and send off a close_notify,
+ * but if we can't get the message off with one try,
+ * we'll just shutdown.
+ */
+ cio.shutdown();
+ } catch (IOException e) {
+ // ignore
+ }
+
+ cio.close();
+ if (rp != null) {
+ rp.release();
+ }
+ }
+ }
+
+ public void run() {
+ try {
+ service();
+ } catch (IOException x) {
+ x.printStackTrace();
+ }
+ }
+
+ ByteBuffer receive() throws IOException {
+
+ do {} while (!cio.doHandshake());
+
+ for (;;) {
+ int read = cio.read();
+ ByteBuffer bb = cio.getReadBuf();
+ if ((read < 0) || (Request.isComplete(bb))) {
+ bb.flip();
+ return bb;
+ }
+ }
+ }
+
+ Reply build(Request rq) throws IOException {
+
+ Reply rp = null;
+ Request.Action action = rq.action();
+ if ((action != Request.Action.GET) &&
+ (action != Request.Action.HEAD))
+ rp = new Reply(Reply.Code.METHOD_NOT_ALLOWED,
+ new StringContent(rq.toString()));
+ else
+ rp = new Reply(Reply.Code.OK,
+ new FileContent(rq.uri()), action);
+ try {
+ rp.prepare();
+ } catch (IOException x) {
+ rp.release();
+ rp = new Reply(Reply.Code.NOT_FOUND,
+ new StringContent(x));
+ rp.prepare();
+ }
+ return rp;
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/Sendable.java b/staging/linux-x86/sample/nio/server/Sendable.java
new file mode 100644
index 0000000..44ac848
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Sendable.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+
+/**
+ * Method definitions used for preparing, sending, and release
+ * content.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+interface Sendable {
+
+ void prepare() throws IOException;
+
+ // Sends (some) content to the given channel.
+ // Returns true if more bytes remain to be written.
+ // Throws IllegalStateException if not prepared.
+ //
+ boolean send(ChannelIO cio) throws IOException;
+
+ void release() throws IOException;
+}
diff --git a/staging/linux-x86/sample/nio/server/Server.java b/staging/linux-x86/sample/nio/server/Server.java
new file mode 100644
index 0000000..1ac6421
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/Server.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.net.*;
+import java.nio.channels.*;
+import java.security.*;
+import javax.net.ssl.*;
+
+/**
+ * The main server base class.
+ * <P>
+ * This class is responsible for setting up most of the server state
+ * before the actual server subclasses take over.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+public abstract class Server {
+
+ ServerSocketChannel ssc;
+ SSLContext sslContext = null;
+
+ static private int PORT = 8000;
+ static private int BACKLOG = 1024;
+ static private boolean SECURE = false;
+
+ Server(int port, int backlog,
+ boolean secure) throws Exception {
+
+ if (secure) {
+ createSSLContext();
+ }
+
+ ssc = ServerSocketChannel.open();
+ ssc.socket().setReuseAddress(true);
+ ssc.socket().bind(new InetSocketAddress(port), backlog);
+ }
+
+ /*
+ * If this is a secure server, we now setup the SSLContext we'll
+ * use for creating the SSLEngines throughout the lifetime of
+ * this process.
+ */
+ private void createSSLContext() throws Exception {
+
+ char[] passphrase = "passphrase".toCharArray();
+
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(new FileInputStream("testkeys"), passphrase);
+
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, passphrase);
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(ks);
+
+ sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ }
+
+ abstract void runServer() throws Exception;
+
+ static private void usage() {
+ System.out.println(
+ "Usage: Server <type> [options]\n"
+ + " type:\n"
+ + " B1 Blocking/Single-threaded Server\n"
+ + " BN Blocking/Multi-threaded Server\n"
+ + " BP Blocking/Pooled-Thread Server\n"
+ + " N1 Nonblocking/Single-threaded Server\n"
+ + " N2 Nonblocking/Dual-threaded Server\n"
+ + "\n"
+ + " options:\n"
+ + " -port port port number\n"
+ + " default: " + PORT + "\n"
+ + " -backlog backlog backlog\n"
+ + " default: " + BACKLOG + "\n"
+ + " -secure encrypt with SSL/TLS");
+ System.exit(1);
+ }
+
+ /*
+ * Parse the arguments, decide what type of server to run,
+ * see if there are any defaults to change.
+ */
+ static private Server createServer(String args[]) throws Exception {
+ if (args.length < 1) {
+ usage();
+ }
+
+ int port = PORT;
+ int backlog = BACKLOG;
+ boolean secure = SECURE;
+
+ for (int i = 1; i < args.length; i++) {
+ if (args[i].equals("-port")) {
+ checkArgs(i, args.length);
+ port = Integer.valueOf(args[++i]);
+ } else if (args[i].equals("-backlog")) {
+ checkArgs(i, args.length);
+ backlog = Integer.valueOf(args[++i]);
+ } else if (args[i].equals("-secure")) {
+ secure = true;
+ } else {
+ usage();
+ }
+ }
+
+ Server server = null;
+
+ if (args[0].equals("B1")) {
+ server = new B1(port, backlog, secure);
+ } else if (args[0].equals("BN")) {
+ server = new BN(port, backlog, secure);
+ } else if (args[0].equals("BP")) {
+ server = new BP(port, backlog, secure);
+ } else if (args[0].equals("N1")) {
+ server = new N1(port, backlog, secure);
+ } else if (args[0].equals("N2")) {
+ server = new N2(port, backlog, secure);
+ }
+
+ return server;
+ }
+
+ static private void checkArgs(int i, int len) {
+ if ((i + 1) >= len) {
+ usage();
+ }
+ }
+
+ static public void main(String args[]) throws Exception {
+ Server server = createServer(args);
+
+ if (server == null) {
+ usage();
+ }
+
+ System.out.println("Server started.");
+ server.runServer();
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/StringContent.java b/staging/linux-x86/sample/nio/server/StringContent.java
new file mode 100644
index 0000000..267b338
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/StringContent.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+/**
+ * A Content type that provides for transferring Strings.
+ *
+ * @author Mark Reinhold
+ * @author Brad R. Wetmore
+ */
+class StringContent implements Content {
+
+ private static Charset ascii = Charset.forName("US-ASCII");
+
+ private String type; // MIME type
+ private String content;
+
+ StringContent(CharSequence c, String t) {
+ content = c.toString();
+ if (!content.endsWith("\n"))
+ content += "\n";
+ type = t + "; charset=iso-8859-1";
+ }
+
+ StringContent(CharSequence c) {
+ this(c, "text/plain");
+ }
+
+ StringContent(Exception x) {
+ StringWriter sw = new StringWriter();
+ x.printStackTrace(new PrintWriter(sw));
+ type = "text/plain; charset=iso-8859-1";
+ content = sw.toString();
+ }
+
+ public String type() {
+ return type;
+ }
+
+ private ByteBuffer bb = null;
+
+ private void encode() {
+ if (bb == null)
+ bb = ascii.encode(CharBuffer.wrap(content));
+ }
+
+ public long length() {
+ encode();
+ return bb.remaining();
+ }
+
+ public void prepare() {
+ encode();
+ bb.rewind();
+ }
+
+ public boolean send(ChannelIO cio) throws IOException {
+ if (bb == null)
+ throw new IllegalStateException();
+ cio.write(bb);
+
+ return bb.hasRemaining();
+ }
+
+ public void release() throws IOException {
+ }
+}
diff --git a/staging/linux-x86/sample/nio/server/URLDumper.java b/staging/linux-x86/sample/nio/server/URLDumper.java
new file mode 100644
index 0000000..30166e7
--- /dev/null
+++ b/staging/linux-x86/sample/nio/server/URLDumper.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+import java.io.*;
+import java.net.*;
+
+/**
+ * A simple example to illustrate using a URL to access a resource
+ * and then store the result to a File.
+ * <P>
+ * Any type of URL can be used: http, https, ftp, etc.
+ *
+ * @author Brad R. Wetmore
+ * @author Mark Reinhold
+ */
+public class URLDumper {
+ public static void main(String[] args) throws Exception {
+
+ if (args.length != 2) {
+ System.out.println("Usage: URLDumper <URL> <file>");
+ System.exit(1);
+ }
+
+ String location = args[0];
+ String file = args[1];
+
+ URL url = new URL(location);
+ FileOutputStream fos = new FileOutputStream(file);
+
+ byte [] bytes = new byte [4096];
+
+ InputStream is = url.openStream();
+
+ int read;
+
+ while ((read = is.read(bytes)) != -1) {
+ fos.write(bytes, 0, read);
+ }
+
+ is.close();
+ fos.close();
+ }
+}
diff --git a/staging/linux-x86/sample/scripting/scriptpad/README.txt b/staging/linux-x86/sample/scripting/scriptpad/README.txt
new file mode 100644
index 0000000..ab4bd5f
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/README.txt
@@ -0,0 +1,122 @@
+Scriptpad Sample
+
+* Introduction
+
+Scriptpad is a notepad like editor to open/edit/save and run
+script (JavaScript) files. This sample demonstrates the use of
+javax.script (JSR-223) API and JavaScript engine that is bundled
+with JDK 6.
+
+Scriptpad sample demonstrates how to use Javascript to use Java
+classes and objects to perform various tasks such as to modify,
+customize Swing GUI or to connect to a running application and
+monitor it using JMX (Java Management Extensions) API.
+
+* How to run Scriptpad?
+
+Scriptpad can be run with the following command:
+
+ java -jar ./build/scriptpad.jar
+
+(be sure to use the correct version of java). You can
+open/edit/save scripts using menu items under "File" menu.
+To run currently edited script, you can use "Tools->Run" menu.
+
+For example, you may enter
+
+ alert("hello, world");
+
+in the editor and run the same with "Tools->Run" menu.
+You will see an alert box with the message "hello, world".
+
+In addition to being a simple script editor/runner, scriptpad
+can be used to connect to a JMX MBean server ("Tools->JMX Connect"
+menu). User can specify JMX hostname and port. After connecting,
+user can use "monitoring and management" script functions defined
+in "mm.js" (see below).
+
+* Scriptpad Sources
+
+com.sun.demo.scriptpad.Main class is the entry point of this
+sample. This class creates ScriptEngine and evaluates few
+JavaScript "files" -- which are stored as resources (please
+refer to src/resources/*.js). Actual code for the scriptpad's
+main functionality lives in these JavaScript files.
+
+1. conc.js
+ -- simple concurrency utilities for JavaScript
+
+2. gui.js
+ -- simple GUI utilities for JavaScript
+
+3. mm.js
+ -- Monitoring and Management utilities for JavaScript
+
+4. scriptpad.js
+ -- This creates main "notepad"-like GUI for open/edit/save
+ and run script files
+
+5. Main.js
+ -- This script file can be used under "jrunscript" tool.
+ jrunscript is an experimental tool shipped with JDK (under
+ $JDK_HOME/bin directory). The scriptpad application can be
+ run by the following commands:
+
+ cd ./src/resources
+ $JDK_HOME/bin/jrunscript -f Main.js -f -
+
+
+* Extending Scriptpad:
+
+It is possible to extend scriptpad using scripts. There is a global
+object called "application". This object has 2 fields and a method.
+
+ Fields of the application object:
+
+ frame -> JFrame of the scriptpad
+ editor -> editor pane of the scriptpad
+
+ Method of the application object:
+
+ addTool -> adds a menu item under "Tools" menu
+
+ Example script to add "Tools->Hello" menu item:
+
+ application.addTool("Hello",
+ function() { alert("hello, world"); });
+
+After running the above script, you can click Tools->Hello menu item
+and you'll see an alert box.
+
+Scriptpad customization may also be done by defining a file named
+"scriptpad.js" under your home directory,. If this file is found,
+scriptpad loads this file just after initializating everything.
+In your initialization file, you can additional script functions
+by "load" function.
+
+* Script Samples:
+
+On clicking the menu items under "Examples" menu, scriptpad shows
+built-in examples in the editor. Also, there are few script samples
+under the ./src/scripts directory.
+
+* Monitoring and Management with Scriptpad:
+
+(1) Start the application with the JMX agent - here's an example of
+ how the Java2D demo is started
+
+ java -Dcom.sun.management.jmxremote.port=1090 \
+ -Dcom.sun.management.jmxremote.ssl=false \
+ -Dcom.sun.management.jmxremote.authenticate=false \
+ -jar $JDK_HOME/demo/jfc/Font2DTest/Font2DTest.jar
+
+(2) Start scriptpad and click on "Tools->JMX Connect" menu.
+ In the prompt, enter "localhost:1090" to connect to the above
+ program.
+
+After connecting to a MBeanServer (using "Tools->JMX Connect"),
+you can run any script that uses functions defined in "mm.js".
+For example, it is possible to load and run management scripts that
+are part of JConsole script shell plugin under the directory:
+
+ $JDK_HOME/demo/scripting/jconsole-plugin/src/scripts
diff --git a/staging/linux-x86/sample/scripting/scriptpad/build.properties b/staging/linux-x86/sample/scripting/scriptpad/build.properties
new file mode 100644
index 0000000..efcd591
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/build.properties
@@ -0,0 +1,22 @@
+main.dir=.
+
+src.dir=${main.dir}/src
+
+build.dir=build
+classes.dir=${build.dir}/classes
+jar=${build.dir}/scriptpad.jar
+javadoc.dir=${build.dir}/javadoc
+
+build.sysclasspath=ignore
+# E.g.: cp=lib/x.jar:lib/y.jar
+cp=
+extra.run.cp=
+
+main.class=com.sun.sample.scriptpad.Main
+
+run.cp=${cp}:${classes.dir}:${extra.run.cp}
+
+debug=true
+deprecation=false
+
+nbjdk.home=${basedir}/../../..
diff --git a/staging/linux-x86/sample/scripting/scriptpad/build.xml b/staging/linux-x86/sample/scripting/scriptpad/build.xml
new file mode 100644
index 0000000..5f203d5
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/build.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+
+<!--
+ This is ant (http://ant.apache.org) build script to build the
+ "Scriptpad" sample. Either this build.xml can be used standalone
+ with "ant" tool or can be opened as a project with NetBeans IDE
+ (http://www.netbeans.org).
+-->
+
+<project name="Scriptpad" default="jar" basedir=".">
+
+ <import file="nbproject/jdk.xml"/>
+
+ <target name="-prop-init">
+ <property file="user.build.properties"/>
+ <property file="build.properties"/>
+ </target>
+
+ <target name="-init" depends="-prop-init,-jdk-init"/>
+
+ <target name="compile" depends="-init" description="Compile main sources.">
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ </javac>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}"/>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile" description="Build JAR file for main sources.">
+ <jar jarfile="${jar}" compress="true">
+ <manifest>
+ <attribute name="Main-Class" value="${main.class}"/>
+ </manifest>
+ <fileset dir="${classes.dir}"/>
+ </jar>
+ </target>
+
+ <target name="run" depends="compile" description="Run application.">
+ <fail unless="main.class">Must set property 'main.class' (e.g. in build.properties)</fail>
+ <java classname="${main.class}" fork="true" failonerror="true">
+ <classpath path="${run.cp}"/>
+ </java>
+ </target>
+
+ <target name="javadoc" depends="-init" description="Build Javadoc.">
+ <mkdir dir="${javadoc.dir}"/>
+ <javadoc destdir="${javadoc.dir}">
+ <classpath path="${cp}"/>
+ <sourcepath>
+ <pathelement location="${src.dir}"/>
+ </sourcepath>
+ <fileset dir="${src.dir}"/>
+ </javadoc>
+ </target>
+
+ <target name="clean" depends="-init" description="Clean build products.">
+ <delete dir="${build.dir}"/>
+ <delete file="${jar}"/>
+ </target>
+
+ <target name="profile">
+ <ant antfile="nbproject/netbeans-targets.xml" target="profile"/>
+ </target>
+</project>
diff --git a/staging/linux-x86/sample/scripting/scriptpad/nbproject/file-targets.xml b/staging/linux-x86/sample/scripting/scriptpad/nbproject/file-targets.xml
new file mode 100644
index 0000000..0904977
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/nbproject/file-targets.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="scriptpad/file">
+
+ <import file="../build.xml"/>
+
+ <target name="compile-selected" depends="-init">
+ <fail unless="includes">Must set property 'includes'</fail>
+ <mkdir dir="${classes.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}" includes="${includes}">
+ <classpath path="${cp}"/>
+ </javac>
+ </target>
+
+</project>
diff --git a/staging/linux-x86/sample/scripting/scriptpad/nbproject/jdk.xml b/staging/linux-x86/sample/scripting/scriptpad/nbproject/jdk.xml
new file mode 100644
index 0000000..2b85b77
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/nbproject/jdk.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project name="jdk" basedir=".">
+
+ <target name="-jdk-preinit">
+ <condition property=".exe" value=".exe">
+ <os family="windows"/>
+ </condition>
+ <property name=".exe" value=""/>
+ <property name="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}"/>
+ <property name="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}"/>
+ <property name="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}"/>
+ <property name="nbjdk.appletviewer" value="${nbjdk.home}/bin/appletviewer${.exe}"/>
+ <property name="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar"/>
+ </target>
+
+ <target name="-jdk-presetdef-basic" depends="-jdk-preinit" unless="nbjdk.presetdef.basic.done">
+ <macrodef name="javac-presetdef">
+ <attribute name="javacval"/>
+ <sequential>
+ <presetdef name="javac">
+ <javac fork="yes" executable="@{javacval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javac-presetdef javacval="${nbjdk.javac}"/>
+ <macrodef name="java-presetdef">
+ <attribute name="javaval"/>
+ <sequential>
+ <presetdef name="java">
+ <java fork="yes" jvm="@{javaval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <java-presetdef javaval="${nbjdk.java}"/>
+ <macrodef name="javadoc-presetdef">
+ <attribute name="javadocval"/>
+ <sequential>
+ <presetdef name="javadoc">
+ <javadoc executable="@{javadocval}"/>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
+ <property name="nbjdk.presetdef.basic.done" value="true"/>
+ </target>
+
+ <target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" unless="nbjdk.presetdef.nbjpdastart.done">
+ <macrodef name="nbjpdastart-presetdef">
+ <attribute name="bootcpval"/>
+ <sequential>
+ <presetdef name="nbjpdastart">
+ <nbjpdastart>
+ <bootclasspath>
+ <path path="@{bootcpval}"/>
+ </bootclasspath>
+ </nbjpdastart>
+ </presetdef>
+ </sequential>
+ </macrodef>
+ <nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
+ <property name="nbjdk.presetdef.nbjpdastart.done" value="true"/>
+ </target>
+
+ <target name="-jdk-init" depends="-jdk-preinit,-jdk-presetdef-basic"/>
+
+</project>
diff --git a/staging/linux-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml b/staging/linux-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml
new file mode 100644
index 0000000..b53c34d
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/nbproject/netbeans-targets.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project basedir=".." name="scriptpad/NB">
+
+ <import file="../build.xml"/>
+
+ <target name="debug" depends="compile,-jdk-presetdef-nbjpdastart">
+ <nbjpdastart addressproperty="jpda.address" name="scriptpad" transport="dt_socket">
+ <classpath path="${run.cp}"/>
+ </nbjpdastart>
+ <java classname="${main.class}" failonerror="true" fork="true">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=none"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ </java>
+ </target>
+
+ <target name="debug-fix" depends="-init">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" deprecation="${deprecation}">
+ <classpath path="${cp}"/>
+ <include name="${class}.java"/>
+ </javac>
+ <nbjpdareload>
+ <fileset dir="${classes.dir}">
+ <include name="${class}.class"/>
+ </fileset>
+ </nbjpdareload>
+ </target>
+
+ <target name="show-javadoc" depends="javadoc">
+ <nbbrowse file="${javadoc.dir}/index.html"/>
+ </target>
+
+ <target name="profile" depends="compile">
+ <nbprofiledirect>
+ <classpath path="${run.cp}"/>
+ </nbprofiledirect>
+ <property environment="env"/>
+ <java classname="${main.class}" fork="true" failonerror="true" dir="${profiler.session.working.dir}" jvm="${profiler.info.jvm}">
+ <classpath path="${run.cp}"/>
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+ <jvmarg line="${profiler.info.jvmargs}"/>
+ <env key="LD_LIBRARY_PATH" path="${profiler.info.agentpath}:${env.LD_LIBRARY_PATH}"/>
+ <env key="Path" path="${profiler.info.agentpath}:${env.Path}"/>
+ </java>
+ </target>
+
+</project>
diff --git a/staging/linux-x86/sample/scripting/scriptpad/nbproject/project.xml b/staging/linux-x86/sample/scripting/scriptpad/nbproject/project.xml
new file mode 100644
index 0000000..32135c7
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/nbproject/project.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of Oracle nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS 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.
+-->
+
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ant.freeform</type>
+ <configuration>
+ <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+ <name>Scriptpad</name>
+ <properties>
+ <property-file>user.build.properties</property-file>
+ <property-file>build.properties</property-file>
+ <property name="nbjdk.bootclasspath">${nbjdk.home}/jre/lib/rt.jar</property>
+ </properties>
+ <folders>
+ <source-folder>
+ <label>JDK Demo</label>
+ <location>${main.dir}</location>
+ </source-folder>
+ <source-folder>
+ <label>Sources</label>
+ <type>java</type>
+ <location>${src.dir}</location>
+ </source-folder>
+ <build-folder>
+ <location>${build.dir}</location>
+ </build-folder>
+ </folders>
+ <ide-actions>
+ <action name="build">
+ <target>jar</target>
+ </action>
+ <action name="clean">
+ <target>clean</target>
+ </action>
+ <action name="rebuild">
+ <target>clean</target>
+ <target>jar</target>
+ </action>
+ <action name="run">
+ <target>run</target>
+ </action>
+ <action name="javadoc">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>show-javadoc</target>
+ </action>
+ <action name="debug">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ </action>
+ <action name="compile.single">
+ <script>nbproject/file-targets.xml</script>
+ <target>compile-selected</target>
+ <context>
+ <property>includes</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path</format>
+ <arity>
+ <separated-files>,</separated-files>
+ </arity>
+ </context>
+ </action>
+ <action name="run.single">
+ <target>run</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.single">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug</target>
+ <context>
+ <property>main.class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>java-name</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ <action name="debug.fix">
+ <script>nbproject/netbeans-targets.xml</script>
+ <target>debug-fix</target>
+ <context>
+ <property>class</property>
+ <folder>${src.dir}</folder>
+ <pattern>\.java$</pattern>
+ <format>relative-path-noext</format>
+ <arity>
+ <one-file-only/>
+ </arity>
+ </context>
+ </action>
+ </ide-actions>
+ <export>
+ <type>jar</type>
+ <location>${jar}</location>
+ <build-target>jar</build-target>
+ <clean-target>clean</clean-target>
+ </export>
+ <view>
+ <items>
+ <source-folder style="packages">
+ <label>Sources</label>
+ <location>${src.dir}</location>
+ </source-folder>
+ <source-file>
+ <location>${main.dir}/README.txt</location>
+ </source-file>
+ </items>
+ <context-menu>
+ <ide-action name="build"/>
+ <ide-action name="rebuild"/>
+ <ide-action name="clean"/>
+ <ide-action name="javadoc"/>
+ <separator/>
+ <ide-action name="run"/>
+ <ide-action name="debug"/>
+ </context-menu>
+ </view>
+ <subprojects/>
+ </general-data>
+ <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
+ <compilation-unit>
+ <package-root>${src.dir}</package-root>
+ <classpath mode="compile">${cp}</classpath>
+ <classpath mode="execute">${run.cp}</classpath>
+ <classpath mode="boot">${nbjdk.bootclasspath}</classpath>
+ <built-to>${classes.dir}</built-to>
+ <built-to>${jar}</built-to>
+ <javadoc-built-to>${javadoc.dir}</javadoc-built-to>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ </java-data>
+ </configuration>
+</project>
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf b/staging/linux-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf
new file mode 100644
index 0000000..76eda30
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/META-INF/manifest.mf
@@ -0,0 +1,2 @@
+Main-Class: com.sun.sample.scriptpad.Main
+
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java b/staging/linux-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java
new file mode 100644
index 0000000..aaeb58d
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/com/sun/sample/scriptpad/Main.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+
+package com.sun.sample.scriptpad;
+
+import javax.script.*;
+import java.io.*;
+
+/**
+ * This is the entry point of "Scriptpad" sample. This class creates
+ * ScriptEngine and evaluates few JavaScript "files" -- which are stored
+ * as resources (please refer to src/resources/*.js). Actual code for the
+ * scriptpad's main functionality lives in these JavaScript files.
+ */
+public class Main {
+ public static void main(String[] args) throws Exception {
+
+ // create a ScriptEngineManager
+ ScriptEngineManager m = new ScriptEngineManager();
+ // get an instance of JavaScript script engine
+ ScriptEngine engine = m.getEngineByName("js");
+
+ // expose the current script engine as a global variable
+ engine.put("engine", engine);
+
+ // evaluate few scripts that are bundled in "resources"
+ eval(engine, "conc.js");
+ eval(engine, "gui.js");
+ eval(engine, "scriptpad.js");
+ eval(engine, "mm.js");
+ }
+
+ private static void eval(ScriptEngine engine, String name)
+ throws Exception {
+ /*
+ * This class is compiled into a jar file. The jar file
+ * contains few scripts under /resources URL.
+ */
+ InputStream is = Main.class.getResourceAsStream("/resources/" + name);
+ // current script file name for better error messages
+ engine.put(ScriptEngine.FILENAME, name);
+ // evaluate the script in the InputStream
+ engine.eval(new InputStreamReader(is));
+ }
+}
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/resources/Main.js b/staging/linux-x86/sample/scripting/scriptpad/src/resources/Main.js
new file mode 100644
index 0000000..a1c332d
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/resources/Main.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script can be loaded in jrunscript to start scriptpad.
+ *
+ * jrunscript -f Main.js -f -
+ */
+
+load("conc.js");
+load("gui.js");
+load("scriptpad.js");
+load("mm.js");
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/resources/conc.js b/staging/linux-x86/sample/scripting/scriptpad/src/resources/conc.js
new file mode 100644
index 0000000..aaca49a
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/resources/conc.js
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * Concurrency utilities for JavaScript. These are based on
+ * java.lang and java.util.concurrent API. The following functions
+ * provide a simpler API for scripts. Instead of directly using java.lang
+ * and java.util.concurrent classes, scripts can use functions and
+ * objects exported from here.
+ */
+
+// shortcut for j.u.c lock classes
+var Lock = java.util.concurrent.locks.ReentrantLock;
+var RWLock = java.util.concurrent.locks.ReentrantReadWriteLock;
+
+// check if there is a build in sync function, define one if missing
+if (typeof sync === "undefined") {
+ var sync = function(func, obj) {
+ if (arguments.length < 1 || arguments.length > 2 ) {
+ throw "sync(function [,object]) parameter count mismatch";
+ }
+
+ var syncobj = (arguments.length == 2 ? obj : this);
+
+ if (!syncobj._syncLock) {
+ syncobj._syncLock = new Lock();
+ }
+
+ return function() {
+ syncobj._syncLock.lock();
+ try {
+ func.apply(null, arguments);
+ } finally {
+ syncobj._syncLock.unlock();
+ }
+ };
+ };
+ sync.docString = "synchronize a function, optionally on an object";
+}
+
+/**
+ * Wrapper for java.lang.Object.wait
+ *
+ * can be called only within a sync method
+ */
+function wait(object) {
+ var objClazz = java.lang.Class.forName('java.lang.Object');
+ var waitMethod = objClazz.getMethod('wait', null);
+ waitMethod.invoke(object, null);
+}
+wait.docString = "convenient wrapper for java.lang.Object.wait method";
+
+/**
+ * Wrapper for java.lang.Object.notify
+ *
+ * can be called only within a sync method
+ */
+function notify(object) {
+ var objClazz = java.lang.Class.forName('java.lang.Object');
+ var notifyMethod = objClazz.getMethod('notify', null);
+ notifyMethod.invoke(object, null);
+}
+notify.docString = "convenient wrapper for java.lang.Object.notify method";
+
+/**
+ * Wrapper for java.lang.Object.notifyAll
+ *
+ * can be called only within a sync method
+ */
+function notifyAll(object) {
+ var objClazz = java.lang.Class.forName('java.lang.Object');
+ var notifyAllMethod = objClazz.getMethod('notifyAll', null);
+ notifyAllMethod.invoke(object, null);
+}
+notifyAll.docString = "convenient wrapper for java.lang.Object.notifyAll method";
+
+/**
+ * Creates a java.lang.Runnable from a given script
+ * function.
+ */
+Function.prototype.runnable = function() {
+ var args = arguments;
+ var func = this;
+ return new java.lang.Runnable() {
+ run: function() {
+ func.apply(null, args);
+ }
+ }
+};
+
+/**
+ * Executes the function on a new Java Thread.
+ */
+Function.prototype.thread = function() {
+ var t = new java.lang.Thread(this.runnable.apply(this, arguments));
+ t.start();
+ return t;
+};
+
+/**
+ * Executes the function on a new Java daemon Thread.
+ */
+Function.prototype.daemon = function() {
+ var t = new java.lang.Thread(this.runnable.apply(this, arguments));
+ t.setDaemon(true);
+ t.start();
+ return t;
+};
+
+/**
+ * Creates a java.util.concurrent.Callable from a given script
+ * function.
+ */
+Function.prototype.callable = function() {
+ var args = arguments;
+ var func = this;
+ return new java.util.concurrent.Callable() {
+ call: function() { return func.apply(null, args); }
+ }
+};
+
+/**
+ * Registers the script function so that it will be called exit.
+ */
+Function.prototype.atexit = function () {
+ var args = arguments;
+ java.lang.Runtime.getRuntime().addShutdownHook(
+ new java.lang.Thread(this.runnable.apply(this, args)));
+};
+
+/**
+ * Executes the function asynchronously.
+ *
+ * @return a java.util.concurrent.FutureTask
+ */
+Function.prototype.future = (function() {
+ // default executor for future
+ var juc = java.util.concurrent;
+ var theExecutor = juc.Executors.newSingleThreadExecutor();
+ // clean-up the default executor at exit
+ (function() { theExecutor.shutdown(); }).atexit();
+ return function() {
+ return theExecutor.submit(this.callable.apply(this, arguments));
+ };
+})();
+
+/**
+ * Executes a function after acquiring given lock. On return,
+ * (normal or exceptional), lock is released.
+ *
+ * @param lock lock that is locked and unlocked
+ */
+Function.prototype.sync = function (lock) {
+ if (arguments.length == 0) {
+ throw "lock is missing";
+ }
+ var res = new Array(arguments.length - 1);
+ for (var i = 0; i < res.length; i++) {
+ res[i] = arguments[i + 1];
+ }
+ lock.lock();
+ try {
+ this.apply(null, res);
+ } finally {
+ lock.unlock();
+ }
+};
+
+/**
+ * Causes current thread to sleep for specified
+ * number of milliseconds
+ *
+ * @param interval in milliseconds
+ */
+function sleep(interval) {
+ java.lang.Thread.sleep(interval);
+}
+sleep.docString = "wrapper for java.lang.Thread.sleep method";
+
+/**
+ * Schedules a task to be executed once in N milliseconds specified.
+ *
+ * @param callback function or expression to evaluate
+ * @param interval in milliseconds to sleep
+ * @return timeout ID (which is nothing but Thread instance)
+ */
+function setTimeout(callback, interval) {
+ if (! (callback instanceof Function)) {
+ callback = new Function(callback);
+ }
+
+ // start a new thread that sleeps given time
+ // and calls callback in an infinite loop
+ return (function() {
+ try {
+ sleep(interval);
+ } catch (x) { }
+ callback();
+ }).daemon();
+}
+setTimeout.docString = "calls given callback once after specified interval";
+
+/**
+ * Cancels a timeout set earlier.
+ * @param tid timeout ID returned from setTimeout
+ */
+function clearTimeout(tid) {
+ // we just interrupt the timer thread
+ tid.interrupt();
+}
+clearTimeout.docString = "interrupt a setTimeout timer";
+
+/**
+ * Schedules a task to be executed once in
+ * every N milliseconds specified.
+ *
+ * @param callback function or expression to evaluate
+ * @param interval in milliseconds to sleep
+ * @return timeout ID (which is nothing but Thread instance)
+ */
+function setInterval(callback, interval) {
+ if (! (callback instanceof Function)) {
+ callback = new Function(callback);
+ }
+
+ // start a new thread that sleeps given time
+ // and calls callback in an infinite loop
+ return (function() {
+ while (true) {
+ try {
+ sleep(interval);
+ } catch (x) {
+ break;
+ }
+ callback();
+ }
+ }).daemon();
+}
+setInterval.docString = "calls given callback every specified interval";
+
+/**
+ * Cancels a timeout set earlier.
+ * @param tid timeout ID returned from setTimeout
+ */
+function clearInterval(tid) {
+ // we just interrupt the timer thread
+ tid.interrupt();
+}
+clearInterval.docString = "interrupt a setInterval timer";
+
+/**
+ * Simple access to thread local storage.
+ *
+ * Script sample:
+ *
+ * __thread.x = 44;
+ * function f() {
+ * __thread.x = 'hello';
+ * print(__thread.x);
+ * }
+ * f.thread(); // prints 'hello'
+ * print(__thread.x); // prints 44 in main thread
+ */
+var __thread = (function () {
+ var map = new Object();
+ return new JSAdapter({
+ __has__: function(name) {
+ return map[name] != undefined;
+ },
+ __get__: function(name) {
+ if (map[name] != undefined) {
+ return map[name].get();
+ } else {
+ return undefined;
+ }
+ },
+ __put__: sync(function(name, value) {
+ if (map[name] == undefined) {
+ var tmp = new java.lang.ThreadLocal();
+ tmp.set(value);
+ map[name] = tmp;
+ } else {
+ map[name].set(value);
+ }
+ }),
+ __delete__: function(name) {
+ if (map[name] != undefined) {
+ map[name].set(null);
+ }
+ }
+ });
+})();
+
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/resources/gui.js b/staging/linux-x86/sample/scripting/scriptpad/src/resources/gui.js
new file mode 100644
index 0000000..d62b92f
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/resources/gui.js
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * Few user interface utilities.
+ */
+
+if (this.window === undefined) {
+ this.window = null;
+}
+
+/**
+ * Swing invokeLater - invokes given function in AWT event thread
+ */
+Function.prototype.invokeLater = function() {
+ var SwingUtilities = javax.swing.SwingUtilities;
+ var func = this;
+ var args = arguments;
+ SwingUtilities.invokeLater(new java.lang.Runnable() {
+ run: function() {
+ func.apply(func, args);
+ }
+ });
+};
+
+/**
+ * Swing invokeAndWait - invokes given function in AWT event thread
+ * and waits for it's completion
+ */
+Function.prototype.invokeAndWait = function() {
+ var SwingUtilities = javax.swing.SwingUtilities;
+ var func = this;
+ var args = arguments;
+ SwingUtilities.invokeAndWait(new java.lang.Runnable() {
+ run: function() {
+ func.apply(func, args);
+ }
+ });
+};
+
+/**
+ * Am I running in AWT event dispatcher thread?
+ */
+function isEventThread() {
+ var SwingUtilities = javax.swing.SwingUtilities;
+ return SwingUtilities.isEventDispatchThread();
+}
+isEventThread.docString = "returns whether the current thread is GUI thread";
+
+/**
+ * Opens a file dialog box
+ *
+ * @param curDir current directory [optional]
+ * @param save flag tells whether this is a save dialog or not
+ * @return selected file or else null
+ */
+function fileDialog(curDir, save) {
+ var result;
+ function _fileDialog() {
+ if (curDir == undefined) {
+ curDir = new java.io.File(".");
+ }
+
+ var JFileChooser = javax.swing.JFileChooser;
+ var dialog = new JFileChooser(curDir);
+ var res = save ? dialog.showSaveDialog(window):
+ dialog.showOpenDialog(window);
+
+ if (res == JFileChooser.APPROVE_OPTION) {
+ result = dialog.getSelectedFile();
+ } else {
+ result = null;
+ }
+ }
+
+ if (isEventThread()) {
+ _fileDialog();
+ } else {
+ _fileDialog.invokeAndWait();
+ }
+
+ return result;
+}
+fileDialog.docString = "show a file dialog box";
+
+/**
+ * Opens a color chooser dialog box
+ *
+ * @param title of the dialog box [optional]
+ * @param color default color [optional]
+ * @return chosen color or default color
+ */
+function colorDialog(title, color) {
+ var result;
+
+ function _colorDialog() {
+ if (title == undefined) {
+ title = "Choose Color";
+ }
+
+ if (color == undefined) {
+ color = java.awt.Color.BLACK;
+ }
+
+ var chooser = new javax.swing.JColorChooser();
+ var res = chooser.showDialog(window, title, color);
+ result = res ? res : color;
+ }
+
+ if (isEventThread()) {
+ _colorDialog();
+ } else {
+ _colorDialog.invokeAndWait();
+ }
+
+ return result;
+}
+colorDialog.docString = "shows a color chooser dialog box";
+
+/**
+ * Shows a message box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ * @param msgType type of message box [constants in JOptionPane]
+ */
+function msgBox(msg, title, msgType) {
+ function _msgBox() {
+ var JOptionPane = javax.swing.JOptionPane;
+ if (msg === undefined) msg = "undefined";
+ if (msg === null) msg = "null";
+ if (title == undefined) title = msg;
+ if (msgType == undefined) msgType = JOptionPane.INFORMATION_MESSAGE;
+ JOptionPane.showMessageDialog(window, msg, title, msgType);
+ }
+
+ if (isEventThread()) {
+ _msgBox();
+ } else {
+ _msgBox.invokeAndWait();
+ }
+}
+msgBox.docString = "shows MessageBox to the user";
+
+/**
+ * Shows an information alert box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ */
+function alert(msg, title) {
+ var JOptionPane = javax.swing.JOptionPane;
+ msgBox(msg, title, JOptionPane.INFORMATION_MESSAGE);
+}
+alert.docString = "shows an alert message box to the user";
+
+/**
+ * Shows an error alert box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ */
+function error(msg, title) {
+ var JOptionPane = javax.swing.JOptionPane;
+ msgBox(msg, title, JOptionPane.ERROR_MESSAGE);
+}
+error.docString = "shows an error message box to the user";
+
+/**
+ * Shows a warning alert box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ */
+function warn(msg, title) {
+ var JOptionPane = javax.swing.JOptionPane;
+ msgBox(msg, title, JOptionPane.WARNING_MESSAGE);
+}
+warn.docString = "shows a warning message box to the user";
+
+/**
+ * Shows a prompt dialog box
+ *
+ * @param question question to be asked
+ * @param answer default answer suggested [optional]
+ * @return answer given by user
+ */
+function prompt(question, answer) {
+ var result;
+ function _prompt() {
+ var JOptionPane = javax.swing.JOptionPane;
+ if (answer == undefined) answer = "";
+ result = JOptionPane.showInputDialog(window, question, answer);
+ }
+
+ if (isEventThread()) {
+ _prompt();
+ } else {
+ _prompt.invokeAndWait();
+ }
+
+ return result;
+}
+prompt.docString = "shows a prompt box to the user and returns the answer";
+
+/**
+ * Shows a confirmation dialog box
+ *
+ * @param msg message to be shown
+ * @param title title of message box [optional]
+ * @return boolean (yes->true, no->false)
+ */
+function confirm(msg, title) {
+ var result;
+ var JOptionPane = javax.swing.JOptionPane;
+
+ function _confirm() {
+ if (title == undefined) title = msg;
+ var optionType = JOptionPane.YES_NO_OPTION;
+ result = JOptionPane.showConfirmDialog(window, msg, title, optionType);
+ }
+
+ if (isEventThread()) {
+ _confirm();
+ } else {
+ _confirm.invokeAndWait();
+ }
+
+ return result == JOptionPane.YES_OPTION;
+}
+confirm.docString = "shows a confirmation message box to the user";
+
+/**
+ * Exit the process after confirmation from user
+ *
+ * @param exitCode return code to OS [optional]
+ */
+function exit(exitCode) {
+ if (exitCode == undefined) exitCode = 0;
+ if (confirm("Do you really want to exit?")) {
+ java.lang.System.exit(exitCode);
+ }
+}
+exit.docString = "exits jconsole";
+
+// synonym to exit
+var quit = exit;
+
+// if echo function is not defined, define it as synonym
+// for println function
+if (this.echo == undefined) {
+ function echo(str) {
+ println(str);
+ }
+}
+
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/resources/mm.js b/staging/linux-x86/sample/scripting/scriptpad/src/resources/mm.js
new file mode 100644
index 0000000..07efad2
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/resources/mm.js
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This is a collection of utilities for Monitoring
+ * and management API.
+ *
+ * File dependency:
+ * conc.js -> for concurrency utilities
+ */
+
+// At any time, we maintain atmost one MBeanServer
+// connection. And so, we store the same as a global
+// variable.
+var mmConnection = null;
+
+function jmxConnect(hostport) {
+ if (mmConnection != null) {
+ // close the existing connection
+ try {
+ mmConnection.close();
+ } catch (e) {
+ }
+ }
+
+ var JMXServiceURL = javax.management.remote.JMXServiceURL;
+ var JMXConnectorFactory = javax.management.remote.JMXConnectorFactory;
+
+ var urlPath = "/jndi/rmi://" + hostport + "/jmxrmi";
+ var url = new JMXServiceURL("rmi", "", 0, urlPath);
+ var jmxc = JMXConnectorFactory.connect(url);
+ // note that the "mmConnection" is a global variable!
+ mmConnection = jmxc.getMBeanServerConnection();
+}
+jmxConnect.docString = "connects to the given host, port (specified as name:port)";
+
+function mbeanConnection() {
+ if (mmConnection == null) {
+ throw "Not connected to MBeanServer yet!";
+ }
+
+ return mmConnection;
+}
+mbeanConnection.docString = "returns the current MBeanServer connection";
+
+/**
+ * Returns a platform MXBean proxy for given MXBean name and interface class
+ */
+function newPlatformMXBeanProxy(name, intf) {
+ var factory = java.lang.management.ManagementFactory;
+ return factory.newPlatformMXBeanProxy(mbeanConnection(), name, intf);
+}
+newPlatformMXBeanProxy.docString = "returns a proxy for a platform MXBean";
+
+/**
+ * Wraps a string to ObjectName if needed.
+ */
+function objectName(objName) {
+ var ObjectName = Packages.javax.management.ObjectName;
+ if (objName instanceof ObjectName) {
+ return objName;
+ } else {
+ return new ObjectName(objName);
+ }
+}
+objectName.docString = "creates JMX ObjectName for a given String";
+
+/**
+ * Creates a new (M&M) Attribute object
+ *
+ * @param name name of the attribute
+ * @param value value of the attribute
+ */
+function attribute(name, value) {
+ var Attribute = Packages.javax.management.Attribute;
+ return new Attribute(name, value);
+}
+attribute.docString = "returns a new JMX Attribute using name and value given";
+
+/**
+ * Returns MBeanInfo for given ObjectName. Strings are accepted.
+ */
+function mbeanInfo(objName) {
+ objName = objectName(objName);
+ return mbeanConnection().getMBeanInfo(objName);
+}
+mbeanInfo.docString = "returns MBeanInfo of a given ObjectName";
+
+/**
+ * Returns ObjectInstance for a given ObjectName.
+ */
+function objectInstance(objName) {
+ objName = objectName(objName);
+ return mbeanConnection().objectInstance(objectName);
+}
+objectInstance.docString = "returns ObjectInstance for a given ObjectName";
+
+/**
+ * Queries with given ObjectName and QueryExp.
+ * QueryExp may be null.
+ *
+ * @return set of ObjectNames.
+ */
+function queryNames(objName, query) {
+ objName = objectName(objName);
+ if (query == undefined) query = null;
+ return mbeanConnection().queryNames(objName, query);
+}
+queryNames.docString = "returns QueryNames using given ObjectName and optional query";
+
+/**
+ * Queries with given ObjectName and QueryExp.
+ * QueryExp may be null.
+ *
+ * @return set of ObjectInstances.
+ */
+function queryMBeans(objName, query) {
+ objName = objectName(objName);
+ if (query == undefined) query = null;
+ return mbeanConnection().queryMBeans(objName, query);
+}
+queryMBeans.docString = "return MBeans using given ObjectName and optional query";
+
+// wraps a script array as java.lang.Object[]
+function objectArray(array) {
+ return Java.to(array, "java.lang.Object[]");
+}
+
+// wraps a script (string) array as java.lang.String[]
+function stringArray(array) {
+ return Java.to(array, "java.lang.String[]");
+}
+
+// script array to Java List
+function toAttrList(array) {
+ var AttributeList = Packages.javax.management.AttributeList;
+ if (array instanceof AttributeList) {
+ return array;
+ }
+ var list = new AttributeList(array.length);
+ for (var index = 0; index < array.length; index++) {
+ list.add(array[index]);
+ }
+ return list;
+}
+
+// Java Collection (Iterable) to script array
+function toArray(collection) {
+ if (collection instanceof Array) {
+ return collection;
+ }
+ var itr = collection.iterator();
+ var array = new Array();
+ while (itr.hasNext()) {
+ array[array.length] = itr.next();
+ }
+ return array;
+}
+
+// gets MBean attributes
+function getMBeanAttributes(objName, attributeNames) {
+ objName = objectName(objName);
+ return mbeanConnection().getAttributes(objName,stringArray(attributeNames));
+}
+getMBeanAttributes.docString = "returns specified Attributes of given ObjectName";
+
+// gets MBean attribute
+function getMBeanAttribute(objName, attrName) {
+ objName = objectName(objName);
+ return mbeanConnection().getAttribute(objName, attrName);
+}
+getMBeanAttribute.docString = "returns a single Attribute of given ObjectName";
+
+// sets MBean attributes
+function setMBeanAttributes(objName, attrList) {
+ objName = objectName(objName);
+ attrList = toAttrList(attrList);
+ return mbeanConnection().setAttributes(objName, attrList);
+}
+setMBeanAttributes.docString = "sets specified Attributes of given ObjectName";
+
+// sets MBean attribute
+function setMBeanAttribute(objName, attrName, attrValue) {
+ var Attribute = Packages.javax.management.Attribute;
+ objName = objectName(objName);
+ mbeanConnection().setAttribute(objName, new Attribute(attrName, attrValue));
+}
+setMBeanAttribute.docString = "sets a single Attribute of given ObjectName";
+
+// invokes an operation on given MBean
+function invokeMBean(objName, operation, params, signature) {
+ objName = objectName(objName);
+ params = objectArray(params);
+ signature = stringArray(signature);
+ return mbeanConnection().invoke(objName, operation, params, signature);
+}
+invokeMBean.docString = "invokes MBean operation on given ObjectName";
+
+/**
+ * Wraps a MBean specified by ObjectName as a convenient
+ * script object -- so that setting/getting MBean attributes
+ * and invoking MBean method can be done with natural syntax.
+ *
+ * @param objName ObjectName of the MBean
+ * @param async asynchornous mode [optional, default is false]
+ * @return script wrapper for MBean
+ *
+ * With async mode, all field, operation access is async. Results
+ * will be of type FutureTask. When you need value, call 'get' on it.
+ */
+function mbean(objName, async) {
+ var index;
+ objName = objectName(objName);
+ var info = mbeanInfo(objName);
+ var attrs = info.attributes;
+ var attrMap = new Object;
+ for (index in attrs) {
+ attrMap[attrs[index].name] = attrs[index];
+ }
+ var opers = info.operations;
+ var operMap = new Object;
+ for (index in opers) {
+ operMap[opers[index].name] = opers[index];
+ }
+
+ function isAttribute(name) {
+ return name in attrMap;
+ }
+
+ function isOperation(name) {
+ return name in operMap;
+ }
+
+ return new JSAdapter() {
+ __has__: function (name) {
+ return isAttribute(name) || isOperation(name);
+ },
+ __get__: function (name) {
+ if (isAttribute(name)) {
+ if (async) {
+ return getMBeanAttribute.future(objName, name);
+ } else {
+ return getMBeanAttribute(objName, name);
+ }
+ } else {
+ return undefined;
+ }
+ },
+ __call__: function(name) {
+ if (isOperation(name)) {
+ var oper = operMap[name];
+
+ var params = [];
+ for (var j = 1; j < arguments.length; j++) {
+ params[j-1]= arguments[j];
+ }
+
+ var sigs = oper.signature;
+
+ var sigNames = new Array(sigs.length);
+ for (var index in sigs) {
+ sigNames[index] = sigs[index].getType();
+ }
+
+ if (async) {
+ return invokeMBean.future(objName, name, params, sigNames);
+ } else {
+ return invokeMBean(objName, name, params, sigNames);
+ }
+ } else {
+ return undefined;
+ }
+ },
+ __put__: function (name, value) {
+ if (isAttribute(name)) {
+ if (async) {
+ setMBeanAttribute.future(objName, name, value);
+ } else {
+ setMBeanAttribute(objName, name, value);
+ }
+ } else {
+ return undefined;
+ }
+ }
+ };
+}
+mbean.docString = "returns a conveninent script wrapper for a MBean of given ObjectName";
+
+if (this.application != undefined) {
+ this.application.addTool("JMX Connect",
+ // connect to a JMX MBean Server
+ function () {
+ var url = prompt("Connect to JMX server (host:port)");
+ if (url != null) {
+ try {
+ jmxConnect(url);
+ alert("connected!");
+ } catch (e) {
+ error(e, "Can not connect to " + url);
+ }
+ }
+ });
+}
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/resources/scriptpad.js b/staging/linux-x86/sample/scripting/scriptpad/src/resources/scriptpad.js
new file mode 100644
index 0000000..807d05e
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/resources/scriptpad.js
@@ -0,0 +1,662 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script creates a simple Notepad-like interface, which
+ * serves as a simple script editor, runner.
+ *
+ * File dependency:
+ *
+ * gui.js -> for basic GUI functions
+ */
+
+/*
+ * globalThis is used for actionHelpGlobals() and showFrame().
+ */
+var globalThis = this;
+
+/*
+ * JavaImporter helps in avoiding pollution of JavaScript
+ * global namespace. We can import multiple Java packages
+ * with this and use the JavaImporter object with "with"
+ * statement.
+ */
+var guiPkgs = new JavaImporter(java.awt, java.awt.event,
+ javax.swing, javax.swing.undo,
+ javax.swing.event, javax.swing.text);
+
+// main entry point of the scriptpad application
+var main = function() {
+ function createEditor() {
+ var c = new guiPkgs.JTextArea();
+ c.setDragEnabled(true);
+ c.setFont(new guiPkgs.Font("monospaced", guiPkgs.Font.PLAIN, 12));
+ return c;
+ }
+
+ /*const*/ var titleSuffix = "- Scriptpad";
+ /*const*/ var defaultTitle = "Untitled" + titleSuffix;
+
+ // Scriptpad's main frame
+ var frame;
+ // Scriptpad's main editor
+ var editor;
+
+ // To track the current file name
+ var curFileName = null;
+
+ // To track whether the current document
+ // has been modified or not
+ var docChanged = false;
+
+ // check and alert user for unsaved
+ // but modified document
+ function checkDocChanged() {
+ if (docChanged) {
+ // ignore zero-content untitled document
+ if (curFileName == null &&
+ editor.document.length == 0) {
+ return;
+ }
+
+ if (confirm("Do you want to save the changes?",
+ "The document has changed")) {
+ actionSave();
+ }
+ }
+ }
+
+ // set a document listener to track
+ // whether that is modified or not
+ function setDocListener() {
+ var doc = editor.getDocument();
+ docChanged = false;
+ doc.addDocumentListener( new guiPkgs.DocumentListener() {
+ equals: function(o) {
+ return this === o; },
+ toString: function() {
+ return "doc listener"; },
+ changeUpdate: function() {
+ docChanged = true; },
+ insertUpdate: function() {
+ docChanged = true; },
+ removeUpdate: function() {
+ docChanged = true; }
+ });
+ }
+
+ // menu action functions
+
+ // "File" menu
+
+ // create a "new" document
+ function actionNew() {
+ checkDocChanged();
+ curFileName = null;
+ editor.setDocument(new guiPkgs.PlainDocument());
+ setDocListener();
+ frame.setTitle(defaultTitle);
+ editor.revalidate();
+ }
+
+ // open an existing file
+ function actionOpen() {
+ checkDocChanged();
+ var f = fileDialog();
+ if (f == null) {
+ return;
+ }
+
+ if (f.isFile() && f.canRead()) {
+ frame.setTitle(f.getName() + titleSuffix);
+ editor.setDocument(new guiPkgs.PlainDocument());
+ var progress = new guiPkgs.JProgressBar();
+ progress.setMinimum(0);
+ progress.setMaximum(f.length());
+ var doc = editor.getDocument();
+ var inp = new java.io.FileReader(f);
+ var buff = java.lang.reflect.Array.newInstance(
+ java.lang.Character.TYPE, 4096);
+ var nch;
+ while ((nch = inp.read(buff, 0, buff.length)) != -1) {
+ doc.insertString(doc.getLength(),
+ new java.lang.String(buff, 0, nch), null);
+ progress.setValue(progress.getValue() + nch);
+ }
+ inp.close();
+ curFileName = f.getAbsolutePath();
+ setDocListener();
+ } else {
+ error("Can not open file: " + f,
+ "Error opening file: " + f);
+ }
+ }
+
+ // open script from a URL
+ function actionOpenURL() {
+ checkDocChanged();
+ var url = prompt("Address:");
+ if (url == null) {
+ return;
+ }
+
+ try {
+ var u = new java.net.URL(url);
+ editor.setDocument(new guiPkgs.PlainDocument());
+ frame.setTitle(url + titleSuffix);
+ var progress = new guiPkgs.JProgressBar();
+ progress.setMinimum(0);
+ progress.setIndeterminate(true);
+ var doc = editor.getDocument();
+ var inp = new java.io.InputStreamReader(u.openStream());
+ var buff = java.lang.reflect.Array.newInstance(
+ java.lang.Character.TYPE, 4096);
+ var nch;
+ while ((nch = inp.read(buff, 0, buff.length)) != -1) {
+ doc.insertString(doc.getLength(),
+ new java.lang.String(buff, 0, nch), null);
+ progress.setValue(progress.getValue() + nch);
+ }
+ curFileName = null;
+ setDocListener();
+ } catch (e) {
+ error("Error opening URL: " + e,
+ "Can not open URL: " + url);
+ }
+ }
+
+ // factored out "save" function used by
+ // save, save as menu actions
+ function save(file) {
+ var doc = editor.getDocument();
+ frame.setTitle(file.getName() + titleSuffix);
+ curFileName = file;
+ var progress = new guiPkgs.JProgressBar();
+ progress.setMinimum(0);
+ progress.setMaximum(file.length());
+ var out = new java.io.FileWriter(file);
+ var text = new guiPkgs.Segment();
+ text.setPartialReturn(true);
+ var charsLeft = doc.getLength();
+ var offset = 0;
+ var min;
+
+ while (charsLeft > 0) {
+ doc.getText(offset, Math.min(4096, charsLeft), text);
+ out.write(text.array, text.offset, text.count);
+ charsLeft -= text.count;
+ offset += text.count;
+ progress.setValue(offset);
+ java.lang.Thread.sleep(10);
+ }
+
+ out.flush();
+ out.close();
+ docChanged = false;
+ }
+
+ // file-save as menu
+ function actionSaveAs() {
+ var ret = fileDialog(null, true);
+ if (ret == null) {
+ return;
+ }
+ save(ret);
+ }
+
+ // file-save menu
+ function actionSave() {
+ if (curFileName) {
+ save(new java.io.File(curFileName));
+ } else {
+ actionSaveAs();
+ }
+ }
+
+ // exit from scriptpad
+ function actionExit() {
+ checkDocChanged();
+ java.lang.System.exit(0);
+ }
+
+ // "Edit" menu
+
+ // cut the currently selected text
+ function actionCut() {
+ editor.cut();
+ }
+
+ // copy the currently selected text to clipboard
+ function actionCopy() {
+ editor.copy();
+ }
+
+ // paste clipboard content to document
+ function actionPaste() {
+ editor.paste();
+ }
+
+ // select all the text in editor
+ function actionSelectAll() {
+ editor.selectAll();
+ }
+
+ // "Tools" menu
+
+ // run the current document as JavaScript
+ function actionRun() {
+ var doc = editor.getDocument();
+ var script = doc.getText(0, doc.getLength());
+ var oldFile = engine.get(javax.script.ScriptEngine.FILENAME);
+ try {
+ if (engine == undefined) {
+ var m = new javax.script.ScriptEngineManager();
+ engine = m.getEngineByName("nashorn");
+ }
+ engine.put(javax.script.ScriptEngine.FILENAME, frame.title);
+ engine.eval(script, context);
+ } catch (e) {
+ error(e, "Script Error");
+ e.printStackTrace();
+ } finally {
+ engine.put(javax.script.ScriptEngine.FILENAME, oldFile);
+ }
+ }
+
+ // "Examples" menu
+
+ // show given script as new document
+ function showScript(title, str) {
+ actionNew();
+ frame.setTitle("Example - " + title + titleSuffix);
+ var doc = editor.document;
+ doc.insertString(0, str, null);
+ }
+
+ // "hello world"
+ function actionHello() {
+ showScript(actionEval.title,
+ "alert('Hello, world');");
+ }
+ actionHello.title = "Hello, World";
+
+ // eval the "hello world"!
+ function actionEval() {
+ showScript(actionEval.title,
+ "eval(\"alert('Hello, world')\");");
+ }
+ actionEval.title = "Eval";
+
+ // show how to access Java static methods
+ function actionJavaStatic() {
+ showScript(arguments.callee.title,
+ "// Just use Java syntax\n" +
+ "var props = java.lang.System.getProperties();\n" +
+ "alert(props.get('os.name'));");
+ }
+ actionJavaStatic.title = "Java Static Calls";
+
+ // show how to access Java classes, methods
+ function actionJavaAccess() {
+ showScript(arguments.callee.title,
+ "// just use new JavaClass();\n" +
+ "var fr = new javax.swing.JFrame();\n" +
+ "// call all public methods as in Java\n" +
+ "fr.setTitle('hello');\n" +
+ "fr.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);\n" +
+ "fr.setSize(200, 200);\n" +
+ "fr.setVisible(true);");
+ }
+ actionJavaAccess.title = "Java Object Access";
+
+ // show how to use Java bean conventions
+ function actionJavaBean() {
+ showScript(arguments.callee.title,
+ "var fr = new javax.swing.JFrame();\n" +
+ "fr.setSize(200, 200);\n" +
+ "// access public get/set methods as fields\n" +
+ "fr.defaultCloseOperation = javax.swing.WindowConstants.DISPOSE_ON_CLOSE;\n" +
+ "fr.title = 'hello';\n" +
+ "fr.visible = true;");
+ }
+ actionJavaBean.title = "Java Beans";
+
+ // show how to implement Java interface
+ function actionJavaInterface() {
+ showScript(arguments.callee.title,
+ "// use Java anonymizer class-like syntax!\n" +
+ "var r = new java.lang.Runnable() {\n" +
+ " run: function() {\n" +
+ " alert('hello');\n" +
+ " }\n" +
+ " };\n" +
+ "// use the above Runnable to create a Thread\n" +
+ "new java.lang.Thread(r).start();\n" +
+ "// For simple one method interfaces, just pass script function\n" +
+ "new java.lang.Thread(function() { alert('world'); }).start();");
+ }
+ actionJavaInterface.title = "Java Interfaces";
+
+ // show how to import Java classes, packages
+ function actionJavaImport() {
+ showScript(arguments.callee.title,
+ "// use Java-like import *...\n" +
+ "// importPackage(java.io);\n" +
+ "// or import a specific class\n" +
+ "// importClass(java.io.File);\n" +
+ "// or better - import just within a scope!\n" +
+ "var ioPkgs = JavaImporter(java.io);\n" +
+ "with (ioPkgs) { alert(new File('.').absolutePath); }");
+ }
+ actionJavaImport.title = "Java Import";
+
+ // "Help" menu
+
+ /*
+ * Shows a one liner help message for each
+ * global function. Note that this function
+ * depends on docString meta-data for each
+ * function.
+ */
+ function actionHelpGlobals() {
+ var names = new java.util.ArrayList();
+ for (var i in globalThis) {
+ var func = globalThis[i];
+ if (typeof(func) == "function" &&
+ ("docString" in func)) {
+ names.add(i);
+ }
+ }
+ java.util.Collections.sort(names);
+ var helpDoc = new java.lang.StringBuffer();
+ helpDoc.append("<table border='1'>");
+ var itr = names.iterator();
+ while (itr.hasNext()) {
+ var name = itr.next();
+ helpDoc.append("<tr><td>");
+ helpDoc.append(name);
+ helpDoc.append("</td><td>");
+ helpDoc.append(globalThis[name].docString);
+ helpDoc.append("</td></tr>");
+ }
+ helpDoc.append("</table>");
+
+ var helpEditor = new guiPkgs.JEditorPane();
+ helpEditor.setContentType("text/html");
+ helpEditor.setEditable(false);
+ helpEditor.setText(helpDoc.toString());
+
+ var scroller = new guiPkgs.JScrollPane();
+ var port = scroller.getViewport();
+ port.add(helpEditor);
+
+ var helpFrame = new guiPkgs.JFrame("Help - Global Functions");
+ helpFrame.getContentPane().add("Center", scroller);
+ helpFrame.setDefaultCloseOperation(guiPkgs.WindowConstants.DISPOSE_ON_CLOSE);
+ helpFrame.pack();
+ helpFrame.setSize(500, 600);
+ helpFrame.setVisible(true);
+ }
+
+ // show a simple about message for scriptpad
+ function actionAbout() {
+ alert("Scriptpad\nVersion 1.1", "Scriptpad");
+ }
+
+ /*
+ * This data is used to construct menu bar.
+ * This way adding a menu is easier. Just add
+ * top level menu or add an item to an existing
+ * menu. "action" should be a function that is
+ * called back on clicking the correponding menu.
+ */
+ var menuData = [
+ {
+ menu: "File",
+ items: [
+ { name: "New", action: actionNew , accel: guiPkgs.KeyEvent.VK_N },
+ { name: "Open...", action: actionOpen, accel: guiPkgs.KeyEvent.VK_O },
+ { name: "Open URL...", action: actionOpenURL, accel: guiPkgs.KeyEvent.VK_U },
+ { name: "Save", action: actionSave, accel: guiPkgs.KeyEvent.VK_S },
+ { name: "Save As...", action: actionSaveAs },
+ { name: "-" },
+ { name: "Exit", action: actionExit, accel: guiPkgs.KeyEvent.VK_Q }
+ ]
+ },
+
+ {
+ menu: "Edit",
+ items: [
+ { name: "Cut", action: actionCut, accel: guiPkgs.KeyEvent.VK_X },
+ { name: "Copy", action: actionCopy, accel: guiPkgs.KeyEvent.VK_C },
+ { name: "Paste", action: actionPaste, accel: guiPkgs.KeyEvent.VK_V },
+ { name: "-" },
+ { name: "Select All", action: actionSelectAll, accel: guiPkgs.KeyEvent.VK_A }
+ ]
+ },
+
+ {
+ menu: "Tools",
+ items: [
+ { name: "Run", action: actionRun, accel: guiPkgs.KeyEvent.VK_R }
+ ]
+ },
+
+ {
+ menu: "Examples",
+ items: [
+ { name: actionHello.title, action: actionHello },
+ { name: actionEval.title, action: actionEval },
+ { name: actionJavaStatic.title, action: actionJavaStatic },
+ { name: actionJavaAccess.title, action: actionJavaAccess },
+ { name: actionJavaBean.title, action: actionJavaBean },
+ { name: actionJavaInterface.title, action: actionJavaInterface },
+ { name: actionJavaImport.title, action: actionJavaImport }
+ ]
+ },
+
+ {
+ menu: "Help",
+ items: [
+ { name: "Global Functions", action: actionHelpGlobals },
+ { name: "-" },
+ { name: "About Scriptpad", action: actionAbout }
+ ]
+ }
+ ];
+
+ function setMenuAccelerator(mi, accel) {
+ var keyStroke = guiPkgs.KeyStroke.getKeyStroke(accel,
+ guiPkgs.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
+ mi.setAccelerator(keyStroke);
+ }
+
+ // create a menubar using the above menu data
+ function createMenubar() {
+ var mb = new guiPkgs.JMenuBar();
+ for (var m in menuData) {
+ var items = menuData[m].items;
+ var menu = new guiPkgs.JMenu(menuData[m].menu);
+
+ for (var i in items) {
+ if (items[i].name.equals("-")) {
+ menu.addSeparator();
+ } else {
+ var mi = new guiPkgs.JMenuItem(items[i].name);
+ var action = items[i].action;
+ mi.addActionListener(action);
+ var accel = items[i].accel;
+ if (accel) {
+ setMenuAccelerator(mi, accel);
+ }
+ menu.add(mi);
+ }
+ }
+
+ mb.add(menu);
+ }
+
+ return mb;
+ }
+
+ // function to add a new menu item under "Tools" menu
+ function addTool(menuItem, action, accel) {
+ if (typeof(action) != "function") {
+ return;
+ }
+
+ var toolsIndex = -1;
+ // find the index of the "Tools" menu
+ for (var i in menuData) {
+ if (menuData[i].menu.equals("Tools")) {
+ toolsIndex = i;
+ break;
+ }
+ }
+ if (toolsIndex == -1) {
+ return;
+ }
+ var toolsMenu = frame.getJMenuBar().getMenu(toolsIndex);
+ var mi = new guiPkgs.JMenuItem(menuItem);
+ mi.addActionListener(action);
+ if (accel) {
+ setMenuAccelerator(mi, accel);
+ }
+ toolsMenu.add(mi);
+ }
+
+ // create Scriptpad frame
+ function createFrame() {
+ frame = new guiPkgs.JFrame();
+ frame.setTitle(defaultTitle);
+ frame.setBackground(guiPkgs.Color.lightGray);
+ frame.getContentPane().setLayout(new guiPkgs.BorderLayout());
+
+ // create notepad panel
+ var notepad = new guiPkgs.JPanel();
+ notepad.setBorder(guiPkgs.BorderFactory.createEtchedBorder());
+ notepad.setLayout(new guiPkgs.BorderLayout());
+
+ // create editor
+ editor = createEditor();
+ var scroller = new guiPkgs.JScrollPane();
+ var port = scroller.getViewport();
+ port.add(editor);
+
+ // add editor to notepad panel
+ var panel = new guiPkgs.JPanel();
+ panel.setLayout(new guiPkgs.BorderLayout());
+ panel.add("Center", scroller);
+ notepad.add("Center", panel);
+
+ // add notepad panel to frame
+ frame.getContentPane().add("Center", notepad);
+
+ // set menu bar to frame and show the frame
+ frame.setJMenuBar(createMenubar());
+ frame.setDefaultCloseOperation(guiPkgs.JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setSize(500, 600);
+ }
+
+ // show Scriptpad frame
+ function showFrame() {
+ // set global variable by the name "window"
+ globalThis.window = frame;
+
+ // open new document
+ actionNew();
+
+ frame.setVisible(true);
+ }
+
+ // create and show Scriptpad frame
+ createFrame();
+ showFrame();
+
+ /*
+ * Application object has two fields "frame", "editor"
+ * which are current JFrame and editor and a method
+ * called "addTool" to add new menu item to "Tools" menu.
+ */
+ return {
+ frame: frame,
+ editor: editor,
+ addTool: addTool
+ };
+};
+
+/*
+ * Call the main and store Application object
+ * in a global variable named "application".
+ */
+var application = main();
+
+if (this.load == undefined) {
+ function load(file) {
+ var ioPkgs = new JavaImporter(java.io);
+ with (ioPkgs) {
+ var stream = new FileInputStream(file);
+ var bstream = new BufferedInputStream(stream);
+ var reader = new BufferedReader(new InputStreamReader(bstream));
+ var oldFilename = engine.get(engine.FILENAME);
+ engine.put(engine.FILENAME, file);
+ try {
+ engine.eval(reader, context);
+ } finally {
+ engine.put(engine.FILENAME, oldFilename);
+ }
+ stream.close();
+ }
+ }
+ load.docString = "loads the given script file";
+}
+
+/*
+ * Load user specific init file under home dir, if found.
+ */
+function loadUserInit() {
+ var home = java.lang.System.getProperty("user.home");
+ var f = new java.io.File(home, "scriptpad.js");
+ if (f.exists()) {
+ engine.eval(new java.io.FileReader(f));
+ }
+}
+
+loadUserInit();
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/README.txt b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/README.txt
new file mode 100644
index 0000000..72e162d
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/README.txt
@@ -0,0 +1,52 @@
+Sample scripts:
+
+(1) browse.js
+
+ -- Open and run this script in scriptpad. You will see
+ Tools->Browse menu. Using this you can start your
+ desktop default browser with the given URL.
+
+(2) insertfile.js
+
+ -- Open and run this script in scriptpad. You will see
+ "Tools->Insert File..." menu. Using this you can start
+ insert content of a selected file into currently
+ edited document
+
+(3) linewrap.js
+
+ -- Open and run this script in scriptpad. You will see
+ "Tools->Line Wrap" menu. Using this you can toggle
+ the line wrapping mode of the editor
+
+(4) mail.js
+
+ -- Open and run this script in scriptpad. You will see
+ Tools->Mail menu. Using this you can start your
+ desktop default mail client with the given "To" mail id.
+
+(5) memmonitor.js
+
+ -- This is a simple Monitoring & Management script. To use this,
+ you need an application to monitor. You can use memory.bat
+ or memory.sh in the current directory to start an application
+ that will be monitored. After that please follow these steps:
+
+ 1. Start the target application using memory.sh or memory.bat
+ 2. Start scriptpad
+ 3. Use "Tools->JMX Connect" menu and specify "localhost:1090"
+ to connect
+ 4. Open "memmonitor.js" and run it (using "Tools->Run")
+ in scriptpad
+ 5. A new "Tools-Memory Monitor" menu appears. Use this menu
+ and specify 4 and 500 as threshold and interval values.
+ 6. In the target application shell (where memory.bat/.sh was
+ started), enter an integer value and press "enter".
+ 7. You'll see an alert box from scriptpad -- alerting you for
+ memory threshold exceeded!
+
+(6) textcolor.js
+
+ -- Open and run this script in scriptpad. You will see
+ "Tools->Selected Text Color..." menu. Using this you
+ change the color of "selected text" in the editor.
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/browse.js b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/browse.js
new file mode 100644
index 0000000..fbe50e1
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/browse.js
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This function uses new Swing Desktop API in JDK 6.
+ * To use this with scriptpad, open this in scriptpad
+ * and use "Tools->Run Script" menu.
+ */
+function browse() {
+ var desktop = null;
+ // Before more Desktop API is used, first check
+ // whether the API is supported by this particular
+ // virtual machine (VM) on this particular host.
+ if (java.awt.Desktop.isDesktopSupported()) {
+ desktop = java.awt.Desktop.getDesktop();
+ } else {
+ alert("no desktop support");
+ return;
+ }
+
+ if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
+ var url = prompt("Address:");
+ if (url != null) {
+ desktop.browse(new java.net.URI(url));
+ }
+ } else {
+ alert("no browser support");
+ }
+}
+
+if (this.application != undefined) {
+ // add "Browse" menu item under "Tools" menu
+ this.application.addTool("Browse", browse);
+}
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/insertfile.js b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/insertfile.js
new file mode 100644
index 0000000..07a7ac2
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/insertfile.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script adds "Insert File" mode menu item to "Tools" menu.
+ * When selected, this menu shows a file dialog box and inserts
+ * contents of the selected file into current document (at the
+ * current caret position).
+ */
+if (this.application) {
+ application.addTool("Insert File...",
+ function() {
+ var file = fileDialog();
+
+ if (file) {
+ var reader = new java.io.FileReader(file);
+ var arr = java.lang.reflect.Array.newInstance(
+ java.lang.Character.TYPE, 8*1024); // 8K at a time
+ var buf = new java.lang.StringBuffer();
+ var numChars;
+
+ while ((numChars = reader.read(arr, 0, arr.length)) > 0) {
+ buf.append(arr, 0, numChars);
+ }
+
+ var pos = application.editor.caretPosition;
+ var doc = application.editor.document;
+
+ doc.insertString(pos, buf.toString(), null);
+ }
+ });
+}
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/linewrap.js b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/linewrap.js
new file mode 100644
index 0000000..989473a
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/linewrap.js
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script adds "Line Wrap" mode menu item to "Tools" menu.
+ * When selected, this menu toggles the current word wrap mode
+ * of the editor.
+ */
+
+function toggleLineWrap() {
+ var wrap = application.editor.lineWrap;
+ application.editor.lineWrap = !wrap;
+}
+
+application.addTool("Line Wrap", toggleLineWrap);
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/mail.js b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/mail.js
new file mode 100644
index 0000000..cabe5c4
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/mail.js
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This function uses new Swing Desktop API in JDK 6.
+ * To use this with scriptpad, open this in scriptpad
+ * and use "Tools->Run Script" menu.
+ */
+function mail() {
+ var desktop = null;
+ // Before more Desktop API is used, first check
+ // whether the API is supported by this particular
+ // virtual machine (VM) on this particular host.
+ if (java.awt.Desktop.isDesktopSupported()) {
+ desktop = java.awt.Desktop.getDesktop();
+ } else {
+ alert("no desktop support");
+ return;
+ }
+
+ if (desktop.isSupported(java.awt.Desktop.Action.MAIL)) {
+ var mailTo = prompt("Mail To:");
+ if (mailTo != null) {
+ desktop.mail(new java.net.URI("mailto", mailTo, null));
+ }
+ }
+}
+
+if (this.application != undefined) {
+ // add "Mail" menu item under "Tools" menu
+ this.application.addTool("Mail", mail);
+}
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js
new file mode 100644
index 0000000..0744e30
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memmonitor.js
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+// this checker function runs asynchronously
+function memoryChecker(memoryBean, threshold, interval) {
+ while (true) {
+ var memUsage = memoryBean.HeapMemoryUsage;
+ var usage = memUsage.get("used") / (1024 * 1024);
+
+ println("usage: " + usage);
+
+ if (usage > threshold) {
+ alert("Hey! heap usage threshold exceeded!");
+ // after first alert just return.
+ return;
+ }
+
+ java.lang.Thread.sleep(interval);
+ }
+}
+
+// add "Tools->Memory Monitor" menu item
+if (this.application != undefined) {
+ this.application.addTool("Memory Monitor",
+ function () {
+ // show threshold box with default of 50 MB
+ var threshold = prompt("Threshold (mb)", 50);
+
+ // show interval box with default of 1000 millisec.
+ var interval = prompt("Sample Interval (ms):", 1000);
+ var memoryBean = mbean("java.lang:type=Memory");
+
+ // ".future" makes the function to be called
+ // asynchronously in a separate thread.
+ memoryChecker.future(memoryBean, threshold, interval);
+ });
+}
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.bat b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.bat
new file mode 100644
index 0000000..9478c09
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.bat
@@ -0,0 +1,35 @@
+@echo off
+REM
+REM Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+REM
+REM Redistribution and use in source and binary forms, with or without
+REM modification, are permitted provided that the following conditions
+REM are met:
+REM
+REM - Redistributions of source code must retain the above copyright
+REM notice, this list of conditions and the following disclaimer.
+REM
+REM - Redistributions in binary form must reproduce the above copyright
+REM notice, this list of conditions and the following disclaimer in the
+REM documentation and/or other materials provided with the distribution.
+REM
+REM - Neither the name of Oracle nor the names of its
+REM contributors may be used to endorse or promote products derived
+REM from this software without specific prior written permission.
+REM
+REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+REM IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+REM THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+REM PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+REM CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+REM EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+REM PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+REM PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+REM LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+REM NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+REM SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+REM
+
+
+jrunscript -J-Dcom.sun.management.jmxremote.port=1090 -J-Dcom.sun.management.jmxremote.ssl=false -J-Dcom.sun.management.jmxremote.authenticate=false memory.js
+
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.js b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.js
new file mode 100644
index 0000000..b8252fb
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.js
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script serves as a simple "monitored application".
+ * Start this script using memory.bat or memory.sh in the
+ * current directory.
+ */
+
+java.lang.System.out.print("Enter a number and press enter:");
+var input = java.lang.System["in"].read();
+
+// allocate an integer array of "big enough" size!
+var a = java.lang.reflect.Array.newInstance(
+ java.lang.Integer.TYPE, input * 1024 * 1024);
+
+// sleep some time...
+java.lang.Thread.sleep(10*60*1000);
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.sh b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.sh
new file mode 100644
index 0000000..8da155b
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/memory.sh
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# - 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.
+#
+# - Neither the name of Oracle nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS 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.
+#
+
+jrunscript -J-Dcom.sun.management.jmxremote.port=1090 -J-Dcom.sun.management.jmxremote.ssl=false -J-Dcom.sun.management.jmxremote.authenticate=false memory.js
diff --git a/staging/linux-x86/sample/scripting/scriptpad/src/scripts/textcolor.js b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/textcolor.js
new file mode 100644
index 0000000..b9d86cc
--- /dev/null
+++ b/staging/linux-x86/sample/scripting/scriptpad/src/scripts/textcolor.js
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation and proper error handling, might not be present in
+ * this sample code.
+ */
+
+/*
+ * This script adds "Selected Text Color" menu item to "Tools" menu.
+ * When selected, this menu changes the "selected text" color.
+ */
+if (this.application) {
+ application.addTool("Selected Text Color...",
+ function() {
+ var color = application.editor.selectedTextColor;
+ color = colorDialog("Selected Text Color", color);
+ application.editor.selectedTextColor = color;
+ });
+}
diff --git a/staging/linux-x86/sample/try-with-resources/index.html b/staging/linux-x86/sample/try-with-resources/index.html
new file mode 100644
index 0000000..ff237d8
--- /dev/null
+++ b/staging/linux-x86/sample/try-with-resources/index.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>Try-with-Resources Feature Demo</title>
+</head>
+<body>
+<h2>Try-with-Resources Feature Demo</h2>
+
+<p>
+ This demo shows how to use the try-with-resources feature introduced in JDK7.
+</p>
+
+<ul>
+ <li><h3>Custom AutoCloseable.</h3>
+
+ <p>
+ Shows how to use a custom resource with the try-with-resources construct.
+ For more information, see the source file.
+ </p>
+ Source: <a href="src/CustomAutoCloseableSample.java">src/CustomAutoCloseableSample.java</a>
+
+ <li><h3>Unzip</h3>
+
+ <p>
+ Extracts archived files. For more information, see the source file.
+ </p>
+ Source: <a href="src/Unzip.java">src/Unzip.java</a>
+ <li><h3>ZipCat</h3>
+
+ <p>Prints data about a specified file from an archive. For more information, see the source file.</p>
+ Source: <a href="src/ZipCat.java">src/ZipCat.java</a>
+
+</ul>
+</body>
+</html> \ No newline at end of file
diff --git a/staging/linux-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java b/staging/linux-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java
new file mode 100644
index 0000000..9bbe09a
--- /dev/null
+++ b/staging/linux-x86/sample/try-with-resources/src/CustomAutoCloseableSample.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * This sample demonstrates the ability to create custom resource that
+ * implements the {@code AutoCloseable} interface. This resource can be used in
+ * the try-with-resources construct.
+ */
+public class CustomAutoCloseableSample {
+
+ /**
+ * The main method for the CustomAutoCloseableSample program.
+ *
+ * @param args is not used.
+ */
+ public static void main(String[] args) {
+ /*
+ * TeeStream will be closed automatically after the try block.
+ */
+ try (TeeStream teeStream = new TeeStream(System.out, Paths.get("out.txt"));
+ PrintStream out = new PrintStream(teeStream)) {
+ out.print("Hello, world");
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Passes the output through to the specified output stream while copying it into a file.
+ * The TeeStream functionality is similar to the Unix tee utility.
+ * TeeStream implements AutoCloseable interface. See OutputStream for details.
+ */
+ public static class TeeStream extends OutputStream {
+
+ private final OutputStream fileStream;
+ private final OutputStream outputStream;
+
+ /**
+ * Creates a TeeStream.
+ *
+ * @param outputStream an output stream.
+ * @param outputFile an path to file.
+ * @throws IOException If an I/O error occurs.
+ */
+ public TeeStream(OutputStream outputStream, Path outputFile) throws IOException {
+ this.fileStream = new BufferedOutputStream(Files.newOutputStream(outputFile));
+ this.outputStream = outputStream;
+ }
+
+ /**
+ * Writes the specified byte to the specified output stream
+ * and copies it to the file.
+ *
+ * @param b the byte to be written.
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public void write(int b) throws IOException {
+ fileStream.write(b);
+ outputStream.write(b);
+ }
+
+ /**
+ * Flushes this output stream and forces any buffered output bytes
+ * to be written out.
+ * The <code>flush</code> method of <code>TeeStream</code> flushes
+ * the specified output stream and the file output stream.
+ *
+ * @throws IOException if an I/O error occurs.
+ */
+ @Override
+ public void flush() throws IOException {
+ outputStream.flush();
+ fileStream.flush();
+ }
+
+ /**
+ * Closes underlying streams and resources.
+ * The external output stream won't be closed.
+ * This method is the member of AutoCloseable interface and
+ * it will be invoked automatically after the try-with-resources block.
+ *
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public void close() throws IOException {
+ try (OutputStream file = fileStream) {
+ flush();
+ }
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/try-with-resources/src/Unzip.java b/staging/linux-x86/sample/try-with-resources/src/Unzip.java
new file mode 100644
index 0000000..d75eba5
--- /dev/null
+++ b/staging/linux-x86/sample/try-with-resources/src/Unzip.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.*;
+
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+
+/**
+ * Extract (unzip) a file to the current directory.
+ */
+public class Unzip {
+
+ /**
+ * The main method for the Unzip program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for {@code Unzip}.
+ */
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ System.out.println("Usage: Unzip zipfile");
+ }
+ final Path destDir = Paths.get(".");
+ /*
+ * Create AutoCloseable FileSystem. It will be closed automatically
+ * after the try block.
+ */
+ try (FileSystem zipFileSystem = FileSystems.newFileSystem(Paths.get(args[0]), null)) {
+
+ Path top = zipFileSystem.getPath("/");
+ Files.walk(top).skip(1).forEach(file -> {
+ Path target = destDir.resolve(top.relativize(file).toString());
+ System.out.println("Extracting " + target);
+ try {
+ Files.copy(file, target, REPLACE_EXISTING);
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
+ });
+ } catch (UncheckedIOException | IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/staging/linux-x86/sample/try-with-resources/src/ZipCat.java b/staging/linux-x86/sample/try-with-resources/src/ZipCat.java
new file mode 100644
index 0000000..4bbf513
--- /dev/null
+++ b/staging/linux-x86/sample/try-with-resources/src/ZipCat.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS 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.
+ */
+
+/*
+ * This source code is provided to illustrate the usage of a given feature
+ * or technique and has been deliberately simplified. Additional steps
+ * required for a production-quality application, such as security checks,
+ * input validation, and proper error handling, might not be present in
+ * this sample code.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+/**
+ * Prints data of the specified file to standard output from a zip archive.
+ */
+public class ZipCat {
+
+ /**
+ * The main method for the ZipCat program. Run the program with an empty
+ * argument list to see possible arguments.
+ *
+ * @param args the argument list for ZipCat
+ */
+ public static void main(String[] args) {
+ if (args.length != 2) {
+ System.out.println("Usage: ZipCat zipfile fileToPrint");
+ }
+ /*
+ * Creates AutoCloseable FileSystem and BufferedReader.
+ * They will be closed automatically after the try block.
+ * If reader initialization fails, then zipFileSystem will be closed
+ * automatically.
+ */
+ try (FileSystem zipFileSystem
+ = FileSystems.newFileSystem(Paths.get(args[0]),null);
+ InputStream input
+ = Files.newInputStream(zipFileSystem.getPath(args[1]))) {
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = input.read(buffer)) != -1) {
+ System.out.write(buffer, 0, len);
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/staging/linux-x86/src.zip b/staging/linux-x86/src.zip
new file mode 100644
index 0000000..62b8b88
--- /dev/null
+++ b/staging/linux-x86/src.zip
Binary files differ
diff --git a/staging/manifest.xml b/staging/manifest.xml
new file mode 100644
index 0000000..3565635
--- /dev/null
+++ b/staging/manifest.xml
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<manifest>
+ <remote fetch=".." name="goog" review="sso://googleplex-android/" />
+ <default remote="goog" revision="mirror-aosp-studio-master-dev" sync-j="4" />
+ <project name="platform/external/jetbrains/jdk8u" path="external/jetbrains/jdk8u" revision="8528ffc9e8499d0178ee982c3280493c0e2d7525" upstream="mirror-aosp-studio-master-dev" />
+ <project name="platform/external/jetbrains/jdk8u_corba" path="external/jetbrains/jdk8u_corba" revision="c55762da91519a85fb2fd0b4f415735a12cc4888" upstream="mirror-aosp-studio-master-dev" />
+ <project name="platform/external/jetbrains/jdk8u_hotspot" path="external/jetbrains/jdk8u_hotspot" revision="38469b8c8e872685dc7fbd57b8a1986f89d0552a" upstream="mirror-aosp-studio-master-dev" />
+ <project name="platform/external/jetbrains/jdk8u_jaxp" path="external/jetbrains/jdk8u_jaxp" revision="ad06f386190d159fe7bc8202b3abae2f1b218ecd" upstream="mirror-aosp-studio-master-dev" />
+ <project name="platform/external/jetbrains/jdk8u_jaxws" path="external/jetbrains/jdk8u_jaxws" revision="1608370faaf8ca1655f5442d66d2cfd6282747c7" upstream="mirror-aosp-studio-master-dev" />
+ <project name="platform/external/jetbrains/jdk8u_jdk" path="external/jetbrains/jdk8u_jdk" revision="142f30c6c0cd6d9daf35ae3248b2e3b753fb3344" upstream="mirror-aosp-studio-master-dev" />
+ <project name="platform/external/jetbrains/jdk8u_langtools" path="external/jetbrains/jdk8u_langtools" revision="fe8ba49ea8854950d9d756b7b2ac937c4a3f9577" upstream="mirror-aosp-studio-master-dev" />
+ <project name="platform/external/jetbrains/jdk8u_nashorn" path="external/jetbrains/jdk8u_nashorn" revision="45faba88ae10e979db10142c68d02d986018010a" upstream="mirror-aosp-studio-master-dev" />
+ <project name="toolchain/jdk/jdk9" path="toolchain/jdk/jdk9" revision="4c1e9bbe664e532f83b258e6c8a214b0241530d8" upstream="mirror-aosp-master" />
+ <project name="toolchain/jdk/jdk9_corba" path="toolchain/jdk/jdk9_corba" revision="b4ed46425f74345716ac4532e50a543226c1a1fe" upstream="mirror-aosp-master" />
+ <project name="toolchain/jdk/jdk9_hotspot" path="toolchain/jdk/jdk9_hotspot" revision="17fac2f462332e5590370849ec37fea9f014af97" upstream="mirror-aosp-master" />
+ <project name="toolchain/jdk/jdk9_jaxp" path="toolchain/jdk/jdk9_jaxp" revision="9d0d323a61a1cd4930ebca527673992ece7ab1d3" upstream="mirror-aosp-master" />
+ <project name="toolchain/jdk/jdk9_jaxws" path="toolchain/jdk/jdk9_jaxws" revision="cc2e16b7e6d0b1f6a4dbc28ffaf3a22b19991dd7" upstream="mirror-aosp-master" />
+ <project name="toolchain/jdk/jdk9_jdk" path="toolchain/jdk/jdk9_jdk" revision="d9bced18549d518442af72ecfa84506b26566283" upstream="mirror-aosp-master" />
+ <project name="toolchain/jdk/jdk9_langtools" path="toolchain/jdk/jdk9_langtools" revision="21d5ec9f070a5709fd8183c106840c13c0182a29" upstream="mirror-aosp-master" />
+ <project name="toolchain/jdk/jdk9_nashorn" path="toolchain/jdk/jdk9_nashorn" revision="fbaa32dd52163c8f4f939001dfd8a9f46a08eff2" upstream="mirror-aosp-master" />
+ <!-- prebuilts projects -->
+ <project clone-depth="1" name="platform/prebuilts/build-tools" path="prebuilts/build-tools" revision="13db9fd267baf97807d1271121837bd6a882670f" upstream="mirror-aosp-master" />
+ <project clone-depth="1" name="platform/prebuilts/clang/host/darwin-x86" path="prebuilts/clang/host/darwin-x86" revision="a342c52d2e5220273cbf1d3316b8fe1e4c7194ed" upstream="mirror-aosp-master" />
+ <project clone-depth="1" name="platform/prebuilts/clang/host/linux-x86" path="prebuilts/clang/host/linux-x86" revision="13c8d4e296fa2badce7d0dcabeafd63ff58774ba" upstream="mirror-aosp-master" />
+ <project clone-depth="1" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8" revision="2ccb38af8c940f1feef62ff5986f4bbc5d899e66" upstream="mirror-aosp-master" />
+ <project clone-depth="1" name="platform/prebuilts/studio/jdk" path="prebuilts/studio/jdk" revision="4d8d242a60231f0bf8e8622a64c368f0e2187d2d" upstream="mirror-aosp-studio-master-dev" />
+ <!-- build projects -->
+ <project clone-depth="1" name="toolchain/jdk/build" path="toolchain/jdk/build" revision="075263c362888278345e3c875bfbf23713cd0838" upstream="mirror-aosp-master" />
+ <project clone-depth="1" name="toolchain/jdk/deps" path="toolchain/jdk/deps" revision="76d7e49d62136f36810507a366504379174cc6b2" upstream="master" />
+</manifest>